Hi everyone, I aligned my RNA sequences against 16s and 23s using BWA. How can I extract my unmapped reads (the ones that really matters) into a fastq or fasta file? I want these sequences to run against bacterial genome and get gene counts.
I already tried using
samtools view -f 4 sample.bam > sample.unmapped.sam,
but it seems that the unmapped.sam is missing something because when I try convert it to bam, samtools show me the following error:
$ samtools view -S -b S_2_unmapped.sam > S_2_unmapped.BAM
[samopen] no @SQ lines in the header.
[sam_read1] missing header? Abort!
So, I am wondering if there is a way to get the unaligned files right from the first bam file ( the one containing aligned and unaligned files) and make my fatsq or fasta file to continue the analysis.
Thanks to those available to help me.
P.S I am a biologist.
search the site for tips of converting bam file to fastq for example converting BAM to fastq