|
| 1 | +nextflow_pipeline { |
| 2 | + |
| 3 | + name "Test pipeline" |
| 4 | + script "../main.nf" |
| 5 | + tag "pipeline" |
| 6 | + tag "test_speclib" |
| 7 | + profile "test_speclib" |
| 8 | + |
| 9 | + test("-profile test_speclib") { |
| 10 | + |
| 11 | + when { |
| 12 | + params { |
| 13 | + outdir = "$outputDir" |
| 14 | + } |
| 15 | + } |
| 16 | + |
| 17 | + then { |
| 18 | + // stable_name: All files + folders in ${params.outdir}/ with a stable name |
| 19 | + def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}']) |
| 20 | + // stable_path: All files in ${params.outdir}/ with stable content |
| 21 | + def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore') |
| 22 | + // Extract peptidoform column from all TSV files |
| 23 | + def peptidoform_data = [] |
| 24 | + new File(params.outdir).eachFileRecurse { file -> |
| 25 | + if (file.name.endsWith('.tsv')) { |
| 26 | + def lines = file.readLines() |
| 27 | + if (lines.size() > 0) { |
| 28 | + def header = lines[0].split('\t') |
| 29 | + def peptidoformIndex = header.findIndexOf { it == 'peptidoform' } |
| 30 | + if (peptidoformIndex >= 0) { |
| 31 | + def peptidoforms = lines.drop(1).collect { line -> |
| 32 | + def fields = line.split('\t') |
| 33 | + fields.size() > peptidoformIndex ? fields[peptidoformIndex] : '' |
| 34 | + }.findAll { it != '' }.sort() |
| 35 | + peptidoform_data.add([file.name, peptidoforms]) |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + assertAll( |
| 41 | + { assert workflow.success}, |
| 42 | + { assert snapshot( |
| 43 | + // Number of successful tasks |
| 44 | + workflow.trace.succeeded().size(), |
| 45 | + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we test pipelines on multiple Nextflow versions |
| 46 | + removeNextflowVersion("$outputDir/pipeline_info/nf_core_mhcquant_software_mqc_versions.yml"), |
| 47 | + // All stable path name, with a relative path |
| 48 | + stable_name, |
| 49 | + // All files with stable contents |
| 50 | + stable_path, |
| 51 | + // Peptidoform data from TSV files |
| 52 | + peptidoform_data |
| 53 | + ).match() } |
| 54 | + ) |
| 55 | + } |
| 56 | + } |
| 57 | +} |
0 commit comments