Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why MAQ consensus seq better than SAMtools consensus ?? av_d Genomic Resequencing 5 10-18-2015 03:44 AM
samtools fasta consensus output crang Bioinformatics 0 04-05-2013 01:26 PM
Samtools consensus sequence error figo1019 Bioinformatics 2 10-09-2012 12:38 AM
Problem calling consensus sequence with Samtools mpileup? Lspoor Bioinformatics 3 10-24-2011 07:43 AM
how to use samtools to get consensus sequence? f0415007 Bioinformatics 1 09-26-2011 10:59 PM

Thread Tools
Old 05-30-2014, 12:02 PM   #1
Location: OP Kansas

Join Date: Mar 2014
Posts: 53
Default Samtools 0.1.19, Unbuntu 14.04, problem getting a consensus

Hello all,

I'm having trouble using samtools to get a consensus of a small viral genome and I'm fairly certian its user error. I am very new to all of this however I have not found my issue in the forum so here goes. If someone has posted this answer before and I didn't do a good enough job searching I would be very appreicative if you could link the response to this post.

I'm using mpileup to extract a consensus with the command listed in the documentation

samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcf2fq > cns.fq

(with my files in the places of ref.fa and aln.bam)

and I get " command not found" error.

I did some digging and found a post saying add perl to the command line before vcfutils

samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | perl vcf2fq > cns.fq

and now I get "Can't open perl script "": No such file or directory" error.

I did some more digging and found a post from vcftools that says to use cpan, which I did and it ran fine, no errors and then re-ran the code with "perl" in and out of the line and I still get the same errors.

Can anyone think of a package that I missed or has someone defeated this problem and can help me with some insight?
skbrimer is offline   Reply With Quote
Old 05-30-2014, 12:31 PM   #2
Senior Member
Location: Montreal

Join Date: May 2013
Posts: 367

It's simple.
The folder in which is located is not in your path.
Just add the folder to your path, or, even simpler, just specify the full path to the file.
It's in the bcftools folder in the samtools folder, incidentally
E.g. samtools-0.1.19/bcftools/

Here is a simple demonstration on my computer.
You'll need to change the path to the samtools folder on your computer.
You can just type the following command to find the location of the samtools folder.
which samtools


[blancha@lg-1r17-n01 ~]$
-bash: command not found
[blancha@lg-1r17-n01 ~]$ /sb/software/areas/ircm/tools/samtools-0.1.19/bcftools/

Usage: <command> [<arguments>]

Command: subsam get a subset of samples
listsam list the samples
fillac fill the allele count field
qstats SNP stats stratified by QUAL

hapmap2vcf convert the hapmap format to VCF
ucscsnp2vcf convert UCSC SNP SQL dump to VCF

varFilter filtering short variants (*)
vcf2fq VCF->fastq (**)

Notes: Commands with description endting with (*) may need bcftools
specific annotations.
blancha is offline   Reply With Quote
Old 05-30-2014, 12:52 PM   #3
Location: OP Kansas

Join Date: Mar 2014
Posts: 53

Thank you blancha!

That completely solved my problem!

Thank you for the lesson.
skbrimer is offline   Reply With Quote

bam file, bioinformatic tools, samtools 0.1.19,

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 03:52 AM.

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