Commit d727a3d7 authored by lrodrig1's avatar lrodrig1
Browse files

divide reads and indexFiles of bwa-mem modules and subworkflow

parent 05efb875
process BWA_MEM_PAIRED {
tag "bwa mem paired"
tag { "bwa-mem paired" }
container 'quay.io/biocontainers/bwa:0.7.17--h84994c4_5'
input:
val srr_id
path paired1
path paired2
path reference_genome
path index
path indexs
output:
path "*.R1R2.sam"
......@@ -15,6 +14,12 @@ process BWA_MEM_PAIRED {
script:
def threadsArgument = params.threads_bwa_mem ? "-t $params.threads_bwa_mem" : ""
"""
bwa mem $threadsArgument -R "@RG\\tID:${srr_id}\\tSM:NA19206\\tPL:ILLUMINA\\tCN:CBRA\\tLB:Fragment" $reference_genome $paired1 $paired2 >> ${srr_id}.R1R2.sam
INDEX=`find -L ./ -name "*.amb" | sed 's/.amb//'`
bwa mem \\
$threadsArgument \\
\$INDEX \\
$paired1 $paired2 \\
-R "@RG\\tID:${srr_id}\\tSM:NA19206\\tPL:ILLUMINA\\tCN:CBRA\\tLB:Fragment" >> ${srr_id}.R1R2.sam
"""
}
\ No newline at end of file
}
process BWA_MEM_UNPAIRED {
tag "bwa mem unpaired"
tag { "bwa-mem unpaired" }
container 'quay.io/biocontainers/bwa:0.7.17--h84994c4_5'
input:
val srr_id
path unpaired
path reference_genome
path index
path indexs
output:
path "*.sam", emit: output_unpaired
path "*.sam"
script:
def threadsArgument = params.threads_bwa_mem ? "-t $params.threads_bwa_mem" : ""
"""
INDEX=`find -L ./ -name "*.amb" | sed 's/.amb//'`
nameReplaced=\$(echo ${unpaired.simpleName} | sed 's/_/.R/g')
bwa mem $threadsArgument -R "@RG\\tID:$srr_id\\tSM:NA19206\\tPL:ILLUMINA\\tCN:CBRA\\tLB:Fragment" $reference_genome $unpaired >> \$nameReplaced.sam
bwa mem \\
$threadsArgument \\
\$INDEX \\
$unpaired \\
-R "@RG\\tID:${srr_id}\\tSM:NA19206\\tPL:ILLUMINA\\tCN:CBRA\\tLB:Fragment" >> \$nameReplaced.sam
"""
}
\ No newline at end of file
}
/*
* Include for bwa_mem
* Include for bwa_mem
*/
include {
BWA_MEM_PAIRED as BWA_MEM_READS
......@@ -17,23 +17,22 @@ include {
workflow SUB_BWA_MEM {
take:
reads
indexFiles
main:
srr_id = reads.map{it[0]}
paired1 = reads.map{it[1]}
paired2 = reads.map{it[2]}
unpaired1 = reads.map{it[3]}
unpaired2 = reads.map{it[4]}
reference_genome = reads.map{it[5]}
index = reads.map{it[6]}
BWA_MEM_READS(srr_id, paired1, paired2, reference_genome, index)
BWA_MEM_UNPAIRED1(srr_id, unpaired1, reference_genome, index)
BWA_MEM_UNPAIRED2(srr_id, unpaired2, reference_genome, index)
BWA_MEM_READS(srr_id, paired1, paired2, indexFiles)
BWA_MEM_UNPAIRED1(srr_id, unpaired1, indexFiles)
BWA_MEM_UNPAIRED2(srr_id, unpaired2, indexFiles)
emit:
output_paired = BWA_MEM_READS.out
output_unpairedR1 = BWA_MEM_UNPAIRED1.out
output_unpairedR2 = BWA_MEM_UNPAIRED2.out
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment