|
| 1 | +nextflow_process { |
| 2 | + |
| 3 | + name "Test Process TRTOOLS_MERGESTR" |
| 4 | + script "../main.nf" |
| 5 | + config "./nextflow.config" |
| 6 | + process "TRTOOLS_MERGESTR" |
| 7 | + |
| 8 | + tag "modules" |
| 9 | + tag "modules_nfcore" |
| 10 | + tag "gangstr" |
| 11 | + tag "trtools" |
| 12 | + tag "trtools/mergestr" |
| 13 | + |
| 14 | + setup { |
| 15 | + run("GANGSTR", alias: "GANGSTR1") { |
| 16 | + script "modules/nf-core/gangstr/main.nf" |
| 17 | + |
| 18 | + process { |
| 19 | + """ |
| 20 | + bed1 = Channel.of('chr22\t3000\t3020\t5\tCGCGC') |
| 21 | + .collectFile(name: 'genome1.bed', newLine: true) |
| 22 | + |
| 23 | + input[0] = Channel.of([ |
| 24 | + [id:'test1'], |
| 25 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists:true), |
| 26 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists:true) |
| 27 | + ]).combine(bed1) |
| 28 | + |
| 29 | + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists:true) |
| 30 | + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists:true) |
| 31 | + """ |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + run("GANGSTR", alias: "GANGSTR2") { |
| 36 | + script "modules/nf-core/gangstr/main.nf" |
| 37 | + |
| 38 | + process { |
| 39 | + """ |
| 40 | + bed2 = Channel.of('chr22\t3000\t3020\t5\tCGCGC') |
| 41 | + .collectFile(name: 'genome2.bed', newLine: true) |
| 42 | + |
| 43 | + input[0] = Channel.of([ |
| 44 | + [id:'test2'], |
| 45 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists:true), |
| 46 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists:true) |
| 47 | + ]).combine(bed2) |
| 48 | + |
| 49 | + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists:true) |
| 50 | + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists:true) |
| 51 | + """ |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + test("homo_sapiens - gangstr vcfs") { |
| 57 | + |
| 58 | + when { |
| 59 | + process { |
| 60 | + """ |
| 61 | + input[0] = GANGSTR1.out.vcf |
| 62 | + .combine(GANGSTR2.out.vcf) |
| 63 | + .combine(GANGSTR1.out.index) |
| 64 | + .combine(GANGSTR2.out.index) |
| 65 | + .map { meta1, vcf1, meta2, vcf2, meta3, tbi1, meta4, tbi2 -> |
| 66 | + [ |
| 67 | + [ id: 'test' ], |
| 68 | + [ vcf1, vcf2 ], |
| 69 | + [ tbi1, tbi2 ] |
| 70 | + ] |
| 71 | + } |
| 72 | + """ |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + then { |
| 77 | + assertAll( |
| 78 | + { assert process.success }, |
| 79 | + { assert snapshot( |
| 80 | + path(process.out.vcf.get(0).get(1)).vcf.summary, |
| 81 | + file(process.out.tbi[0][1]).name, |
| 82 | + process.out.findAll { key, val -> key.startsWith('versions') } |
| 83 | + ).match() } |
| 84 | + ) |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + test("homo_sapiens - gangstr vcfs - stub") { |
| 89 | + |
| 90 | + options "-stub" |
| 91 | + |
| 92 | + when { |
| 93 | + process { |
| 94 | + """ |
| 95 | + input[0] = GANGSTR1.out.vcf |
| 96 | + .combine(GANGSTR2.out.vcf) |
| 97 | + .combine(GANGSTR1.out.index) |
| 98 | + .combine(GANGSTR2.out.index) |
| 99 | + .map { meta1, vcf1, meta2, vcf2, meta3, tbi1, meta4, tbi2 -> |
| 100 | + [ |
| 101 | + [ id: 'test' ], |
| 102 | + [ vcf1, vcf2 ], |
| 103 | + [ tbi1, tbi2 ] |
| 104 | + ] |
| 105 | + } |
| 106 | + """ |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + then { |
| 111 | + assertAll( |
| 112 | + { assert process.success }, |
| 113 | + { assert snapshot(sanitizeOutput(process.out)).match() } |
| 114 | + ) |
| 115 | + } |
| 116 | + } |
| 117 | +} |
0 commit comments