Convert BAM format file to FASTA format
0
0
Entering edit mode
6.5 years ago

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 • 4.6k views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

but I did not get the fasta format

what did you get ?

ADD REPLY

Login before adding your answer.

Traffic: 2774 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6