Question: Convert BAM format file to FASTA format
0
gravatar for rodbari.zahra
23 months ago by
Netherlands
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 • 1.6k views
ADD COMMENTlink modified 23 months ago by Pierre Lindenbaum122k • written 23 months ago by rodbari.zahra0
1

You could use reformat.sh from BBMap suite: reformat.sh in=your.bam out=seq.fa or reformat.sh 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 repair.sh to fix the order of reads in output files.

ADD REPLYlink written 23 months ago by genomax71k

but I did not get the fasta format

what did you get ?

ADD REPLYlink written 23 months ago by Pierre Lindenbaum122k
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: 1984 users visited in the last hour