epi2me-labs / wf-transcriptomes

Other
64 stars 30 forks source link

random reference condition sent to edgeR #36

Closed RPdavies closed 7 months ago

RPdavies commented 9 months ago

Operating System

Other Linux (please specify below)

Other Linux

Ubuntu 18

Workflow Version

wf-transcriptomes v0.4.1-g0a8fe19

Workflow Execution

Command line

EPI2ME Version

No response

CLI command run

nextflow run epi2me-labs/wf-transcriptomes -profile singularity --fastq differential_expression/differential_expression_fastq --transcriptome-source precomputed --de_analysis --ref_genome differential_expression/hg38_chr20.fa --ref_annotation differential_expression/gencode.v22.annotation.chr20.gff --direct_rna --minimap2_index_opts '-k 15' --ref_transcriptome differential_expression/ref_transcriptome.fasta --sample_sheet differential_expression/sample_sheet.csv

Workflow Execution - CLI Execution Profile

singularity

What happened?

Line 22 in de_analysis.R by default sets the reference condition in the LFC calculation (lines 74-79) by reverse alphabetical order. This only works if the reference condition comes last alphabetically, such as 'untreated' vs 'treated'. If the reference condition is set in the sample sheet as 'control', then 'treated' is automatically set as the reference and the LFC direction becomes inverted, with genes up-regulated in the 'treatment' condition seen as down-regualted. As no restrictions on the condition names are mentioned in the instructions, this can lead to misinterpretation of the results. This could be easily fixed by setting the reference explicitly to 'control' or 'treatment' using relevel(), and asking the user to use that nomenclature in their sample sheet.

Relevant log output

NA

Application activity log entry

No response

RPdavies commented 8 months ago

Correction: it can be fixed by setting the reference explicitly to 'control' or 'untreated' using relevel(), not 'treatemnt'.. Thanks.

sarahjeeeze commented 8 months ago

Hi, thanks for pointing this out. We will investigate it and try to add a fix or add something to the documentation to ensure users are aware.

RPdavies commented 8 months ago

No problem, happy to help. I have implemented a solution in my fork, in case you are interested. Lines 28-32: https://github.com/RPdavies/wf-transcriptomes/blob/master/bin/de_analysis.R

sarahjeeeze commented 8 months ago

That's really helpful, thank you!

sarahjeeeze commented 8 months ago

We added your fix to the pre-release and it will be included in the next release. Thanks again for your help.

sarahjeeeze commented 7 months ago

Closing as this is now resolved