SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find out the base on a certain position shuang Bioinformatics 8 09-09-2011 06:45 AM
*** Per base coverage *** cristae8 Bioinformatics 5 07-21-2011 05:11 PM
Base coverage from Bam ElMichael Bioinformatics 4 12-01-2010 10:18 AM
How to calculate proportion of reads with each base at every reference position lindseyjane Bioinformatics 7 01-19-2010 08:43 AM
Histogram and per-base genome coverage quinlana Bioinformatics 0 10-20-2009 07:28 PM

Reply
 
Thread Tools
Old 11-04-2010, 01:16 AM   #1
boetsie
Senior Member
 
Location: NL, Leiden

Join Date: Feb 2010
Posts: 245
Default base coverage per position on scaffolds

Hi all,

i've mapped my reads with Bowtie to a number of scaffolds, and now i want to know on every position on the scaffolds what the coverage is. Does anyone know how to do this, or is there a script/program available?

As output I want something like;

scaffold pos coverage
scaffold1 1 4
scaffold1 2 6
scaffold1 3 10
...
scaffold2 1 5
scaffold2 2 15
...

Thanks in advance,
Marten
boetsie is offline   Reply With Quote
Old 11-04-2010, 05:15 AM   #2
natstreet
Member
 
Location: Sweden

Join Date: Nov 2009
Posts: 83
Default

If you produced a sam file using bowtie, you can convert this to bam using samtools and then use bedtools to get per position coverage information.
natstreet is offline   Reply With Quote
Old 11-04-2010, 05:40 AM   #3
drio
Senior Member
 
Location: 4117'49"N / 24'42"E

Join Date: Oct 2008
Posts: 323
Default

Use samtools pileup:

Code:
$ samtools pileup -f your_ref.fa your.bam
Column # 4 is what you wanted.
__________________
-drd
drio is offline   Reply With Quote
Old 11-04-2010, 06:32 AM   #4
boetsie
Senior Member
 
Location: NL, Leiden

Join Date: Feb 2010
Posts: 245
Default

Thanks both for your reply. I've used Drio's method since it's the easiest one. It works very good!
boetsie is offline   Reply With Quote
Old 08-21-2012, 11:02 AM   #5
bfantinatti
Member
 
Location: Sao Paulo/Brazil

Join Date: Aug 2012
Posts: 22
Default Different values

Hello there, I had the same problem, and previous posts solved my problems. But there is an little detail:
I have a bam file, and used mpileup to list the per position coverage. Resulted in a file with some columns where the column #4 is the coverage. But opening in Tablet the same bam file using the same reference genome, the coverage number are not the same. Some one knows what is happening?
Thank you a lot
bfantinatti is offline   Reply With Quote
Old 01-23-2014, 05:44 AM   #6
whataBamBam
Member
 
Location: Italy

Join Date: May 2013
Posts: 27
Default

I'm doing this sort of thing at the moment and just as the following snippet of Perl is really useful for working with Bam files..

Code:
#!/usr/bin/perl
open(INFILE,"samtools view $ARGV[0] |");
while(<INFILE>)
{
	#do something with $_;

}
You can also say..

Code:
#!/usr/bin/perl
open(INFILE,"samtools mpileup $ARGV[0] |");
while(<INFILE>)
{
	#do something with $_;

}
And the coverage is in column 4. I'm just adding this post to caution that mpileup doesn't report the positions where coverage is zero (my source of this info being some other posts on seqanswers).. but samtools depth does report the zero's.

Does anyone have a nice way to deal with multiply mapping reads here? The standard way to deal with a read that maps to multiple contigs is to count it towards the coverage at every position where it maps right?
whataBamBam is offline   Reply With Quote
Reply

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 04:35 PM.


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