Question: Pysam under pypy?
1
gravatar for John
4.4 years ago by
John12k
Germany
John12k wrote:

As pysam is compiled C, i've never been able to run pysam under pypy.

This is a shame, since for most Bioinformatical operations (string manipulation, typical data structures, etc) pypy is considerably faster than python2.x

I think its probably worth getting pysam to run over pypy if possible - but before I start down that road, has anyone ever figured out how to get it to work already? :)

Thanks so much!

- John

pypy pysam python • 1.7k views
ADD COMMENTlink modified 2.9 years ago by Eric T.2.5k • written 4.4 years ago by John12k
1

If pysam spends most of time on zlib or the samtools/htslib C code, pypy won't help.

ADD REPLYlink written 4.4 years ago by lh331k

Yes, but most python programs that make use of pysam do something with the read data.
String manipulation, moving things around in memory, comparisons, etc. 
So i appreciate we're not going to be able to read BAM files quicker, but our scripts overall would be a lot faster :)

ADD REPLYlink written 4.4 years ago by John12k
1
gravatar for robert.zimmermann
2.9 years ago by
robert.zimmermann10 wrote:

Because this problem comes up quite frequently for me, I reimplemented a lot of the pysam functionality in python code so it could be run with pypy. Feel free to fork it and clean it up. https://github.com/nijibabulu/pypysam/

ADD COMMENTlink written 2.9 years ago by robert.zimmermann10

God job Rob! I wish you had mentioned it a long time ago before I tried the same thing here. My code only works for BAMs but it looks like yours does FASTA and everything else of htslib too! Very nice work :)

ADD REPLYlink written 2.9 years ago by John12k
1
gravatar for Eric T.
2.9 years ago by
Eric T.2.5k
San Francisco, CA
Eric T.2.5k wrote:

hts-python is another Python wrapper for htslib, the C library underlying pysam and samtools. It uses CFFI instead of Cython and is compatible with Pypy. It is a less mature project, but the author (brentp) has showed some promising performance benchmarks.

ADD COMMENTlink written 2.9 years ago by Eric T.2.5k

I also highly recommend hts-python, for what it's worth. Actually anything made by Brent. It's probably the most stable thing right now if you want to read BAMs on pypy.

Having said that, the pure-python methods like what robert and I posted are probably better ideas going forward than trying to hook htslib, assuming all you want to do is read a BAM file. There's no C to compile, it's just as fast if not faster, and there's no dependancies on other python or C projects that users may or may not have.

ADD REPLYlink written 2.9 years ago by John12k
Please log in to add an answer.

Help
Access

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