pysam 0.16.0.1 and pysam 0.9.1 give different results

68 views
Skip to first unread message

Jia Zheng

unread,
Sep 10, 2020, 6:13:11 AM9/10/20
to pysam-us...@googlegroups.com
Hi all,
I used the following code to get the numbers of reads at each position mapped to the reference.
-------------------------------------------------------------------------------------------------
FileName = sys.argv[1]

samfile = pysam.AlignmentFile(FileName, "rb")
numlist=[]
for pileupcolumn in samfile.pileup("ref",start = 55, stop = 61,truncate=True, max_depth=200000,min_mapping_quality=20):
if pileupcolumn.pos>=starP and pileupcolumn.pos<endP:
numMapped=0
for pileupread in pileupcolumn.pileups:
numMapped+=1
numlist.append(numMapped)
print numlist
---------------------------------------------------------------------------------------------
I saved the above code in a file named 'test.py' and then run the script respectively using my laptop (with pysam 0.16.0.1 installed) and office computer (with pysam 0.9.1 installed) as follows:

python test.py input.bam



Then I got different results below. 

the output from pysam 0.16.0.1

 [15481, 15476, 15473, 15473, 15475, 15474]

the output from pysam 0.9.1

 [15486, 15486, 15486, 15486, 15486, 15486]



Anyone knows why? Much appreciated for your help in advance!

Best,
Jia

Hassan Raza

unread,
Mar 12, 2022, 2:43:36 PM3/12/22
to Pysam User group
Use the latest pysam version, yes there were some updates which corrected and improved the outputs.
Reply all
Reply to author
Forward
0 new messages