kcleal / pywfa

Python wrapper for wavefront alignment using WFA2-lib
MIT License
35 stars 2 forks source link

Wildcard causes segfault with pywfa installed via pip, works when installed from source #16

Open matthuska opened 3 months ago

matthuska commented 3 months ago

If I install pywfa using pip, I can run the example script from the README without any problems. However, if I use the wildcard option of WavefrontAligner I get a segfault:

$ diff works.py fails.py 
5c5
< a = WavefrontAligner(pattern)
---
> a = WavefrontAligner(pattern, wildcard="N")
$ python works.py
      ALIGNMENT 3M1X4M1D7M1I9M1X6M
      ALIGNMENT.COMPACT 1X1D1I1X
      PATTERN    TCTTTACTCGCGCGTT-GGAGAAATACAATAGT
                 ||| |||| ||||||| ||||||||| ||||||
      TEXT       TCTATACT-GCGCGTTTGGAGAAATAAAATAGT
$ python fails.py 
Segmentation fault

If I build from pywfa source (using the exact steps from the README), the segfault goes away and the wildcard works as expected:

$ python fails.py 
      ALIGNMENT 3M1X4M1D7M1I9M1X6M
      ETRACE    1X1D1I1X
      CIGAR     8M1D7M1I16M
      PATTERN    TCTTTACTCGCGCGTT-GGAGAAATACAATAGT
                 ||| |||| ||||||| ||||||||| ||||||
      TEXT       TCTATACT-GCGCGTTTGGAGAAATAAAATAGT
kcleal commented 3 months ago

Hi @matthuska, The pip package is out of sync with the repo and doesn't have the wildcard functionality. Ive been meaning to update the build, but have been a bit too busy lately.

matthuska commented 3 months ago

If you would be interested, I could do a small PR that sets up a GitHub action to automatically publish releases to PyPI. I use it myself and it makes doing releases a bit easier (just create the release on the GitHub web page, done).

As an example: https://github.com/rki-mf1/breakfast/blob/master/.github/workflows/release.yml

kcleal commented 3 months ago

Thanks that would be awesome. However, Im not sure that the current install script is compatible with osx-arm64, if you could add a runner that builds and tests using Ubuntu that would be great. I can try and sort out the macOS issue. The package will be released as a source distribution rather than a built wheel.