This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
forked from icgc-argo-workflows/dna-seq-processing-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbwa-mem-aligner.nf
executable file
·75 lines (64 loc) · 2.45 KB
/
bwa-mem-aligner.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env nextflow
/*
* Copyright (c) 2019, Ontario Institute for Cancer Research (OICR).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* author Junjun Zhang <[email protected]>
*/
nextflow.enable.dsl=2
version = '0.1.12.0'
params.input_bam = "tests/input/?????_?.lane.bam"
params.aligned_lane_prefix = 'grch38-aligned'
params.ref_genome_gz = "tests/reference/tiny-grch38-chr11-530001-537000.fa.gz"
params.container_version = ""
params.cpus = 1
params.mem = 1 // GB
params.publish_dir = ""
params.sequencing_experiment_analysis = "NO_FILE"
params.tempdir = "NO_DIR"
def getBwaSecondaryFiles(main_file){ //this is kind of like CWL's secondary files
def all_files = []
for (ext in ['.fai', '.sa', '.bwt', '.ann', '.amb', '.pac', '.alt']) {
all_files.add(main_file + ext)
}
return all_files
}
process bwaMemAligner {
container "quay.io/icgc-argo/bwa-mem-aligner:bwa-mem-aligner.${params.container_version ?: version}"
publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", enabled: "${params.publish_dir ? true : ''}"
cpus params.cpus
memory "${params.mem} GB"
tag "${input_bam.size()}"
input:
path input_bam
path ref_genome_gz
path ref_genome_gz_secondary_files
path sequencing_experiment_analysis
path tempdir
val dependencies
output:
path "${params.aligned_lane_prefix}.${input_bam.baseName}.bam", emit: aligned_bam
script:
metadata = sequencing_experiment_analysis ? "-m " + sequencing_experiment_analysis : ""
arg_tempdir = tempdir.name != 'NO_DIR' ? "-t ${tempdir}": ""
"""
bwa-mem-aligner.py \
-i ${input_bam} \
-r ${ref_genome_gz} \
-o ${params.aligned_lane_prefix} \
-n ${task.cpus} ${metadata} ${arg_tempdir}
"""
}