|
| 1 | +nextflow_process { |
| 2 | + |
| 3 | + name "Test Process GRIDSS_PREPROCESS" |
| 4 | + script "../main.nf" |
| 5 | + config "./nextflow.config" |
| 6 | + process "GRIDSS_PREPROCESS" |
| 7 | + |
| 8 | + tag "modules" |
| 9 | + tag "modules_nfcore" |
| 10 | + tag "gridss" |
| 11 | + tag "gridss/preprocess" |
| 12 | + tag "bwa/index" |
| 13 | + |
| 14 | + setup { |
| 15 | + |
| 16 | + run("BWA_INDEX") { |
| 17 | + script "../../../bwa/index/main.nf" |
| 18 | + process { |
| 19 | + """ |
| 20 | + input[0] = [ [id:'fasta'], |
| 21 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) |
| 22 | + ] |
| 23 | + """ |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | + |
| 28 | + test("human - bam - bwa") { |
| 29 | + |
| 30 | + when { |
| 31 | + process { |
| 32 | + """ |
| 33 | + input[0] = [ |
| 34 | + [ id:'test' ], |
| 35 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), |
| 36 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) |
| 37 | + ] |
| 38 | + input[1] = [ [id:'fasta'], |
| 39 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) |
| 40 | + ] |
| 41 | + input[2] = [ [id:'fasta_fai'], |
| 42 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) |
| 43 | + ] |
| 44 | + input[3] = BWA_INDEX.out.index |
| 45 | + """ |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + then { |
| 50 | + def workdir = process.out.preprocess_dir[0][1] |
| 51 | + def prefix = "test.paired_end.sorted.bam" |
| 52 | + // Picard `# Started on:` and R's PDF `/CreationDate` add per-run timestamps, |
| 53 | + // and `sv.bam` BGZF blocks are non-reproducible — snapshot only stable parts. |
| 54 | + def stripPicardHeaderMd5 = { f -> "${file(f).name}:md5,${listToMD5(path(f).readLines().findAll { !it.startsWith("#") })}" } |
| 55 | + |
| 56 | + assertAll( |
| 57 | + { assert process.success }, |
| 58 | + { assert snapshot( |
| 59 | + process.out.preprocess_dir.collect { meta, dir -> [meta, file(dir).list().findAll { it.startsWith(prefix) }.sort()] }, |
| 60 | + path("${workdir}/${prefix}.computesamtags.changes.tsv"), |
| 61 | + path("${workdir}/${prefix}.coverage.blacklist.bed"), |
| 62 | + path("${workdir}/${prefix}.sv.bam.csi"), |
| 63 | + stripPicardHeaderMd5("${workdir}/${prefix}.cigar_metrics"), |
| 64 | + stripPicardHeaderMd5("${workdir}/${prefix}.idsv_metrics"), |
| 65 | + stripPicardHeaderMd5("${workdir}/${prefix}.insert_size_metrics"), |
| 66 | + stripPicardHeaderMd5("${workdir}/${prefix}.mapq_metrics"), |
| 67 | + stripPicardHeaderMd5("${workdir}/${prefix}.tag_metrics"), |
| 68 | + process.out.findAll { key, val -> key.startsWith("versions") } |
| 69 | + ).match() } |
| 70 | + ) |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + test("human - bam - stub") { |
| 75 | + |
| 76 | + options "-stub" |
| 77 | + |
| 78 | + when { |
| 79 | + process { |
| 80 | + """ |
| 81 | + input[0] = [ |
| 82 | + [ id:'test' ], |
| 83 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), |
| 84 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) |
| 85 | + ] |
| 86 | + input[1] = [ [id:'fasta'], |
| 87 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) |
| 88 | + ] |
| 89 | + input[2] = [ [id:'fasta_fai'], |
| 90 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) |
| 91 | + ] |
| 92 | + input[3] = [ [], [] ] |
| 93 | + """ |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + then { |
| 98 | + assertAll( |
| 99 | + { assert process.success }, |
| 100 | + { assert snapshot( |
| 101 | + process.out.preprocess_dir, |
| 102 | + process.out.findAll { key, val -> key.startsWith("versions") } |
| 103 | + ).match() } |
| 104 | + ) |
| 105 | + } |
| 106 | + } |
| 107 | +} |
0 commit comments