I'm trying to find the differences between the test and control groups (genes). But the results are not consistence. For example, when there's a decrease in the test group, the fold change is positive! This happens in about 5/200 of them. Here's my codes, I don't know what's wrong... (because of the signed contact, I can't post any data here, sorry!) :

The data (df) is like:

gene Test1 Test2 Test3 Control1 Control2 Control3 Control4

A ...

B ...

C ...

...

n = 200

```
groups = factor(c(rep("test",3), rep("control",4)))
dge = DGEList(as.matrix(df), group = groups)
dge = calcNormFactors(dge, method = "TMM")
design_matrix = model.matrix(~0+groups, data = dge$samples)
colnames(design_matrix) = c("test", "control")
dge = estimateDisp(dge, design_matrix, robust=TRUE)
FIT = glmQLFit(dge, design_matrix, robust=TRUE)
model = glmQLFTest(FIT, contrast = makeContrasts(contrasts = c("test-control"), levels = design_matrix))
output = data.frame(Gene = rownames(dge$counts), FoldChange = 2^-(model$table$logFC))
```

thanks in advance!

Unclear what the problem is. Do you run the analysis on only 200 genes? What do you mean by

`when there's a decrease in the test group`

?Thanks for the reply. For example, the data is like: (https://ibb.co/8ckvMdx)

where the test group values are less than the control groups, but the fold change is 2! but the following line, the test group values are also less than the control groups but the fold change is ~0.5 which make way more sense.

It looks like you are assuming the rows are in the same order in

`dge`

and in`model$table`

. Are you sure this is the case?ummmm..... not really. How can I check if they match up?

They are in the same order.