Hello, 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? Methods: 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: http://woldlab.caltech.edu/gitweb/?p=samtools.git;a=blob;f=debian/patches/phase-in-so;h=64f44beebe4120c2c2c6ae792442a75d5bb256b3;hb=woldlab 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'] else: - 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 , library_dirs=[], - include_dirs=[ "samtools", "pysam" ] + include_os, - libraries=[ "z", ], + include_dirs=["pysam" ] + include_os, + libraries=[ "z", "bam"], language="c", Diane
Attachment:
pgpk2HGWYP4fZ.pgp
Description: PGP signature