-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMapping.nf
More file actions
23 lines (19 loc) · 864 Bytes
/
Mapping.nf
File metadata and controls
23 lines (19 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
process BWAMapping {
tag {"BWA Mem ${sample_id} - ${rg_id}"}
label 'BWA_0_7_17'
label 'BWA_0_7_17_Mem'
container = 'library://library.sylabs.io/sawibo/default/bioinf-tools:bwa-0.7.17_samtools-1.9'
shell = ['/bin/bash', '-euo', 'pipefail']
input:
tuple(val(sample_id), val(rg_id), path(fastq))
output:
tuple(val(sample_id), val(rg_id), path("${rg_id}_sorted.bam"), path("${rg_id}_sorted.bai"), emit: mapped_bams)
script:
def barcode = rg_id.split('_')[1]
def bwa_readgroup = "\"@RG\\tID:${rg_id}\\tSM:${sample_id}\\tPL:ILLUMINA\\tLB:${sample_id}\\tPU:${barcode}\""
"""
bwa mem $params.optional -t ${task.cpus} -R $bwa_readgroup $params.genome_fasta $fastq | \
samtools sort > ${rg_id}_sorted.bam
samtools index ${rg_id}_sorted.bam ${rg_id}_sorted.bai
"""
}