BSSeeker / BSseeker2

A versatile aligning pipeline for bisulfite sequencing data
http://pellegrini.mcdb.ucla.edu/BS_Seeker2/
MIT License
60 stars 25 forks source link

bs_seeker2-call_methylation.py has error with newest pysam #3

Closed najoshi closed 7 years ago

najoshi commented 8 years ago

Hello,

I am running the methylation finding script using python 2.7.6 and pysam 0.8.3. This results in this error:

Traceback (most recent call last): File "../BSseeker2/bs_seeker2-call_methylation.py", line 242, in if pr.qpos >= len(pr_alignment.seq): AttributeError: 'pysam.calignmentfile.PileupRead' object has no attribute 'qpos'

I am assuming this is because I need to use pysam 0.6... but that version is very old. Can you update BSseeker2 for the latest pysam?

hmkim commented 8 years ago

You can change the code in bs_seeker2-call_methylation.py in temporairement.

242 if pr.qpos >= len(pr_alignment.seq): => 242 if pr.query_position >= len(pr_alignment.seq):

258 read_nuc = pr_alignment.seq[pr.qpos] => 258 read_nuc = pr_alignment.seq[pr.query_position]

refer to https://github.com/pysam-developers/pysam/commit/6d43e61fa173062c90cbbd3491f7803ba3dc6d4e

BSSeeker commented 8 years ago

Thanks, @hmkim. Hi @najoshi, I have updated BS-Seeker2, and you can try to see if it works with your local version.

rehamFatima commented 7 years ago

Hi,

I'm running the methylation caller script with pysam version 0.11.2.1. I am getting the following error :

Traceback (most recent call last): File "/Users/reham/lib/BSseeker2/bs_seeker2-call_methylation.py", line 289, in pr_qpos =pr.qpos AttributeError: 'pysam.libcalignedsegment.PileupRead' object has no attribute 'qpos'

Also, when the code line on 286 :

if pysam.version > "0.8.0" : pr_qpos = pr.query_position else : pr_qpos =pr.qpos

is evaluated :

v1 = '0.8.0' v2 = '0.11.2.1' v2 > v1 False

Could you please update for the pysam version ?

Thank you. Reham

guoweilong commented 7 years ago

@rehamFatima Thanks Reham, the bug is fixed, and you can try the latest version: https://github.com/BSSeeker/BSseeker2/releases/tag/v2.1.2Beta

Weilong