Hi,
I am trying to convert sam files to bam file after bowtie aligmnet.
I checked previous posts but still have the same error.
I have miRNA-Seq data.
the codes from the script I used are given below: For alignment:
bowtie -n 2 -l 32 -f --norc --best --strata -m 1 --threads 16 $HUMANMIRBASEINDEX/hsa-index $OUTPUTDIR/$i/$i".min18max30L.fasta" --un $OUTPUTDIR/$i/$i"-maturemiRNA-unalignedReads-bowtie1-beststratam1.fasta" -S $OUTPUTDIR/$i/$i"-maturemiRNA-aligned-bowtie1-beststratam1.sam" 2> $OUTPUTDIR/$i/$i"-bowtie-maturemiRNA-beststratam1.log"
to convert sam file to bam files I tried first:
samtools sort $OUTPUTDIR/$i/$i"-maturemiRNA-aligned-bowtie1-beststratam1.sam" > $OUTPUTDIR/$i/$i"-maturemiRNA-aligned-bowtie1-beststratam1.bam"
secondly I tried index ref file with: samtools faidx ref.fa samtools view -bt ref.fa.fai -o aln.bam aln.sam
And here is the error that I always take:
[E::sam_hrecs_error] Header line does not have a two character key at line 2659: "@A00821:815:HKYLJDRXY:1:2101:8567:1235 4 * 0 0 TCCCTGGTGGTCTAGTGGTTAGGATTCGGCGCTC IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII XM:i:0"
samtools view: failed to add PG line to the header
To convert SAM to BAM you have to specify that samtools should output BAM format using the -b flag. Have you tried:
You can also convert to bam format coming out of bowtie by piping directly using something like:
Get the simplest example to work before building up your complete pipeline.
Hi,
thank you for your answer. Yes I already tried these codes. But my problem is about header of sam file.
Even if I try to write directly bam files, the error is same.
I also tried to add ID while running bowtie as follow:
But still having the same header error at different line