I have mapped a pacbio read against a reference [with minimap2] and now I have my output in Bam file. I would like to extract only the mapped reads from it. I tried bamToFastq [samtools bamtofq input.bam | seqtk seq -A > output.fa], since finally would like to have my file in fasta, but it did not work. Anyone here has a solution?
Asked
Active
Viewed 2,454 times
1 Answers
0
It's a simple task with samtools. And from mapped.bam you can call fasta.
samtools view -b -F 4 file.bam > mapped.bam

Emil Nyerki
- 57
- 7
-
I have already tried this but it is not working for me. It gives a weird output that is almost empty. – azam soltani Apr 15 '21 at 07:50