Skip to content
Snippets Groups Projects
Verified Commit c6dce992 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

bwa: update to match CONTRIBUTING.md

parent b867bf9a
Branches
No related tags found
No related merge requests found
version = "0.7.17" version = "0.7.17"
container_url = "lbmc/bwa:${version}" container_url = "lbmc/bwa:${version}"
params.index_fasta = ""
params.mapping_fastq = ""
params.index_fasta = ""
params.index_fasta_out = ""
process index_fasta { process index_fasta {
container = "${container_url}" container = "${container_url}"
label "big_mem_mono_cpus" label "big_mem_mono_cpus"
tag "$file_id" tag "$file_id"
if (params.index_fasta_out != "") {
publishDir "results/${params.index_fasta_out}", mode: 'copy'
}
input: input:
tuple val(file_id), path(fasta) tuple val(file_id), path(fasta)
...@@ -24,10 +27,15 @@ bwa index ${params.index_fastq} -p ${fasta.simpleName} ${fasta} \ ...@@ -24,10 +27,15 @@ bwa index ${params.index_fastq} -p ${fasta.simpleName} ${fasta} \
} }
params.mapping_fastq = ""
params.mapping_fastq_out = ""
process mapping_fastq { process mapping_fastq {
container = "${container_url}" container = "${container_url}"
label "big_mem_multi_cpus" label "big_mem_multi_cpus"
tag "$file_id" tag "$file_id"
if (params.mapping_fastq_out != "") {
publishDir "results/${params.mapping_fastq_out}", mode: 'copy'
}
input: input:
tuple val(file_id), path(reads) tuple val(file_id), path(reads)
...@@ -38,32 +46,36 @@ process mapping_fastq { ...@@ -38,32 +46,36 @@ process mapping_fastq {
tuple val(file_id), path("${id}_bwa_report.txt"), emit: report tuple val(file_id), path("${id}_bwa_report.txt"), emit: report
script: script:
if (file_id.containsKey('library')) { if (file_id instanceof List){
library = file_id.library file_prefix = file_id[0]
id = file_id.id if (file_id.containsKey('library')) {
} else { library = file_id.library
library = file_id file_prefix = file_id.id
id = file_id } else {
} library = file_id
file_prefix = file_id
}
} else {
file_prefix = file_id
}
bwa_mem_R = "@RG\\tID:${library}\\tSM:${library}\\tLB:lib_${library}\\tPL:illumina" bwa_mem_R = "@RG\\tID:${library}\\tSM:${library}\\tLB:lib_${library}\\tPL:illumina"
if (reads instanceof List) if (reads.size() == 2)
""" """
bwa mem -t ${task.cpus} \ bwa mem -t ${task.cpus} \
${params.mapping_fastq} \ ${params.mapping_fastq} \
-R '${bwa_mem_R}' \ -R '${bwa_mem_R}' \
${index_id} ${reads[0]} ${reads[1]} 2> \ ${index_id} ${reads[0]} ${reads[1]} 2> \
${id}_bwa_report.txt | \ ${file_prefix}_bwa_report.txt | \
samtools view -@ ${task.cpus} -Sb - > ${id}.bam samtools view -@ ${task.cpus} -Sb - > ${file_prefix}.bam
""" """
else else if (reads.size() == 1)
""" """
bwa mem -t ${task.cpus} \ bwa mem -t ${task.cpus} \
${params.mapping_fastq} \ ${params.mapping_fastq} \
-R '${bwa_mem_R}' \ -R '${bwa_mem_R}' \
${index_id} ${reads} 2> \ ${index_id} ${reads} 2> \
${id}_bwa_report.txt | \ ${file_prefix}_bwa_report.txt | \
samtools view -@ ${task.cpus} -Sb - > ${id}.bam samtools view -@ ${task.cpus} -Sb - > ${file_prefix}.bam
""" """
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment