Compile kent source as dynamic library: Difference between revisions
From genomewiki
Jump to navigationJump to search
(Created page with " cd src/lib make USE_SAMTABIX=0 USE_TABIX=0 USE_BAM=0 CFLAGS=-fPIC USE_SSL=0 gcc -shared -o kent.so *.o font/*.o -lz -lpng") |
No edit summary |
||
Line 1: | Line 1: | ||
To run kent src functions from python, you need to compile the tree with -fPIC. It's easier to deactivate the various libraries: | |||
cd src/lib | cd src/lib | ||
make USE_SAMTABIX=0 USE_TABIX=0 USE_BAM=0 CFLAGS=-fPIC USE_SSL=0 | make USE_SAMTABIX=0 USE_TABIX=0 USE_BAM=0 CFLAGS=-fPIC USE_SSL=0 | ||
gcc -shared -o kent.so *.o font/*.o -lz -lpng | gcc -shared -o kent.so *.o font/*.o -lz -lpng | ||
Now you can do this to generate a python wrapper around any kent source library: | |||
ctypesgen.py ../inc/psl.h -lkent.so -o psl.py | |||
And then call kent source functions in your python script: | |||
import psl | |||
p = psl.pslLoadAll("test.psl") | |||
print p.contents.blockCount |
Revision as of 10:23, 18 May 2013
To run kent src functions from python, you need to compile the tree with -fPIC. It's easier to deactivate the various libraries:
cd src/lib make USE_SAMTABIX=0 USE_TABIX=0 USE_BAM=0 CFLAGS=-fPIC USE_SSL=0 gcc -shared -o kent.so *.o font/*.o -lz -lpng
Now you can do this to generate a python wrapper around any kent source library:
ctypesgen.py ../inc/psl.h -lkent.so -o psl.py
And then call kent source functions in your python script:
import psl p = psl.pslLoadAll("test.psl") print p.contents.blockCount