Skip to content

Commit 2d4a534

Browse files
committed
fix: corrects EdgeR DEA analysis
This commit replaces the usage of exactTest by glmFit + glmLRT that is the proper way of using the desing matrix and account for batch factors in DEA (exactTest ignores the other factors in the design).:
1 parent e565695 commit 2d4a534

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

pipeline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<pipeline xmlns="http://www.sing-group.org/compi/pipeline-1.0"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5-
<version>1.1.0</version>
5+
<version>1.1.1</version>
66

77
<params>
88
<param name="workingDir" shortName="wd" global="true" defaultValue="/working_dir">The working directory of the project.</param>

resources/scripts/run_edger_exact-test.R

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,18 @@ pt('')
140140

141141
#estimate dispersion
142142
y = estimateDisp(y,design)
143-
#Differential expression analysis using an exact test
144-
et = exactTest(y)
143+
#Differential expression analysis using glmFit and glmLRT
144+
fit = glmFit(y, design)
145+
# Testing the effect of 'group' with coef=2
146+
lrt = glmLRT(fit, coef=2)
145147

146148
#RESULTS
147149
#Get a list with the DE miRNAs (p.value cut-off refers to adjusted pvalue)
148-
DE_miRNAs = topTags(et, n=Inf, p.value=padj, adjust.method="BH", sort.by="PValue")
150+
DE_miRNAs = topTags(lrt, n=Inf, p.value=padj, adjust.method="BH", sort.by="PValue")
149151

150152
if (length(DE_miRNAs) != 0){
151153
DE_miRNAs = data.frame(DE_miRNAs$table)
152-
DE_miRNAs = DE_miRNAs[abs(DE_miRNAs$logFC) >= logFC,]
153-
154-
#summary of the results
155-
print(head(DE_miRNAs, 10))
156-
154+
DE_miRNAs = DE_miRNAs[abs(DE_miRNAs$logFC) >= logFC,]
157155
} else {
158156
print(paste0('[PIPELINE | edger]: [INFO] No differentially expressed miRNAs on contrast', contrast_table$name))
159157
}
@@ -175,9 +173,10 @@ write.table(row.names(DE_miRNAs),
175173
row.names = FALSE,
176174
col.names = FALSE)
177175
#save the whole EdgeR table
178-
results = topTags(et, nrow(et))$table
176+
results = topTags(lrt, nrow(lrt))$table
179177
dataframe_save = as.data.frame(results)
180178
dataframe_save = cbind(Feature = rownames(results), dataframe_save)
181-
colnames(dataframe_save) = c('Feature', 'log2FC', 'logCPM', 'pvalue', 'qvalue') # logFC = log2FC, see: https://www.biostars.org/p/303806/#303829
179+
colnames(dataframe_save) = c('Feature', 'log2FC', 'logCPM', 'LR', 'pvalue', 'qvalue') # logFC = log2FC, see: https://www.biostars.org/p/303806/#303829
180+
dataframe_save = dataframe_save[, !(colnames(dataframe_save) %in% c('LR'))]
182181
write.table(dataframe_save, path_output_file, row.names = FALSE, col.names = TRUE, sep = '\t')
183182
ptm('Done')

0 commit comments

Comments
 (0)