Skip to content

Commit

Permalink
[functional_analysis] add test for limmavoom+gsea
Browse files Browse the repository at this point in the history
  • Loading branch information
suzannejin committed Dec 20, 2024
1 parent 6c3df56 commit e8f105c
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
process {
withName: 'LIMMA_DIFFERENTIAL' {
ext.args = { [
"--blocking_variables $meta.blocking",
"--sample_id_col sample",
"--probe_id_col gene_id",
"--use_voom TRUE"
].join(' ').trim() }

ext.prefix = { "${meta.id}_${meta.method}_voom" }
}

withName: 'LIMMA_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_voom_norm" }
}

withName: 'CUSTOM_TABULARTOGSEACLS' {
ext.args = { [ "variable": "$meta.variable" ] }
}

withName: 'GSEA_GSEA' {
ext.args = { "-rnd_seed 1234" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,110 @@ nextflow_workflow {
)
}
}

test("limmavoom + gsea - mouse - basic") {

tag "limmavoom+gsea"
config "./limmavoom_gsea.config"

setup {
run("ABUNDANCE_DIFFERENTIAL_FILTER") {
script "../../abundance_differential_filter/main.nf"
workflow {
"""
// Define test data
def testData = [
expression_test_data_dir: params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/',
contrasts_file: 'SRP254919.contrasts.csv',
abundance_file: 'SRP254919.salmon.merged.gene_counts.top1000cov.tsv',
samplesheet_file: 'SRP254919.samplesheet.csv'
]
// Define inputs
ch_samplesheet = Channel.of([
[ id:'test' ],
file(testData.expression_test_data_dir + testData.samplesheet_file)
])
ch_transcript_lengths = Channel.of([ [], [] ])
ch_control_features = Channel.of([ [], [] ])
ch_contrasts = Channel.fromPath(file(testData.expression_test_data_dir + testData.contrasts_file))
.splitCsv ( header:true, sep:',' )
.map{
tuple(it, it.variable, it.reference, it.target)
}
ch_input = Channel.of([
[ id:'test' ],
file(testData.expression_test_data_dir + testData.abundance_file),
'limma', // analysis method
1.5, // FC threshold
0.05 // padj threshold
])
input[0] = ch_input
input[1] = ch_samplesheet
input[2] = ch_transcript_lengths
input[3] = ch_control_features
input[4] = ch_contrasts
"""
}
}
}

when {
workflow {
"""
// Define test data
def test_data_dir = params.modules_testdata_base_path + 'genomics/mus_musculus/'
def testData = [
contrasts_file: test_data_dir + 'rnaseq_expression/SRP254919.contrasts.csv',
abundance_file: test_data_dir + 'rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv',
samplesheet_file: test_data_dir + 'rnaseq_expression/SRP254919.samplesheet.csv',
genesets_file: test_data_dir + 'gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt'
]
ch_input = ABUNDANCE_DIFFERENTIAL_FILTER.out.normalised_matrix
.map { meta, matrix ->
meta['method_de'] = meta['method']
[meta, matrix, 'gsea']
}
ch_gene_sets = Channel.of([
[ id:'test' ],
file(testData.genesets_file)
])
ch_contrasts = Channel.fromPath(file(testData.contrasts_file))
.splitCsv ( header:true, sep:',' )
.map{
tuple(it, it.variable, it.reference, it.target)
}
ch_samplesheet = Channel.of([
[ id:'test' ],
file(testData.samplesheet_file)
])
ch_featuresheet = Channel.of([
[ id:'test' ],
file(testData.abundance_file),
'gene_id',
'gene_name'
])
input[0] = ch_input
input[1] = ch_gene_sets
input[2] = [[], []]
input[3] = ch_contrasts
input[4] = ch_samplesheet
input[5] = ch_featuresheet
"""
}
}

then {
assertAll(
{ assert workflow.success},
{ assert snapshot(
workflow.out.report_gsea
).match()}
// { assert path(workflow.out.versions[0]).readLines().contains('gsea: 4.3.2')}
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,41 @@
},
"timestamp": "2024-12-18T14:24:29.543380157"
},
"limmavoom + gsea - mouse - basic": {
"content": [
[
[
{
"id": "treatment_mCherry_hND6__test",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "",
"method": "gsea"
},
"treatment_mCherry_hND6__testgsea_report_for_mCherry.tsv:md5,ce8792382ae299749445767ff16aaecc",
"treatment_mCherry_hND6__testgsea_report_for_hND6.tsv:md5,a76d06ccbd445134408a70d3344a01e2"
],
[
{
"id": "treatment_mCherry_hND6_sample_number_test",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "sample_number",
"method": "gsea"
},
"treatment_mCherry_hND6_sample_number_testgsea_report_for_mCherry.tsv:md5,ce8792382ae299749445767ff16aaecc",
"treatment_mCherry_hND6_sample_number_testgsea_report_for_hND6.tsv:md5,a76d06ccbd445134408a70d3344a01e2"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-20T10:40:56.08836273"
},
"deseq2 + gprofiler2 - mouse - basic": {
"content": [
[
Expand Down

0 comments on commit e8f105c

Please sign in to comment.