How to extract genome from iontorent bam file?
2
0
Entering edit mode
4.4 years ago
MSRS ▴ 590

Hi, I hope everything is fine. I have a bam file with the COVID-19 genome from the ion torrent sequencing platform. I want to assemble them and tried with spades, But there is not enough read to form a contig. In that case, I want to assemble them with having gap (NNN). Is there any tools or pipeline?

Thanks In Advance

assembly alignment genome • 1.2k views
ADD COMMENT
3
Entering edit mode
4.4 years ago
5heikki 11k

No need to assemble, just map the reads on to a reference genome and extract the consensus sequence. If everyone did like this the gisaid dataset would be of much higher quality..

ADD COMMENT
0
Entering edit mode

Thank you, can you please share the code, like align with bwa and then?

ADD REPLY
3
Entering edit mode
4.4 years ago
MSRS ▴ 590

This works for me

bwa mem ref.fa output.fq.gz > alignment.sam
samtools view -bS alignment.sam > aln.bam
samtools sort -m 2G aln.bam -o aln.sorted.bam
samtools mpileup -uf ref.fa aln.sorted.bam | bcftools call -c | vcfutils.pl vcf2fq -d 2 > cons.fa

Thank you

ADD COMMENT
1
Entering edit mode

Shaminur : You should accept @5heikki's answer as well since that gave you the original clue for how to do this. You are able to accept more than one answer if they work.

ADD REPLY
1
Entering edit mode

Unless you are using a very old version of samtools, you can sort the .sam file, no need to convert it. You really should pipe the output of bwa meme into samtools sort, making a .sam file is usually wasteful.

ADD REPLY
0
Entering edit mode

Thank you very much for your valuable succession.

ADD REPLY

Login before adding your answer.

Traffic: 1820 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