[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pysam package


I had built our own version of samtools so it created a shared library. It then ocurred to me to try building pysam against this shared library. I was able make it work well enough to run pysams test cases.

Would modifying the debian samtools and tabix packages to build shared objects be a reasonable solution to the pysam code copying problem?


I only tried changing pysam to link to my samtools shared library, I didn't bother trying to fix the wholesale import of tabix. (I was curious if the shared object strategy would work).

To make it work I needed add the following object files to the libbam so. 

bam_plcmd.o sam_view.o      
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o      
bam2bcf.o bam2bcf_indel.o errmod.o sample.o 
cut_target.o phase.o bam2depth.o 
bcftools/bcf.o bcftools/bcfutils.o bcftools/fet.o 

quilt patch file:


On the pysam side I told it to use my include/bam and library and 
pulled out  the wholesale importing of samptools/*.pysam.c

It ran well enough to run the tests, though there may still be some undefined symbols, as I didn't add all the *.o's that the pysam setup.py was using.

--- setup.orig.py       2012-12-19 12:27:21.019867664 -0800
+++ setup.py    2012-12-19 15:20:29.191500964 -0800
@@ -138,22 +138,20 @@
 if platform.system()=='Windows':
     include_os = ['win32']
     os_c_files = ['win32/getopt.c']
-    include_os = []
+    include_os = ['/usr/include/bam']
     os_c_files = []
 samtools = Extension(
     "csamtools",                   # name of extension
     [ "pysam/csamtools.pyx" ]  +\
         [ "pysam/%s" % x for x in (
                 "pysam_util.c", )] +\
-        glob.glob( os.path.join( "samtools", "*.pysam.c" )) +\
-        os_c_files + \
-        glob.glob( os.path.join( "samtools", "*", "*.pysam.c" ) ),
+        os_c_files ,
-    include_dirs=[ "samtools", "pysam" ] + include_os,
-    libraries=[ "z", ],
+    include_dirs=["pysam" ] + include_os,
+    libraries=[ "z", "bam"],


Attachment: pgpk2HGWYP4fZ.pgp
Description: PGP signature

Reply to: