Question: Convert BAM format file to FASTA format
gravatar for rodbari.zahra
3.3 years ago by
rodbari.zahra0 wrote:

Hi I have a BAM file(s) which are reads aligned to reference genome.I'd like to know how can convert a BAM file to the full sequence in fasta format, using the reads in the BAM file.I searched Biostars for BAM/SAM to FASTA conversion method, and found the two command could do this (Convert Bam File To Fasta File). 1- samtools view filename.bam | awk '{OFS="\t"; print ">"$1"\n"$10}' - > filename.fasta 2-samtools bam2fq input.bam | seqtk seq -A > output.fa but I did not get the fasta format. because i have this error(Too many arguments, bam2fq: unrecognized option --'A' Is there a solution that would help?

I am impatiens for your answer.

next-gen software error • 3.0k views
ADD COMMENTlink modified 3.3 years ago by Pierre Lindenbaum134k • written 3.3 years ago by rodbari.zahra0

You could use from BBMap suite: in=your.bam out=seq.fa or in=your.bam out1=seq_R1.fa out2=seq_R2.fa. Consider a caveat though. If your bam file does not contain both reads then you may need to use to fix the order of reads in output files.

ADD REPLYlink written 3.3 years ago by GenoMax96k

but I did not get the fasta format

what did you get ?

ADD REPLYlink written 3.3 years ago by Pierre Lindenbaum134k
Please log in to add an answer.


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