Hi guys,
I am trying to filter reads less than 18nt from my mapped BAM file and then want to get back into SAM format but there is problem while converting back. To do so I did...
samtools view mapped.bam | awk '$6 >= 18' > filt.bam
samtools view -h -o out.sam filt.bam
[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
[main_samview] fail to read the header from "filt.bam".
???
I guess when I filter my reads, it becomes text instead BAM, right?
Help me please.
Note: My original SAM had header information.
read length or alignment lenth ?
As I am already using mapped.bam so its obvious. its aligned reads.
Some aligners using soft-clipping, which let the read length untouched but the alignment length can be shorter (see e.g. here)