|
| 1 | +nextflow_process { |
| 2 | + |
| 3 | + name "Test Process GCTA_MAKEGRM" |
| 4 | + script "../main.nf" |
| 5 | + process "GCTA_MAKEGRM" |
| 6 | + |
| 7 | + tag "modules" |
| 8 | + tag "modules_nfcore" |
| 9 | + tag "gcta" |
| 10 | + tag "gcta/makegrm" |
| 11 | + |
| 12 | + test("homo_sapiens popgen - plink2") { |
| 13 | + when { |
| 14 | + process { |
| 15 | + """ |
| 16 | + file('gcta_grm.mpfile').text = 'plink_simulated plink_simulated.pgen plink_simulated.psam plink_simulated.pvar\\n' |
| 17 | + |
| 18 | + input[0] = [ |
| 19 | + [ id:'gcta_grm' ], |
| 20 | + file('gcta_grm.mpfile'), |
| 21 | + [ |
| 22 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true) |
| 23 | + ], |
| 24 | + [ |
| 25 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true) |
| 26 | + ], |
| 27 | + [ |
| 28 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true) |
| 29 | + ] |
| 30 | + ] |
| 31 | + """ |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + then { |
| 36 | + assertAll( |
| 37 | + { assert process.success }, |
| 38 | + { assert process.out.grm_files.size() == 1 }, |
| 39 | + { assert process.out.grm_files.get(0).get(0).id == 'gcta_grm' }, |
| 40 | + { assert process.out.grm_files.get(0).get(0).keySet() == ['id'] as Set }, |
| 41 | + { assert process.out.grm_files.get(0).get(1).size() == 3 }, |
| 42 | + { |
| 43 | + assert process.out.grm_files.get(0).get(1).collect { file(it).name }.toSet() == [ |
| 44 | + 'gcta_grm.grm.id', |
| 45 | + 'gcta_grm.grm.bin', |
| 46 | + 'gcta_grm.grm.N.bin' |
| 47 | + ] as Set |
| 48 | + }, |
| 49 | + { assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--make-grm') }, |
| 50 | + { assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--mpfile') }, |
| 51 | + { |
| 52 | + assert snapshot( |
| 53 | + process.out.grm_files, |
| 54 | + process.out.findAll { key, val -> key.startsWith('versions') } |
| 55 | + ).match() |
| 56 | + } |
| 57 | + ) |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + test("homo_sapiens popgen - plink1") { |
| 62 | + when { |
| 63 | + process { |
| 64 | + """ |
| 65 | + file('gcta_grm.mbfile').text = 'plink_simulated\\n' |
| 66 | + |
| 67 | + input[0] = [ |
| 68 | + [ id:'gcta_grm_bed' ], |
| 69 | + file('gcta_grm.mbfile'), |
| 70 | + [ |
| 71 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true) |
| 72 | + ], |
| 73 | + [ |
| 74 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true) |
| 75 | + ], |
| 76 | + [ |
| 77 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true) |
| 78 | + ] |
| 79 | + ] |
| 80 | + """ |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + then { |
| 85 | + assertAll( |
| 86 | + { assert process.success }, |
| 87 | + { assert process.out.grm_files.size() == 1 }, |
| 88 | + { assert process.out.grm_files.get(0).get(0).id == 'gcta_grm_bed' }, |
| 89 | + { assert process.out.grm_files.get(0).get(0).keySet() == ['id'] as Set }, |
| 90 | + { assert process.out.grm_files.get(0).get(1).size() == 3 }, |
| 91 | + { |
| 92 | + assert process.out.grm_files.get(0).get(1).collect { file(it).name }.toSet() == [ |
| 93 | + 'gcta_grm_bed.grm.id', |
| 94 | + 'gcta_grm_bed.grm.bin', |
| 95 | + 'gcta_grm_bed.grm.N.bin' |
| 96 | + ] as Set |
| 97 | + }, |
| 98 | + { assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--make-grm') }, |
| 99 | + { assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--mbfile') }, |
| 100 | + { |
| 101 | + assert snapshot( |
| 102 | + process.out.grm_files, |
| 103 | + process.out.findAll { key, val -> key.startsWith('versions') } |
| 104 | + ).match() |
| 105 | + } |
| 106 | + ) |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + test("homo_sapiens popgen - plink1 - stub") { |
| 111 | + options "-stub" |
| 112 | + |
| 113 | + when { |
| 114 | + process { |
| 115 | + """ |
| 116 | + file('gcta_grm.mbfile').text = 'plink_simulated\\n' |
| 117 | + |
| 118 | + input[0] = [ |
| 119 | + [ id:'gcta_grm_bed' ], |
| 120 | + file('gcta_grm.mbfile'), |
| 121 | + [ |
| 122 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true) |
| 123 | + ], |
| 124 | + [ |
| 125 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true) |
| 126 | + ], |
| 127 | + [ |
| 128 | + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true) |
| 129 | + ] |
| 130 | + ] |
| 131 | + """ |
| 132 | + } |
| 133 | + } |
| 134 | + |
| 135 | + then { |
| 136 | + assertAll( |
| 137 | + { assert process.success }, |
| 138 | + { assert snapshot(process.out).match() } |
| 139 | + ) |
| 140 | + } |
| 141 | + } |
| 142 | +} |
0 commit comments