This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools convert SAM to BAM error code

Dear Community:

I'm trying to convert my SAM file (created by bwa mem) to BAM file. The SAM file could normally viewed and has correct headers. But when I tried to convert it to BAM file, the result would be error code. Could anybody help me to solve this problem?

My converting command is:

samtools view -bS /sample.sam > sample.bam

Looking forward to get your suggestion.

Thanks in advance

samtools bwa

your bam file is in the root directory ?

/sample.sam

did you mean

./sample.sam 

?

What I don't understand is why you do not include the error code you got. This clearly will help us in helping you. In any case, Pierre gave you a clue about your problem. By using the "/" linux will try to find a local or global directory and not a file. Presumably your error code is that the file is not found. Omit the "/" if you are in the same directory than your file

1 answer

Thank you very much. I forgot the BAM file is the binary coding mode of SAM and if Iopen it directly it would show the error code. Actually when I open it by samtools view sample.bam , it works normally. So it's just not a problem.

Log in to answer this question.