Skip to content

Commit

Permalink
Addresses #3 ; Known issue with bwa | smatools pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
cgpu committed Dec 4, 2019
1 parent 5d54bd8 commit 3ad4a0c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,16 @@ process MapReads {
convertToFastq = hasExtension(inputFile1, "bam") ? "gatk --java-options -Xmx${task.memory.toGiga()}g SamToFastq --INPUT=${inputFile1} --FASTQ=/dev/stdout --INTERLEAVE=true --NON_PF=true | \\" : ""
input = hasExtension(inputFile1, "bam") ? "-p /dev/stdin - 2> >(tee ${inputFile1}.bwa.stderr.log >&2)" : "${inputFile1} ${inputFile2}"
"""
${convertToFastq}
bwa mem -K 100000000 -R \"${readGroup}\" ${extra} -t ${task.cpus} -M ${fasta} \
${input} | samtools sort - > ${idSample}_${idRun}.bam
# map to sam
${convertToFastq}
bwa mem -K 100000000 -R \"${readGroup}\" ${extra} -t ${task.cpus} -M ${fasta} \
${input} > ${idSample}_${idRun}.sam
# create bam
samtools view -@ ${task.cpus} -b -h -O BAM -o ${idSample}_${idRun}.bwamem.bam ${idSample}_${idRun}.sam
# sort bam
samtools sort -@ ${task.cpus} -o ${idSample}_${idRun}.bam
"""
}

Expand Down

0 comments on commit 3ad4a0c

Please sign in to comment.