Skip to content

Commit 8dc9306

Browse files
authored
Merge pull request #513 from nf-core/fix-contrast-schema
Allow zero-intercept models in contrasts schema
2 parents 942ab15 + 349eecb commit 8dc9306

File tree

5 files changed

+108
-1
lines changed

5 files changed

+108
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727

2828
### Fixed
2929

30+
- [[#513](https://github.com/nf-core/differentialabundance/pull/513)] - Fix contrast schema to allow for zero-intercept models. ([@grst](https://github.com/grst), review by [@pinin4fjords](https://github.com/pinin4fjords)).
3031
- [[#476](https://github.com/nf-core/differentialabundance/pull/476)] - Fixed null.csv and warning at top of report ([@SusiJo](https://github.com/SusiJo), reviewed by [@pinin4fjords](https://github.com/pinin4fjords), [@atrigila](https://github.com/atrigila), [@maxulysse](https://github.com/maxulysse))
3132
- [[#358](https://github.com/nf-core/differentialabundance/pull/358)] - Fixed nf-tests not running due to `--changed-since HEAD^`([@atrigila](https://github.com/atrigila), review by [@pinin4fjords](https://github.com/pinin4fjords))
3233
- [[#344](https://github.com/nf-core/differentialabundance/pull/344)] - Fixed replacement of NA sub-strings

assets/schema_contrasts.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"formula": {
1717
"type": "string",
18-
"pattern": "^~\\s*[a-zA-Z_][a-zA-Z0-9_]*(\\s*([:+*])\\s*[a-zA-Z_][a-zA-Z0-9_]*)*$"
18+
"pattern": "^~\\s*(?:[A-Za-z0-9_]+(?:\\s*(?:[:+*])\\s*[A-Za-z0-9_]+)*)?(?:\\s*-\\s*1)?$"
1919
},
2020
"comparison": {
2121
"type": "array",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
contrasts:
2+
- id: treatment_effect_classic_comparison
3+
comparison: ["treatment", "Control", "Treated"]
4+
5+
- id: treatment_plus_genotype
6+
formula: "~ treatment + genotype"
7+
make_contrasts_str: "treatmentTreated"
8+
9+
- id: interaction_genotype_treatment
10+
formula: "~ genotype * treatment"
11+
make_contrasts_str: "genotypeWT.treatmentTreated"
12+
13+
- id: full_model_with_interactions
14+
formula: "~ genotype * treatment * time"
15+
make_contrasts_str: "genotypeWT.treatmentTreated.time"
16+
17+
- id: zero_intercept_model_1
18+
formula: "~ 0 + genotype"
19+
make_contrasts_str: "genotypeWT"
20+
21+
- id: zero_intercept_model_2
22+
formula: "~ genotype - 1"
23+
make_contrasts_str: "genotypeWT"

tests/test_rnaseq_dream.nf.test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,35 @@ nextflow_pipeline {
6767
}
6868
}
6969

70+
test("Test rnaseq dream profile - complex contrast - with zero intercept") {
71+
when {
72+
params {
73+
outdir = "$outputDir"
74+
contrasts_yml = "$projectDir/tests/assets/zero_intercept_contrasts.yml"
75+
}
76+
}
77+
78+
then {
79+
// stable_name: All files + folders in ${params.outdir}/ with a stable name
80+
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
81+
// stable_path: All files in ${params.outdir}/ with stable content
82+
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
83+
assertAll(
84+
{ assert workflow.success},
85+
{ assert snapshot(
86+
// Number of successful tasks
87+
workflow.trace.succeeded().size(),
88+
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
89+
removeNextflowVersion("$outputDir/pipeline_info/nf_core_differentialabundance_software_versions.yml"),
90+
// All stable path name, with a relative path
91+
stable_name,
92+
// All files with stable contents
93+
stable_path
94+
).match() }
95+
)
96+
}
97+
}
98+
7099
test("Test rnaseq dream profile - with decoupler") {
71100

72101
when {

tests/test_rnaseq_dream.nf.test.snap

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,59 @@
171171
"nextflow": "25.04.7"
172172
},
173173
"timestamp": "2025-09-23T15:46:34.43412188"
174+
},
175+
"Test rnaseq dream profile - complex contrast - with zero intercept": {
176+
"content": [
177+
14,
178+
{
179+
"CUSTOM_FILTERDIFFERENTIALTABLE": {
180+
"pandas": "1.5.2"
181+
},
182+
"GTF_TO_TABLE": {
183+
"atlas-gene-annotation-manipulation": "1.1.1"
184+
},
185+
"GUNZIP_GTF": {
186+
"gunzip": 1.1
187+
},
188+
"VALIDATOR": {
189+
"r-shinyngs": "2.2.4"
190+
},
191+
"VARIANCEPARTITION_DREAM": {
192+
"r-base": "4.3.3",
193+
"bioconductor-edger": "4.0.16",
194+
"variancePartition": "1.32.2"
195+
},
196+
"Workflow": {
197+
"nf-core/differentialabundance": "v1.6.0dev"
198+
}
199+
},
200+
[
201+
"pipeline_info",
202+
"pipeline_info/collated_versions.yml",
203+
"pipeline_info/nf_core_differentialabundance_software_versions.yml",
204+
"tables",
205+
"tables/annotation",
206+
"tables/annotation/SRP254919.anno.tsv",
207+
"tables/differential",
208+
"tables/differential/full_model_with_interactions_SRP254919.dream.results.tsv",
209+
"tables/differential/full_model_with_interactions_SRP254919.dream.results_filtered.tsv",
210+
"tables/differential/interaction_genotype_treatment_SRP254919.dream.results.tsv",
211+
"tables/differential/interaction_genotype_treatment_SRP254919.dream.results_filtered.tsv",
212+
"tables/differential/treatment_plus_genotype_SRP254919.dream.results.tsv",
213+
"tables/differential/treatment_plus_genotype_SRP254919.dream.results_filtered.tsv",
214+
"tables/differential/zero_intercept_model_1_SRP254919.dream.results.tsv",
215+
"tables/differential/zero_intercept_model_1_SRP254919.dream.results_filtered.tsv",
216+
"tables/differential/zero_intercept_model_2_SRP254919.dream.results.tsv",
217+
"tables/differential/zero_intercept_model_2_SRP254919.dream.results_filtered.tsv"
218+
],
219+
[
220+
"SRP254919.anno.tsv:md5,c1d7f21e64bd00f845ec6545c123a1fb"
221+
]
222+
],
223+
"meta": {
224+
"nf-test": "0.9.2",
225+
"nextflow": "25.04.8"
226+
},
227+
"timestamp": "2025-10-07T12:38:36.288584939"
174228
}
175229
}

0 commit comments

Comments
 (0)