Entering edit mode
2.6 years ago
kb_93
▴
10
Hi there!
I am trying to convert my SAM file (7.5G) to BAM format using this line of code:
samtools view --threads 4 -buS ${sample}.sam -o ${sample}.bam
My first issue is the memory requirement - it is taking over 180G to start running and secondly when it does run I get the the following error
samtools view: error reading file "*l.sam"\
samtools view: error closing "*.sam": -5
Can anyone suggest what the error means and how to correct it please!
Which version of
samtools
are you using? It is odd that you need 180G of RAM. There is no need to use any flags since samtools should autodetermine the options from file extensions.I am using v1.14 - I tried
conda update samtools
but it is not updating to v1.15.1That version is recent enough. What happens if you simply do
samtools view --threads 4 ${sample}.sam -o ${sample}.bam?
? Any specific reason to choose uncompressed BAM in your original command?I still get the following error when I change it to your suggested code
Is
${SAMPLE}
variable properly expanding to a file that exists? Error indicates that samtools is having a problem reading the file.Yes, I checked the SAM file exist. The line of code does start to generate a bam file, however, it only gets to ~ 200Mb before throwing the error.
Please show the full script so how the variable gets defined. It makes no sense this uses excessive memory, the command essentially needs none so the error is somewhere in the script.
Here's the code
Did you eventually figure it out? I am facing a similar issue. Thanks