Question: convert bam to fasta
1
gravatar for Maloki
15 months ago by
Maloki10
Maloki10 wrote:

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

sequencing alignment genome • 723 views
ADD COMMENTlink modified 15 months ago by hjafar10 • written 15 months ago by Maloki10

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.

ADD REPLYlink modified 15 months ago • written 15 months ago by genomax87k

See this tutorial: Generating consensus sequence from bam file

ADD REPLYlink written 15 months ago by WouterDeCoster44k

Use the following command line of samtools:

## Converting BAM to fastq/fasta ##
samtools fasta input.bam > output.fasta
samtools fastq input.bam > output.fastq
ADD REPLYlink modified 15 months ago by genomax87k • written 15 months ago by hjafar10

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

ADD REPLYlink written 15 months ago by genomax87k
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: 1493 users visited in the last hour