This is a test version of Biostars. For the public version, visit https://www.biostars.org.
convert bam to fasta

Hi, I'm new in the field of NGS, I have sequenced a bacterial genome by iontorrent sequencer but I didn't put the reference genome for my sequence, So I've got an unaligned bam file Ubam. then I used the Torrent suite software to align my genome, I've got a new bam file which I want to convert it to fasta. My new fasta file put each read in a line with the sign " >" when I'am using : awk '{print ">" S1 "\n" S10}' So, I would like to know How can I put all the reads one beside one with one symbol " >" in the first line only?

thanks

genome alignment sequencing

I would like to know How can I put all the reads one beside one with one symbol " >" in the first line only?

Putting all reads under one > fasta header would not make any sense. So sounds like what you want is a consensus sequence in fasta format? The way to do that is described on the samtools/bcftools page.

Use the following command line of samtools:

## Converting BAM to fastq/fasta ##
samtools fasta input.bam > output.fasta
samtools fastq input.bam > output.fastq

This is most likely not applicable to what OP is asking.

0 answers

No answers yet.

Log in to answer this question.