Question: reads in pysam
gravatar for yzhuan0621
5.8 years ago by
yzhuan06210 wrote:

Hey, I am a newbie in pysam, and now I have a question.

I use pysam to find the reads which overlap a given position, and then I want to get the nucleotides at this position in each read. Followed my code:

position is an given location(0 based)

reads = [read for read in samfile.fetch(chr_name, position,position+1)]
    for read in reads:
         neu1 = read.seq[read.get_reference_positions().index(position)]
         neu2 = read.seq[position-read.reference_start]
         neu3 = read.query[position-read.reference_start-read.qstart]

I want to know which is right, neu1, nue2, nue3, or others?  thk!


snp pysam alignment genome • 1.9k views
ADD COMMENTlink modified 5.8 years ago by PoGibas4.9k • written 5.8 years ago by yzhuan06210
gravatar for Devon Ryan
5.8 years ago by
Devon Ryan98k
Freiburg, Germany
Devon Ryan98k wrote:

None of those methods are guaranteed to give you the correct bases. Use the pileup() function, which will provide ready access to the information you want.

ADD COMMENTlink written 5.8 years ago by Devon Ryan98k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1548 users visited in the last hour