understanding pysam pileup()
1
0
Entering edit mode
6.4 years ago

I am trying to understand how the pysam pileup() method works. Here is my example code:

for pileupcolumn in samfile.pileup("ConsensusB", 1, 2):
    for pileupread in pileupcolumn.pileups:
        if not pileupread.is_del and not pileupread.is_refskip:
            print pileupread.query_position,pileupread.alignment.query_name,pileupread.alignment.query_sequence[pileupread.query_position]

In the above example, I would expect it to give me only reads overlapping at base 1 of reference genome. But I see that it still iterates through each and every base of the reference sequence. How do I get all the bases overlapping a particular position ( lets say a SNP from VCF )

 

pysam pileup • 8.9k views
ADD COMMENT
1
Entering edit mode
6.4 years ago

Thanks. I could use https://github.com/alimanfoo/pysamstats for reference.

Great examples here

ADD COMMENT
0
Entering edit mode

Why delete the question?

ADD REPLY
0
Entering edit mode

Indeed, the right etiquette is to answer your own question, accept the answer.

ADD REPLY

Login before adding your answer.

Traffic: 2060 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6