|
| 1 | +#!/usr/bin/env nextflow |
| 2 | + |
| 3 | +/* |
| 4 | + Copyright (c) 2019-2021, Ontario Institute for Cancer Research (OICR). |
| 5 | +
|
| 6 | + This program is free software: you can redistribute it and/or modify |
| 7 | + it under the terms of the GNU Affero General Public License as published by |
| 8 | + the Free Software Foundation, either version 3 of the License, or |
| 9 | + (at your option) any later version. |
| 10 | +
|
| 11 | + This program is distributed in the hope that it will be useful, |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + GNU Affero General Public License for more details. |
| 15 | +
|
| 16 | + You should have received a copy of the GNU Affero General Public License |
| 17 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +
|
| 19 | + Authors: |
| 20 | + Junjun Zhang |
| 21 | +*/ |
| 22 | + |
| 23 | +nextflow.enable.dsl = 2 |
| 24 | + |
| 25 | +// universal params |
| 26 | +params.container_registry = "" |
| 27 | +params.container_version = "" |
| 28 | +params.container = "" |
| 29 | + |
| 30 | +bwaSecondaryExts = ['fai', 'sa', 'bwt', 'ann', 'amb', 'pac', 'alt'] |
| 31 | + |
| 32 | +params.file_name = null |
| 33 | +params.file_size = null |
| 34 | + |
| 35 | +include { |
| 36 | + getSecondaryFiles; |
| 37 | + getBwaSecondaryFiles |
| 38 | +} from '../main.nf' |
| 39 | + |
| 40 | +include { |
| 41 | + generateDummyFile as gFile1; |
| 42 | + generateDummyFile as gFile2; |
| 43 | +} from './generate-dummy-file.nf' |
| 44 | + |
| 45 | +include { |
| 46 | + filesExist as fExist1; |
| 47 | + filesExist as fExist2; |
| 48 | +} from './files-exist.nf' |
| 49 | + |
| 50 | +Channel.from(params.file_name).set{ file_name_ch } |
| 51 | +Channel.from(bwaSecondaryExts).set{ bwa_ext_ch } |
| 52 | + |
| 53 | + |
| 54 | +workflow { |
| 55 | + // generate the main file |
| 56 | + gFile1( |
| 57 | + file_name_ch.flatten(), |
| 58 | + params.file_size |
| 59 | + ) |
| 60 | + |
| 61 | + // generate the BWA secondary files |
| 62 | + gFile2( |
| 63 | + file_name_ch.combine(bwa_ext_ch), |
| 64 | + params.file_size |
| 65 | + ) |
| 66 | + |
| 67 | + // test 'getSecondaryFiles' for expected 'fai' file exists |
| 68 | + fExist1( |
| 69 | + getSecondaryFiles(params.file_name, ['fai']), |
| 70 | + 'exist', |
| 71 | + gFile2.out.file.collect(), |
| 72 | + true // no need to wait |
| 73 | + ) |
| 74 | + |
| 75 | + // test 'getBwaSecondaryFiles' for all expected bwa secondary files exist |
| 76 | + fExist2( |
| 77 | + getBwaSecondaryFiles(params.file_name).collect(), |
| 78 | + 'exist', |
| 79 | + gFile2.out.file.collect(), |
| 80 | + true // no need to wait |
| 81 | + ) |
| 82 | + |
| 83 | +} |
0 commit comments