morinlab / lab_scripts

Consolidated scripts used by the Morin lab
6 stars 6 forks source link

bamUtils.py: count_bases_pileup doesn't handle del or refskip reads #5

Closed dfornika closed 8 years ago

dfornika commented 8 years ago

On line 261:

base_qual = ord(read.alignment.qual[read.query_position])-33

read.query_position will be None if is_del or is_refskip are set.

http://pysam.readthedocs.org/en/latest/api.html#pysam.PileupRead.query_position

dfornika commented 8 years ago

I've made the smallest change I could think of in order to resolve this issue. I'd appreciate if @rdmorin, @brunogrande or any other users of this code could take a look at this commit to make sure that this change isn't going to break some other analysis that depends on this function.

BrunoGrandePhD commented 8 years ago

If a read doesn't have a base at a given position, then I can't imagine this causing an issue.

dfornika commented 8 years ago

Thanks for confirming.