Jellyfish provides Python, along with Perl and Ruby bindings via SWIG. SWIG unfortunately is not efficient with fine grained call-stack.
In qc3C the many calls to query the jellyfish kmer database in analyze.collect_coverage() add up enormously, making this method the most time consuming call beneath the primary analyze() method, accounting for 51% of time.
Replacing SWIG with a simple pybind11 binding reduced this to 30%.
It would likely be better to export the sliding window depth analysis entirely to C++, returning just the inner and outer mean depths.
After doing so, the question would be how to best integrate this binding.
A manual build that produces an importable Python module, where the define is necessary to get SSE/Altivec type definititions from config.h. This include is generated by a call to ./configure.
# using a tarball release of jellyfish
tar xzf jellyfish-2.2.10.tar.gz
cd jellyfish-2.2.10
autoreconf -i
./configure --prefix=/usr/local
g++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` jelly.cpp `ls lib/*` -o jelly`python3-config --extension-suffix` -Iinclude -I. -DHAVE_CONFIG_H=true
Example binding, implementing only methods we require. Here I have adapted the helper class QueryMerFile used by the Jellyfish SWIG binding.
Jellyfish provides Python, along with Perl and Ruby bindings via SWIG. SWIG unfortunately is not efficient with fine grained call-stack.
In qc3C the many calls to query the jellyfish kmer database in
analyze.collect_coverage()
add up enormously, making this method the most time consuming call beneath the primaryanalyze()
method, accounting for 51% of time.Replacing SWIG with a simple pybind11 binding reduced this to 30%.
It would likely be better to export the sliding window depth analysis entirely to C++, returning just the inner and outer mean depths.
After doing so, the question would be how to best integrate this binding.
A manual build that produces an importable Python module, where the define is necessary to get SSE/Altivec type definititions from config.h. This include is generated by a call to
./configure
.Example binding, implementing only methods we require. Here I have adapted the helper class
QueryMerFile
used by the Jellyfish SWIG binding.