Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
Consensus FASTA from BAM files mixter Bioinformatics 14 05-19-2014 10:07 AM
Python counting bases fasta file illinu Bioinformatics 9 08-22-2013 09:17 AM
building a consensus FASTA from BAM(s) adaptivegenome Bioinformatics 3 06-18-2013 08:10 PM
converting consensus fastq to fasta zlu Bioinformatics 18 08-17-2011 10:11 AM
Consensus part from sequence read(fastq) and align(BAM) files culmen Bioinformatics 5 12-21-2010 04:57 AM

Thread Tools
Old 05-16-2014, 08:56 AM   #1
Junior Member
Location: MA

Join Date: May 2014
Posts: 1
Default Bam file to Consensus Fasta/fastq in python


I want to get the same result as I get from this command, but in python (BioPython/Pysam):
samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcf2fq > cns.fq
Full story:
I need to extract the consensus fasta from an aligned bam file, currently I'm doing it with samtools, but I'll be more than happy if I can implement it in python without 3rd party tools. That's important because this step is an intermediate step, so I need this fasta sequence to play with it.

Thanks everyone for your help.


daniel_navarro is offline   Reply With Quote
Old 05-17-2014, 11:59 AM   #2
Location: East Cost

Join Date: May 2011
Posts: 79

Can't you call these tools within your Python script? As long as machine you are running have the tools installed, it should be fine.

Sorry, when read you message a second time, I realized that you said you do not want to use third party tools.

Last edited by rnaeye; 05-17-2014 at 12:01 PM. Reason: made mistake
rnaeye is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 12:57 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO