thanks, I'm run your suggestion now with this command line; ./samtools view -H /media/marziyeh/56F72A78084DABD5/RNA-seqdata/viewed_samtools/sample32_sortedin22.bam but gives anything.
Hi everyone, I wanna prepare my alignment bam file for cufflinks running. I 've used samtools sort for converting sam to bam, next I gonna to run my script for sorting it, but it don't work. Do you have any recommendation or suggestion for correction of that? thanks so much for help me.
my scripts is here:
./samtools view -@ 4 /media/marziyeh/56F72A78084DABD5/RNA-seqdata/output_bowtie2_alignment_ref/sample33.sam > sample33.bam`
`
./samtools sort -n -l 9 -@ 4 -m 3G /media/marziyeh/56F72A78084DABD5/RNA-seqdata/viewed_samtools/sample32_sortedin22.bam >> /media/marziyeh/56F72A78084DABD5/RNA-seqdata/sorted.sample/sample.32
or another script as well as same result;
cd /media/marziyeh/56F72A78084DABD5/RNA-seqdata/viewed_samtools/;/home/marziyeh/Software/samtools-1.6/samtools sort -n -l 9 -@ 4 -m 3G -o /media/marziyeh/56F72A78084DABD5/RNA-seqdata/sorted.sample/sample32_sorted.bam -O bam -n -T /media/marziyeh/56F72A78084DABD5/RNA-seqdata/sorted_file -@ 4 /media/marziyeh/56F72A78084DABD5/RNA-seqdata/viewed_samtools/sample32_sortedin22.bam
Error is here: [E::sam_parse1] missing SAM header [W::sam_read1] Parse error at line 1 samtools sort: truncated file. Aborting
1 answer
Yor error message hints that your generated output BAM is without header section. Please check for header section using command below
samtools view -H yourfile.bam
Above command should print Header only (No alignment section)
To include header section to your output BAM run samtools command:
- samtools -bhS yourfile.sam > yourfile.bam
Here parameter indicates that
- b: your output will be in BAM format
- h: print header for the SAM output
- S: input is SAM
After performing this step, sort yourfile.bam using samtools sort command
Hope this works Best
Log in to answer this question.