SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pileup loosing consensus sequence? MatthewVC Bioinformatics 1 05-25-2011 02:08 PM
Samtools pileup Consensus with 0.1.12a version srividya Bioinformatics 1 05-23-2011 07:16 AM
Why are there all these As in my consensus sequence: An issue with samtools pileup dagarfield Bioinformatics 3 02-03-2011 10:14 AM
Getting pileup consensus from BAM files using Bio::DB::Sam ragowthaman Bioinformatics 2 08-03-2010 08:21 AM
gaps in consensus built from samtools pileup culmen Bioinformatics 2 07-21-2010 09:02 PM

Reply
 
Thread Tools
Old 02-27-2012, 07:50 AM   #1
kentk
Member
 
Location: Philippines

Join Date: Dec 2011
Posts: 17
Default If pileup is deprecated, so how do I get consensus?

I wanted to get the consensus sequence from a bam file and came across this
http://sourceforge.net/apps/mediawik...?title=SAM_FAQ

When I typed it, it cant run anymore because pileup has apparently been removed. It recommends using mpileup but theres no -c switch for consensus. Any way to do this using mpileup or should I just get an older version of samtools?
kentk is offline   Reply With Quote
Old 02-27-2012, 08:57 AM   #2
jfk
Junior Member
 
Location: Manchester, UK

Join Date: Jul 2011
Posts: 5
Default

Quote:
Originally Posted by kentk View Post
I wanted to get the consensus sequence from a bam file and came across this
http://sourceforge.net/apps/mediawik...?title=SAM_FAQ

When I typed it, it cant run anymore because pileup has apparently been removed. It recommends using mpileup but theres no -c switch for consensus. Any way to do this using mpileup or should I just get an older version of samtools?
I ran into this problem too as the local cluster installation of samtools is v 0.1.18. The work I am repeating/checking requires pileup and the ability to generate a consensus sequence.

Locally I have a desktop running BioLinux and installed v 0.1.17 of samtools on that. So I can do my mapping/alignment on the cluster and then generated a consensus sequence locally.

Feel free to PM me.

In the end I just installed a local
jfk is offline   Reply With Quote
Old 02-27-2012, 09:39 AM   #3
chadn737
Senior Member
 
Location: US

Join Date: Jan 2009
Posts: 392
Default

Did you read the Samtools page about calling SNPs and IN/DELs with mpileup?

Code:
Since r865, it is possible to generate the consensus sequence with

    samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
http://samtools.sourceforge.net/mpileup.shtml
chadn737 is offline   Reply With Quote
Old 02-27-2012, 02:26 PM   #4
jfk
Junior Member
 
Location: Manchester, UK

Join Date: Jul 2011
Posts: 5
Default

I would be interested in generating a consensus sequence - can mpileup do this as I'm not sure from the documentation that this is possible?

mpileup is fine for variant calling and SNP detection - the option for the -c flag in pileup being preserved in the further releases of samtools would have been useful.
jfk is offline   Reply With Quote
Old 02-27-2012, 08:26 PM   #5
lh3
Senior Member
 
Location: Boston

Join Date: Feb 2008
Posts: 693
Default

Hasn't chadn737 already told you the answer?
lh3 is offline   Reply With Quote
Old 02-28-2012, 07:14 AM   #6
jflowers
Member
 
Location: New York, NY

Join Date: Oct 2011
Posts: 41
Default

I think chadn737 may be asking if it is possible to use the mpileup | bcftools view | vcfutils.pl to get the consensus for MULTIPLE genomes. So far, in my reading, I only see examples of consensus sequences being generated when there is one input bam.

Is it possible to get the consensus for multiple input bams?
jflowers is offline   Reply With Quote
Old 02-28-2012, 07:20 AM   #7
chadn737
Senior Member
 
Location: US

Join Date: Jan 2009
Posts: 392
Default

Quote:
Originally Posted by jflowers View Post
I think chadn737 may be asking if it is possible to use the mpileup | bcftools view | vcfutils.pl to get the consensus for MULTIPLE genomes. So far, in my reading, I only see examples of consensus sequences being generated when there is one input bam.

Is it possible to get the consensus for multiple input bams?
I'm not asking anything other than whether or not the original posters bothered to read the instructions. I am pointing out to those asking the question that it says in the samtools mpileup instructions how to go about getting a consensus sequence. Pileup only worked on one bam file, mpileup allows multiple. The pipeline that is described I would think would work for multiple bam inputs given that mpileup is designed to do exactly that.

Last edited by chadn737; 02-28-2012 at 07:26 AM.
chadn737 is offline   Reply With Quote
Old 02-28-2012, 07:25 AM   #8
jflowers
Member
 
Location: New York, NY

Join Date: Oct 2011
Posts: 41
Default

Just wanted to rephrase my previous question. If say multiple different samples (e.g., humans) were sequenced and we want a separate consensus for each human, how would we generate multiple consensus sequences (one for each genome) using mpileup | bcftools view | vcfutils.pl?
jflowers is offline   Reply With Quote
Old 02-28-2012, 07:28 AM   #9
chadn737
Senior Member
 
Location: US

Join Date: Jan 2009
Posts: 392
Default

Quote:
Originally Posted by jflowers View Post
Just wanted to rephrase my previous question. If say multiple different samples (e.g., humans) were sequenced and we want a separate consensus for each human, how would we generate multiple consensus sequences (one for each genome) using mpileup | bcftools view | vcfutils.pl?
mpileup works equally well on one input bam as it does on multiple input bams. Thats how I typically use it, on a single bam.

So just run the pipeline for each genome/bam individually and you should get exactly what you want.
chadn737 is offline   Reply With Quote
Old 02-28-2012, 12:08 PM   #10
jflowers
Member
 
Location: New York, NY

Join Date: Oct 2011
Posts: 41
Default

Yes, mpileup works just fine on individual genomes. However, for my application, I would like to use the mpileup to call snps for many genomes simultaneously and then obtain a consensus sequence for EACH genome.

For example, I would like to run something like mpileup [options] sample1.bam sample2.bam ... sampleN.bam | bcftools view | vcfutils.pl and obtain N consensus sequences (where N is the number of input BAMs representing different sequenced individuals)

I have tried and the desired output doesnt seem to be implemented in this workflow.

I would appreciate any suggestions.
jflowers is offline   Reply With Quote
Old 02-28-2012, 02:27 PM   #11
swbarnes2
Senior Member
 
Location: San Diego

Join Date: May 2008
Posts: 912
Default

Quote:
Originally Posted by jflowers View Post
Yes, mpileup works just fine on individual genomes. However, for my application, I would like to use the mpileup to call snps for many genomes simultaneously and then obtain a consensus sequence for EACH genome.

For example, I would like to run something like mpileup [options] sample1.bam sample2.bam ... sampleN.bam | bcftools view | vcfutils.pl and obtain N consensus sequences (where N is the number of input BAMs representing different sequenced individuals)

I have tried and the desired output doesnt seem to be implemented in this workflow.

I would appreciate any suggestions.
So you run mpileup with all the samples (though I'm not sure that doing that helps much), generate a vcf with a column for every sample. Why can't you just make individual vcfs from that to put through vcfutils?
swbarnes2 is offline   Reply With Quote
Old 02-29-2012, 05:32 AM   #12
kentk
Member
 
Location: Philippines

Join Date: Dec 2011
Posts: 17
Default

Sorry chad didnt see that mpileup documentation, I read the wiki page FAQs instead which seems dated. Anyway I tried it and it worked. Thanks!
kentk is offline   Reply With Quote
Old 03-11-2012, 10:55 AM   #13
jflowers
Member
 
Location: New York, NY

Join Date: Oct 2011
Posts: 41
Default

swbarnes2,
Thanks for the suggestion, that just might work
jflowers is offline   Reply With Quote
Old 03-12-2012, 07:11 AM   #14
jflowers
Member
 
Location: New York, NY

Join Date: Oct 2011
Posts: 41
Default

Hi swbarnes2,

Just wanted to follow up on the issue of generating multiple consensus sequences from mpileup run with multiple BAMs in the event that someone happend upon this thread with the same question.

I looked more carefully into your suggestion of splitting the output VCF into many VCFs (one for each genotype) and running it through vcfutils.pl

Quote:
Originally Posted by swbarnes2 View Post
So you run mpileup with all the samples (though I'm not sure that doing that helps much), generate a vcf with a column for every sample. Why can't you just make individual vcfs from that to put through vcfutils?
A good idea, but it won't work. Looking at the vcfutils.pl vcf2fq routine, this script doesn't use any information from VCF column 10 (the column with genotypes, phred likelihoods, genotype qualities; e.g., 0/1:17,0,81:20).

All vcf2fq does is use information from the FQ and AF1 tags to call genotypes and these are set by bcftools for the set of genotypes.

Looks like creating multiple consensus sequences from multiple bams would require a currently unavailable utility.
jflowers is offline   Reply With Quote
Reply

Tags
bam, consensus, samtools

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 09:33 AM.


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