Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting reads (not coverage...) smol Bioinformatics 4 08-24-2016 05:11 AM
counting junction reads muzz56 Bioinformatics 2 02-12-2012 05:36 AM
Counting of regions within a segment DrD2009 Bioinformatics 0 01-08-2012 10:53 AM
Isotigs counting nicedad General 0 10-31-2011 04:44 AM
Determining the number of bases and percent coverage in an aligned sequence kz26 Bioinformatics 0 06-28-2010 08:22 PM

Thread Tools
Old 02-17-2012, 10:46 AM   #1
Junior Member
Location: New Jersey

Join Date: Sep 2011
Posts: 1
Default Counting coverage bases


I am using pysam to count bases from bam file and verifying with igv tool. The counts are mostly consistent except that at some positions, pysam seem to call some bases significantly more.

For example: I get: A/T/G/C 154/1/0/2229 with pysam for position 27
while get: A/T/G/C 6/1/0/2227 in igv for the same position. Other positions are very comparable. Any idea?

Any other suggestion on programs that allow to count coverage bases in bam file will be appreciated.

Thank you.


my code for counting bases with pysam (i am just suspecting if it is doing something funny at some positions):

for pileupcolumn in samfile.pileup( 'Homo',1,17000): # for mitochondria
count_a, count_g, count_c, count_t = 0,0,0,0
#print 'coverage at base %s = %s' % (pileupcolumn.pos , pileupcolumn.n)

for pileupread in pileupcolumn.pileups:

if pileupread.alignment.seq[pileupread.qpos] == 'A':
count_a += 1
elif pileupread.alignment.seq[pileupread.qpos] == 'G':
count_g += 1
elif pileupread.alignment.seq[pileupread.qpos] == 'C':
count_c += 1
elif pileupread.alignment.seq[pileupread.qpos] == 'T':
count_t += 1
print 'pass'

writeoutput.writerow( [pileupcolumn.pos +1,count_a,count_t,count_g,count_c])
batsal 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 08:39 PM.

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