Skip to content

Commit 1ae4f8a

Browse files
authored
Merge branch 'dev' into nf-test-conversion-shortDNA
2 parents a9b44a6 + c7dc65b commit 1ae4f8a

4 files changed

Lines changed: 355 additions & 6 deletions

File tree

tests/test.nf.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ nextflow_pipeline {
5050
'**/*.{svg,pdf,html,png}',
5151
'**/DamageProfiler.log',
5252
'**/3p_freq_misincorporations.txt',
53+
'**/5p_freq_misincorporations.txt',
5354
'**/DNA_comp_genome.txt',
5455
'**/DNA_composition_sample.txt',
5556
'**/misincorporation.txt',
@@ -119,12 +120,12 @@ nextflow_pipeline {
119120
{ assert snapshot( stable_content_preprocessing , stable_name_preprocessing*.name ).match("preprocessing") },
120121
{ assert snapshot( stable_content_readfiltering , stable_name_readfiltering*.name ).match("read_filtering") },
121122
{ assert snapshot( stable_content_genotyping , stable_name_genotyping*.name ).match("genotyping") },
122-
// Additional checks on the genotyping VCFs for content. Specifically the md5sums of the header FORMAT and INFO lines
123+
// Additional checks on the genotyping VCFs for content. Specifically the md5sums of the header FORMAT, INFO, FILTER, CONTIG lines, and sample names
123124
{ assert snapshot(
124125
genotyping_vcfs.collect {
125126
file ->
126127
def vcf_head = path(file.toString()).vcf.header
127-
// The header contains lines in the "OTHER" category, which contain a timestamp, so we need to filter those out, then calculate md5sums.
128+
// The header contains lines in the "OTHER" category, which contain a timestamp and/or work dir paths, so we need to filter those out, then calculate md5sums.
128129
def header_md5 = [
129130
vcf_head.getFormatHeaderLines().toString(),
130131
vcf_head.getInfoHeaderLines().toString(),

tests/test.nf.test.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,19 +790,16 @@
790790
[
791791
"3pGtoA_freq.txt:md5,c32ef382b55fed96816df63993c520eb",
792792
"5pCtoT_freq.txt:md5,d6e1401fb49387f83d842977ee47a9d2",
793-
"5p_freq_misincorporations.txt:md5,af2192b8a97699519d060baa3c8982fe",
794793
"dmgprof.json:md5,e829fb37f3e12842a6139e1d4cfe19dc",
795794
"editDistance.txt:md5,7c00cd7cc4bd87c2da4debaa2704a66a",
796795
"lgdistribution.txt:md5,3c176293ea8e58d1d56a95e693727f7a",
797796
"3pGtoA_freq.txt:md5,5c13335a8ac710b9a341bab159a3c008",
798797
"5pCtoT_freq.txt:md5,165558aede4c3bac313f3769d7667ebe",
799-
"5p_freq_misincorporations.txt:md5,9d74375b3138b438902f41f339637e60",
800798
"dmgprof.json:md5,de8757639ecf419e1c25fef681cb4d1f",
801799
"editDistance.txt:md5,5feeaa4b7018320fd9937e271299375c",
802800
"lgdistribution.txt:md5,908cd6085583826db5123a90e0d7f182",
803801
"3pGtoA_freq.txt:md5,a5cc527c6a0f910d35268d6389df6a64",
804802
"5pCtoT_freq.txt:md5,da1227bd826f10c19e67b88db9b98aed",
805-
"5p_freq_misincorporations.txt:md5,dda1a7c047b766b231edc3f8518e7be3",
806803
"dmgprof.json:md5,2cf0661d688236fd68d42d75bbf69581",
807804
"editDistance.txt:md5,059c352bf858c5ddb27e88253654e353",
808805
"lgdistribution.txt:md5,9ae3ec3d0cbbbb230481167fb12ebc61",
@@ -853,6 +850,7 @@
853850
],
854851
[
855852
"3p_freq_misincorporations.txt",
853+
"5p_freq_misincorporations.txt",
856854
"DNA_comp_genome.txt",
857855
"DNA_composition_sample.txt",
858856
"DamagePlot.pdf",
@@ -866,6 +864,7 @@
866864
"edit_distance.svg",
867865
"misincorporation.txt",
868866
"3p_freq_misincorporations.txt",
867+
"5p_freq_misincorporations.txt",
869868
"DNA_comp_genome.txt",
870869
"DNA_composition_sample.txt",
871870
"DamagePlot.pdf",
@@ -879,6 +878,7 @@
879878
"edit_distance.svg",
880879
"misincorporation.txt",
881880
"3p_freq_misincorporations.txt",
881+
"5p_freq_misincorporations.txt",
882882
"DNA_comp_genome.txt",
883883
"DNA_composition_sample.txt",
884884
"DamagePlot.pdf",
@@ -952,6 +952,6 @@
952952
"nf-test": "0.9.2",
953953
"nextflow": "24.10.6"
954954
},
955-
"timestamp": "2025-05-08T17:35:53.630853"
955+
"timestamp": "2025-05-09T10:47:16.368282"
956956
}
957957
}

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+
}

0 commit comments

Comments
 (0)