open2c / pairtools

Extract 3D contacts (.pairs) from sequencing alignments
MIT License
104 stars 32 forks source link

Fix hardcoded full path for pysam libs. #149

Open ccoulombe opened 2 years ago

ccoulombe commented 2 years ago

Pysam include library directory and set libraries instead of providing full path. Set rpath so libs are found when installed in a virtual environment or in user-space.

This allow to use pairtools in different environment and find libs at runtime instead of having them hardcoded at build time.

agalitsyna commented 2 years ago

HI, @ccoulombe Thanks for your PR!

  1. Can you provide an example environment setting when the current version won't work?
  2. How robust is setting the paths relative to $ORIGIN?
ccoulombe commented 2 years ago
  1. The current will not work when :

    • the package needs to be redistributed as a wheel
    • the package is installed in a different environment then the one used to build. Since the full path of the libraries from the build environment are used. For instance, a wheel from PyPI or from an HPC center that redistribute this software as pre-built wheel.
  2. Very robust, as this is only a complement and does not hurt to have this extra path. $ORIGIN always point to the origin of the library and since pysam is required to be installed along pairtools, the required libraries will always be at $PWD/../..pysam when installed in user-space or in a virtual environment since pip install packages in : lib/pythonX.Y/site-packages ( and pysam libraries live in the installation directory). Obviously, this does not apply when the packages are installed system-wide, in which case the linker should be able to find the pysam libraries from its config (e.g. another system-wide path).


In the end, this only add flexibility and make the package installable in different environment by not using hard coded paths.