The manual was where I got the solution from... Forgot to mention that...
Cheers...
I want to convert SAM file into BAM. I am using command
samtools view -b -S -o bowtie.glob.bam bowtie.glob.sam
but getting error
Parse error at line 25645: invalid CIGAR character
Could someone please help me to solve this problem?
I went through it, the solution is to add the index file. Create the index files with
samtools faidx sequence.fa
This creates the index file *.fai. The final command for conversion is
samtools view -bt sequence.fa.fai -S bowtie.glob.sam -o bowtie.glob.sam
Cheers,
Rohit
I know you have got the solution but here is what is mentioned in the samtools manual:
Import SAM to BAM when @SQ lines are present in the header:
samtools view -bS aln.sam > aln.bam
If @SQ lines are absent:
samtools faidx ref.fa
samtools view -bt ref.fa.fai aln.sam > aln.bam
where ref.fa.fai is generated automatically by the faidx command.
The manual was where I got the solution from... Forgot to mention that...
Cheers...
My header @ is not present, and I'm following your version and the (updated) version on http://samtools.sourceforge.net/samtools.shtml and still get Parse error at line 1: invalid CIGAR character
Log in to answer this question.
Could you please try:
This is because
-balready givesbamoutput and-Sassaminput. This might help.Thanks Rohit, but
samtools view -b -S -o bowtie.glob.bam bowtie.glob.samis the same command that I used.Could you post line 25645 of your SAM file? And the version number of your samtools?
Also, what program generated that SAM file?
I am still getting parser error after trying all the commands mentioned above. My sam file also contain @SQ line. Any suggestions please??