bam to fasta
I am a phd student working in Sweden, currently trying to apply NGS data to phylogenetics.
I would like to know if there is a way to convert a sorted BAM file into a fasta sequence using only the mapped reads, i.e., without incorporating any of the reference into the fasta sequence?
I have sorted bam files that result from mapping reads of one species to a reference of a different species. Right now I am extracting the reads from the bam files and re-assembling them, but the result is sub-optimal because I often get multiple contigs, probably due to low coverage portions in the bam file, and this causes many alignment problems. I would like to get a single contig, perhaps with gaps inserted where there are no reads to match the reference, which would be much easier to align to other samples.
Filipe de Sousa