Header error while converting sam file to bam
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
• 22 views
Read more here: Source link