This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to generate consensus fasta uninterleaved from bam?

Hello, I first extracted the fasta format consensus from various bam files. I used two different commands for the same purpose and both resulted in an interspersed fasta, from what I understand the overlapping reads are interspersed. However, I was wondering if there is a way to get the non-interleaved fast.

comando BBmap e samtools para extrair o fasta:

 for i in *.bam; do reformat.sh in=$i out=${i}.fa; done



 for i in *.bam; do sample_name=`echo $i | awk -F "." '{print $1}'`; samtools fasta -@ 16 $i > ${sample_name}.fa; done

both generated interleaved format fasta:

>E00382:156:HMFJCCCXX:1:1102:7659:38315/2
TTCCCCTTAAATAAGACATCACGATGGATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCTATGTCGCAGT
>E00382:156:HMFJCCCXX:1:1105:22019:53803/1
ATGGATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCTATGTCGCAGTATCTGTCTTTGATTCCTGCCCCA
>E00382:156:HMFJCCCXX:1:1105:26545:21210/1
CTACTTCAGGGCCATAAAGCCTAAATAGCCCACACGTTCCCCTTAAATAAGACATCACGATGGATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGGTATGCACGCGATAGCATT
>E00382:156:HMFJCCCXX:1:1106:19116:22757/1
CATCACGATGGATCACAGGTCTATCACCCTATTAACCACTCACG

can anyone help me generate non-interleaved fastas from multiple files?

sequence genome

Hello elienesantossilva09 ,

you seems to be puzzled by what information all the different filetypes contain. I guess your question here is related to the one in you other thread? Have you take a look at the tutorial I've linked to over there? Is this what you are looking for?

fin swimmer

1 answer

Hello, I first extracted the fasta format consensus from various bam files.

I don't think you did. You just converted the bam file to fasta format.

I think there are filtering options in samtools fasta to get it to return only one read or the other at a time.

Log in to answer this question.