Skip to content

Commit 0bd747d

Browse files
authored
Merge branch 'dev' into nf-test-humanpopgen
2 parents 9350da0 + c7dc65b commit 0bd747d

2 files changed

Lines changed: 348 additions & 0 deletions

File tree

tests/test_minimal.nf.test

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline: NFCORE_EAGER"
4+
script "main.nf"
5+
tag "pipeline"
6+
tag "nfcore_eager"
7+
tag "test_minimal"
8+
9+
test("test_minimal_profile") {
10+
11+
when {
12+
params {
13+
outdir = "$outputDir"
14+
}
15+
}
16+
17+
then {
18+
19+
///////////////////
20+
// DOCUMENTATION //
21+
///////////////////
22+
23+
// The contents of each top level results directory should be tested with individually named snapshots.
24+
// Within each snapshot, there should be two to three distinct variables, that contain the files to be tested.
25+
// - stable_name_<dir> is for files with variable md5sums (i.e. content) so only names will be compared
26+
// - stable_content_<dir> is for files with stable md5sums (i.e. content) so md5sums will be compared
27+
// - bams_<dir> is for BAM files, where the headerMD5 is checked for stability (since the content can be unstable)
28+
// If a directory is fully stable, you can drop `stable_name_*`
29+
// If a directory contains no BAMs, you can drop `bams_*`
30+
31+
// Generate with: nf-test test --tag test_minimal --profile docker,test_minimal --update-snapshot
32+
// Test with: nf-test test --tag test_minimal --profile docker,test_minimal
33+
// NOTE: BAMs are always only stable in name, because:
34+
// a) sharding breaks header since the shard that was first is named in the header (Fixed in https://github.com/nf-core/eager/pull/1112)
35+
// b) the order of the reads in the BAMs is not stable (sorted, but reads that share a start position can be in any order)
36+
// point b) also causes BAIs to be unstable.
37+
// c) Merging of multiple BAMs with duplicate @RG / @PG tags can cause the header to be unstable (particularly in the case of shards/lanes)
38+
39+
//////////////////////
40+
// DEFINE VARIABLES //
41+
//////////////////////
42+
43+
// Define exclusion patterns for files with unstable contents
44+
// NOTE: When a section needs more than a couple of small patterns, consider adding a variable to store the patterns here
45+
// This is particularly important if the patterns excluded in the stable content section should be included in the stable name section
46+
47+
48+
// Check that no files are missing/added
49+
// Command legend: Result directory to index , includeDir: include dirs?, ignore: exclude patterns , ignoreFile: exclude pattern list , include: include patterns
50+
def stable_name_all = getAllFilesFromDir("$outputDir/" , includeDir: false , ignore: ['pipeline_info/*'] , ignoreFile: null , include: ['*', '**/*'] )
51+
52+
// Authentication
53+
def stable_content_authentication = getAllFilesFromDir("$outputDir/authentication" , includeDir: false , ignore: null , ignoreFile: null , include: ['*', '**/*'] )
54+
// def stable_name_authentication = getAllFilesFromDir("$outputDir/authentication" , includeDir: false , ignore: null , ignoreFile: null , include: unstable_patterns_auth)
55+
56+
// Final_bams
57+
def stable_content_final_bams = getAllFilesFromDir("$outputDir/final_bams" , includeDir: false , ignore: null , ignoreFile: null , include: ['**/*.flagstat'] )
58+
def stable_name_final_bams = getAllFilesFromDir("$outputDir/final_bams" , includeDir: false , ignore: null , ignoreFile: null , include: ['**/*.{bam,bai}'] )
59+
60+
// Mapping (incl. bam_input flasgstat)
61+
def stable_content_mapping = getAllFilesFromDir("$outputDir/mapping" , includeDir: false , ignore: null , ignoreFile: null , include: ['**/*.flagstat'] )
62+
def stable_name_mapping = getAllFilesFromDir("$outputDir/mapping" , includeDir: false , ignore: null , ignoreFile: null , include: ['**/*.{bam,bai}'] )
63+
64+
// Preprocessing
65+
def stable_content_preprocessing = getAllFilesFromDir("$outputDir/preprocessing" , includeDir: false , ignore: ['**/*.{zip,html}'] , ignoreFile: null , include: ['**/*'] )
66+
def stable_name_preprocessing = getAllFilesFromDir("$outputDir/preprocessing" , includeDir: false , ignore: null , ignoreFile: null , include: ['**/*.{zip,html}'] )
67+
68+
// MultiQC
69+
def stable_name_multiqc = getAllFilesFromDir("$outputDir/multiqc" , includeDir: false , ignore: null , ignoreFile: null , include: ['*', '**/*'] )
70+
71+
///////////////////////
72+
// DEFINE ASSERTIONS //
73+
///////////////////////
74+
75+
assertAll(
76+
{ assert workflow.success },
77+
// This checks that there are no missing or additional output files.
78+
// Also a good starting point to look at all the files in the output folder than need to be checked in subsequent sections.
79+
{ assert snapshot( stable_name_all*.name ).match("all_files") },
80+
81+
// Checking changes to contents of each section
82+
// NOTE: Keep the order of the sections in the alphanumeric order of the output directories.
83+
// Each section should first check stable_content, stable_name second (if applicable).
84+
{ assert snapshot( stable_content_authentication ).match("authentication") },
85+
{ assert snapshot( stable_content_final_bams , stable_name_final_bams*.name ).match("final_bams") },
86+
// NOTE: The snapshot section for mapping cannot be named 'mapping'. See https://github.com/askimed/nf-test/issues/279
87+
{ assert snapshot( stable_content_mapping , stable_name_mapping*.name ).match("mapping_output") },
88+
{ assert snapshot( stable_content_preprocessing , stable_name_preprocessing*.name ).match("preprocessing") },
89+
90+
// MultiQC
91+
{ assert snapshot( stable_name_multiqc*.name ).match("multiqc") },
92+
93+
// Versions
94+
{ assert new File("$outputDir/pipeline_info/nf_core_eager_software_mqc_versions.yml").exists() },
95+
96+
)
97+
}
98+
}
99+
}

tests/test_minimal.nf.test.snap

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
{
2+
"all_files": {
3+
"content": [
4+
[
5+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_percent_on_target_mqc.json",
6+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_percent_on_target_mqc.json",
7+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_percent_on_target_mqc.json",
8+
"JK2782_Mammoth_MT_Krause.bam",
9+
"JK2782_Mammoth_MT_Krause.bam.bai",
10+
"JK2802_Mammoth_MT_Krause.bam",
11+
"JK2802_Mammoth_MT_Krause.bam.bai",
12+
"JK2782_Mammoth_MT_Krause.flagstat",
13+
"JK2802_Mammoth_MT_Krause.flagstat",
14+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.flagstat",
15+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.bam",
16+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.bam.bai",
17+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.bam",
18+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.bam.bai",
19+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.bam",
20+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.bam.bai",
21+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.flagstat",
22+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.flagstat",
23+
"fastqc-status-check-heatmap.txt",
24+
"fastqc_adapter_content_plot.txt",
25+
"fastqc_per_base_n_content_plot.txt",
26+
"fastqc_per_base_sequence_quality_plot.txt",
27+
"fastqc_per_sequence_gc_content_plot_Counts.txt",
28+
"fastqc_per_sequence_gc_content_plot_Percentages.txt",
29+
"fastqc_per_sequence_quality_scores_plot.txt",
30+
"fastqc_sequence_counts_plot.txt",
31+
"fastqc_sequence_duplication_levels_plot.txt",
32+
"fastqc_top_overrepresented_sequences_table.txt",
33+
"multiqc.log",
34+
"multiqc_citations.txt",
35+
"multiqc_data.json",
36+
"multiqc_fastqc.txt",
37+
"multiqc_general_stats.txt",
38+
"multiqc_samtools_flagstat.txt",
39+
"multiqc_software_versions.txt",
40+
"multiqc_sources.txt",
41+
"samtools-flagstat-dp_Percentage_of_total.txt",
42+
"samtools-flagstat-dp_Read_counts.txt",
43+
"fastqc-status-check-heatmap.pdf",
44+
"fastqc_adapter_content_plot.pdf",
45+
"fastqc_per_base_n_content_plot.pdf",
46+
"fastqc_per_base_sequence_quality_plot.pdf",
47+
"fastqc_per_sequence_gc_content_plot_Counts.pdf",
48+
"fastqc_per_sequence_gc_content_plot_Percentages.pdf",
49+
"fastqc_per_sequence_quality_scores_plot.pdf",
50+
"fastqc_sequence_counts_plot-cnt.pdf",
51+
"fastqc_sequence_counts_plot-pct.pdf",
52+
"fastqc_sequence_duplication_levels_plot.pdf",
53+
"fastqc_top_overrepresented_sequences_table.pdf",
54+
"general_stats_table.pdf",
55+
"samtools-flagstat-dp_Percentage_of_total.pdf",
56+
"samtools-flagstat-dp_Read_counts.pdf",
57+
"fastqc-status-check-heatmap.png",
58+
"fastqc_adapter_content_plot.png",
59+
"fastqc_per_base_n_content_plot.png",
60+
"fastqc_per_base_sequence_quality_plot.png",
61+
"fastqc_per_sequence_gc_content_plot_Counts.png",
62+
"fastqc_per_sequence_gc_content_plot_Percentages.png",
63+
"fastqc_per_sequence_quality_scores_plot.png",
64+
"fastqc_sequence_counts_plot-cnt.png",
65+
"fastqc_sequence_counts_plot-pct.png",
66+
"fastqc_sequence_duplication_levels_plot.png",
67+
"fastqc_top_overrepresented_sequences_table.png",
68+
"general_stats_table.png",
69+
"samtools-flagstat-dp_Percentage_of_total.png",
70+
"samtools-flagstat-dp_Read_counts.png",
71+
"fastqc-status-check-heatmap.svg",
72+
"fastqc_adapter_content_plot.svg",
73+
"fastqc_per_base_n_content_plot.svg",
74+
"fastqc_per_base_sequence_quality_plot.svg",
75+
"fastqc_per_sequence_gc_content_plot_Counts.svg",
76+
"fastqc_per_sequence_gc_content_plot_Percentages.svg",
77+
"fastqc_per_sequence_quality_scores_plot.svg",
78+
"fastqc_sequence_counts_plot-cnt.svg",
79+
"fastqc_sequence_counts_plot-pct.svg",
80+
"fastqc_sequence_duplication_levels_plot.svg",
81+
"fastqc_top_overrepresented_sequences_table.svg",
82+
"general_stats_table.svg",
83+
"samtools-flagstat-dp_Percentage_of_total.svg",
84+
"samtools-flagstat-dp_Read_counts.svg",
85+
"multiqc_report.html",
86+
"JK2782_JK2782_TGGCCGATCAACGA_L1_1_fastqc.html",
87+
"JK2782_JK2782_TGGCCGATCAACGA_L1_1_fastqc.zip",
88+
"JK2782_JK2782_TGGCCGATCAACGA_L1_2_fastqc.html",
89+
"JK2782_JK2782_TGGCCGATCAACGA_L1_2_fastqc.zip",
90+
"JK2802_JK2802_AGAATAACCTACCA_L2_fastqc.html",
91+
"JK2802_JK2802_AGAATAACCTACCA_L2_fastqc.zip"
92+
]
93+
],
94+
"meta": {
95+
"nf-test": "0.9.2",
96+
"nextflow": "24.10.6"
97+
},
98+
"timestamp": "2025-05-23T10:36:48.672625"
99+
},
100+
"preprocessing": {
101+
"content": [
102+
[
103+
104+
],
105+
[
106+
"JK2782_JK2782_TGGCCGATCAACGA_L1_1_fastqc.html",
107+
"JK2782_JK2782_TGGCCGATCAACGA_L1_1_fastqc.zip",
108+
"JK2782_JK2782_TGGCCGATCAACGA_L1_2_fastqc.html",
109+
"JK2782_JK2782_TGGCCGATCAACGA_L1_2_fastqc.zip",
110+
"JK2802_JK2802_AGAATAACCTACCA_L2_fastqc.html",
111+
"JK2802_JK2802_AGAATAACCTACCA_L2_fastqc.zip"
112+
]
113+
],
114+
"meta": {
115+
"nf-test": "0.9.2",
116+
"nextflow": "24.10.6"
117+
},
118+
"timestamp": "2025-05-23T10:36:48.803481"
119+
},
120+
"final_bams": {
121+
"content": [
122+
[
123+
"JK2782_Mammoth_MT_Krause.flagstat:md5,9ebb4b5e99894d2a87ac3b60a78e7142",
124+
"JK2802_Mammoth_MT_Krause.flagstat:md5,51816d63f34b4818ed6f1ec968f05fc0"
125+
],
126+
[
127+
"JK2782_Mammoth_MT_Krause.bam",
128+
"JK2782_Mammoth_MT_Krause.bam.bai",
129+
"JK2802_Mammoth_MT_Krause.bam",
130+
"JK2802_Mammoth_MT_Krause.bam.bai"
131+
]
132+
],
133+
"meta": {
134+
"nf-test": "0.9.2",
135+
"nextflow": "24.10.6"
136+
},
137+
"timestamp": "2025-05-23T10:36:48.749353"
138+
},
139+
"multiqc": {
140+
"content": [
141+
[
142+
"fastqc-status-check-heatmap.txt",
143+
"fastqc_adapter_content_plot.txt",
144+
"fastqc_per_base_n_content_plot.txt",
145+
"fastqc_per_base_sequence_quality_plot.txt",
146+
"fastqc_per_sequence_gc_content_plot_Counts.txt",
147+
"fastqc_per_sequence_gc_content_plot_Percentages.txt",
148+
"fastqc_per_sequence_quality_scores_plot.txt",
149+
"fastqc_sequence_counts_plot.txt",
150+
"fastqc_sequence_duplication_levels_plot.txt",
151+
"fastqc_top_overrepresented_sequences_table.txt",
152+
"multiqc.log",
153+
"multiqc_citations.txt",
154+
"multiqc_data.json",
155+
"multiqc_fastqc.txt",
156+
"multiqc_general_stats.txt",
157+
"multiqc_samtools_flagstat.txt",
158+
"multiqc_software_versions.txt",
159+
"multiqc_sources.txt",
160+
"samtools-flagstat-dp_Percentage_of_total.txt",
161+
"samtools-flagstat-dp_Read_counts.txt",
162+
"fastqc-status-check-heatmap.pdf",
163+
"fastqc_adapter_content_plot.pdf",
164+
"fastqc_per_base_n_content_plot.pdf",
165+
"fastqc_per_base_sequence_quality_plot.pdf",
166+
"fastqc_per_sequence_gc_content_plot_Counts.pdf",
167+
"fastqc_per_sequence_gc_content_plot_Percentages.pdf",
168+
"fastqc_per_sequence_quality_scores_plot.pdf",
169+
"fastqc_sequence_counts_plot-cnt.pdf",
170+
"fastqc_sequence_counts_plot-pct.pdf",
171+
"fastqc_sequence_duplication_levels_plot.pdf",
172+
"fastqc_top_overrepresented_sequences_table.pdf",
173+
"general_stats_table.pdf",
174+
"samtools-flagstat-dp_Percentage_of_total.pdf",
175+
"samtools-flagstat-dp_Read_counts.pdf",
176+
"fastqc-status-check-heatmap.png",
177+
"fastqc_adapter_content_plot.png",
178+
"fastqc_per_base_n_content_plot.png",
179+
"fastqc_per_base_sequence_quality_plot.png",
180+
"fastqc_per_sequence_gc_content_plot_Counts.png",
181+
"fastqc_per_sequence_gc_content_plot_Percentages.png",
182+
"fastqc_per_sequence_quality_scores_plot.png",
183+
"fastqc_sequence_counts_plot-cnt.png",
184+
"fastqc_sequence_counts_plot-pct.png",
185+
"fastqc_sequence_duplication_levels_plot.png",
186+
"fastqc_top_overrepresented_sequences_table.png",
187+
"general_stats_table.png",
188+
"samtools-flagstat-dp_Percentage_of_total.png",
189+
"samtools-flagstat-dp_Read_counts.png",
190+
"fastqc-status-check-heatmap.svg",
191+
"fastqc_adapter_content_plot.svg",
192+
"fastqc_per_base_n_content_plot.svg",
193+
"fastqc_per_base_sequence_quality_plot.svg",
194+
"fastqc_per_sequence_gc_content_plot_Counts.svg",
195+
"fastqc_per_sequence_gc_content_plot_Percentages.svg",
196+
"fastqc_per_sequence_quality_scores_plot.svg",
197+
"fastqc_sequence_counts_plot-cnt.svg",
198+
"fastqc_sequence_counts_plot-pct.svg",
199+
"fastqc_sequence_duplication_levels_plot.svg",
200+
"fastqc_top_overrepresented_sequences_table.svg",
201+
"general_stats_table.svg",
202+
"samtools-flagstat-dp_Percentage_of_total.svg",
203+
"samtools-flagstat-dp_Read_counts.svg",
204+
"multiqc_report.html"
205+
]
206+
],
207+
"meta": {
208+
"nf-test": "0.9.2",
209+
"nextflow": "24.10.6"
210+
},
211+
"timestamp": "2025-05-23T10:36:48.824552"
212+
},
213+
"mapping_output": {
214+
"content": [
215+
[
216+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.flagstat:md5,9a10991f5670a52975a622a8b056e2bc",
217+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.flagstat:md5,274942e6f459e1f85bffd0719ea24038",
218+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.flagstat:md5,51816d63f34b4818ed6f1ec968f05fc0"
219+
],
220+
[
221+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.bam",
222+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_sorted.bam.bai",
223+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.bam",
224+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_sorted.bam.bai",
225+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.bam",
226+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_sorted.bam.bai"
227+
]
228+
],
229+
"meta": {
230+
"nf-test": "0.9.2",
231+
"nextflow": "24.10.6"
232+
},
233+
"timestamp": "2025-05-23T10:36:48.771636"
234+
},
235+
"authentication": {
236+
"content": [
237+
[
238+
"JK2782_JK2782_TGGCCGATCAACGA_BAM_Mammoth_MT_Krause_percent_on_target_mqc.json:md5,13303511f19f618a524e30b3377497fb",
239+
"JK2782_JK2782_TGGCCGATCAACGA_Mammoth_MT_Krause_percent_on_target_mqc.json:md5,90a8f1d5c1017f0000ac960b03767eba",
240+
"JK2802_JK2802_AGAATAACCTACCA_Mammoth_MT_Krause_percent_on_target_mqc.json:md5,d26aac162887528fb3a3b2fa9b86954f"
241+
]
242+
],
243+
"meta": {
244+
"nf-test": "0.9.2",
245+
"nextflow": "24.10.6"
246+
},
247+
"timestamp": "2025-05-23T10:36:48.717265"
248+
}
249+
}

0 commit comments

Comments
 (0)