Question: BAM to FASTA
0
gravatar for ivamoresq
2.6 years ago by
ivamoresq0
Spain
ivamoresq0 wrote:

Hi everyone,

I am new working with Samtools and I need to convert a .BAM to a .fasta. I checked all the posts that I could but I do not have what I am looking for.

I used: samtools view filename.bam | awk '{OFS="\t"; print ">"$1"\n"$10}'

I did not get the .fasta format that I use to see. The .fasta generated has some "cuts" and "intervals" with a several number of "Ns". I am looking for a continuous "normal" .fasta and I do not mind whether it has Ns at all.

I also saw this, but did not tried: samtools bam2fq input.bam | seqtk seq -A > output.fa (Could this one help me?)

Thanks very much Community,

Ivan

samtools bam bam to fasta fasta • 4.1k views
ADD COMMENTlink modified 2.6 years ago by WouterDeCoster42k • written 2.6 years ago by ivamoresq0
5
gravatar for genomax
2.6 years ago by
genomax74k
United States
genomax74k wrote:

Current samtools (v.1.x) has fasta option to convert BAM to Fasta.

Usage: samtools fasta [options...] <in.bam>
ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by genomax74k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2041 users visited in the last hour