Skip to content
Snippets Groups Projects
Commit 527d9358 authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Move mem param to sort

parent 0bfa5ba9
Branches
Tags
2 merge requests!65Develop,!64Resolve "samtools sort: couldn't allocate memory for bam_mem"
Pipeline #9045 passed with stages
in 3 minutes and 48 seconds
......@@ -757,13 +757,13 @@ process alignSampleData {
# convert the output sam file to a sorted bam file using Samtools
echo -e "LOG: converting from sam to bam" >> ${repRID}.${ref}.alignSampleData.log
samtools view -1 -@ `nproc` -m \${mem}K -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam
samtools view -1 -@ `nproc` -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam
# sort the bam file using Samtools
echo -e "LOG: sorting the bam file" >> ${repRID}.${ref}.alignSampleData.log
mem=\$(vmstat -s -S K | grep 'total memory' | grep -o '[0-9]*')
mem=\$(expr \${mem} / `nproc` \\* 85 / 100)
samtools sort -@ `nproc` -O BAM -o ${ref}.sampled.sorted.bam ${ref}.sampled.bam
samtools sort -@ `nproc` -m \${mem}K -O BAM -o ${ref}.sampled.sorted.bam ${ref}.sampled.bam
# index the sorted bam using Samtools
echo -e "LOG: indexing sorted bam file" >> ${repRID}.${ref}.alignSampleData.log
......
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