gravatar for solarchan7

2 hours ago by

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!



Source link