ssw-aligner-na 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ .python-version
2
+
3
+ # Virtual environments
4
+ .venv/
5
+ venv/
6
+ env/
7
+
8
+ # Python caches and test artifacts
9
+ __pycache__/
10
+ *.py[cod]
11
+ *.pyo
12
+ .pytest_cache/
13
+ .coverage
14
+ .coverage.*
15
+ htmlcov/
16
+
17
+ # Build artifacts
18
+ build/
19
+ dist/
20
+ pip-wheel-metadata/
21
+ *.whl
22
+
23
+ # Packaging metadata
24
+ *.egg-info/
25
+
26
+ # Compiled extension outputs from local builds
27
+ *.so
28
+ *.pyd
29
+
30
+ # Tooling caches
31
+ .mypy_cache/
32
+ .ruff_cache/
@@ -0,0 +1,7 @@
1
+ # CHANGELOG
2
+
3
+ <!-- version list -->
4
+
5
+ ## v1.0.0 (2026-11-18)
6
+
7
+ - Initial Release
@@ -0,0 +1,36 @@
1
+ cmake_minimum_required(VERSION 3.26)
2
+ project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
3
+
4
+ find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
5
+ find_package(Cython MODULE REQUIRED VERSION 3.0)
6
+ include(UseCython)
7
+
8
+ cython_transpile(ssw_aligner/_ssw_wrapper.pyx LANGUAGE C OUTPUT_VARIABLE ssw_wrapper_c)
9
+
10
+ python_add_library(_ssw_wrapper MODULE WITH_SOABI
11
+ ${ssw_wrapper_c}
12
+ ssw_aligner/_lib/ssw.c
13
+ )
14
+ # simde-sse2.h lives in the repo root; it maps SSE2 intrinsics to NEON etc. on non-x86 targets.
15
+ # The wrapper includes "_lib/ssw.h" relative to the package directory.
16
+ target_include_directories(_ssw_wrapper PRIVATE
17
+ ${CMAKE_CURRENT_SOURCE_DIR}
18
+ ${CMAKE_CURRENT_SOURCE_DIR}/ssw_aligner
19
+ )
20
+ target_link_libraries(_ssw_wrapper PRIVATE Python::NumPy)
21
+
22
+ # SIMD hints, as in the scikit-bio build this extension was extracted from.
23
+ if(MSVC)
24
+ target_compile_options(_ssw_wrapper PRIVATE /openmp:experimental)
25
+ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
26
+ target_compile_options(_ssw_wrapper PRIVATE -fopenmp-simd)
27
+ target_compile_definitions(_ssw_wrapper PRIVATE SIMDE_ENABLE_OPENMP)
28
+ elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel")
29
+ target_compile_options(_ssw_wrapper PRIVATE -qopenmp-simd)
30
+ target_compile_definitions(_ssw_wrapper PRIVATE SIMDE_ENABLE_OPENMP)
31
+ endif()
32
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
33
+ target_compile_options(_ssw_wrapper PRIVATE -msse2)
34
+ endif()
35
+
36
+ install(TARGETS _ssw_wrapper DESTINATION ssw_aligner)
@@ -0,0 +1,68 @@
1
+ ssw-aligner is distributed under multiple licenses matching its components.
2
+
3
+ ================================================================================
4
+ SSW C library (ssw_aligner/_lib/ssw.c, ssw.h)
5
+ The MIT License
6
+ ================================================================================
7
+
8
+ Copyright (c) 2012-2015 Boston College.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining
11
+ a copy of this software and associated documentation files (the
12
+ "Software"), to deal in the Software without restriction, including
13
+ without limitation the rights to use, copy, modify, merge, publish,
14
+ distribute, sublicense, and/or sell copies of the Software, and to
15
+ permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be
19
+ included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+ ================================================================================
31
+ Cython / Python wrapper (from scikit-bio)
32
+ Modified BSD License (BSD-3-Clause)
33
+ ================================================================================
34
+
35
+ Copyright (c) 2013--, scikit-bio development team.
36
+ All rights reserved.
37
+
38
+ Redistribution and use in source and binary forms, with or without modification,
39
+ are permitted provided that the following conditions are met:
40
+
41
+ * Redistributions of source code must retain the above copyright notice, this
42
+ list of conditions and the following disclaimer.
43
+
44
+ * Redistributions in binary form must reproduce the above copyright notice, this
45
+ list of conditions and the following disclaimer in the documentation and/or
46
+ other materials provided with the distribution.
47
+
48
+ * Neither the names scikit-bio, skbio, or biocore nor the names of its
49
+ contributors may be used to endorse or promote products derived from
50
+ this software without specific prior written permission.
51
+
52
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
56
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62
+
63
+ ================================================================================
64
+ SIMDe header (simde-sse2.h)
65
+ MIT License
66
+ ================================================================================
67
+
68
+ See the copyright and MIT permission notice in simde-sse2.h.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: ssw-aligner-na
3
+ Version: 1.0.0
4
+ Summary: Standalone StripedSmithWaterman (SSW) aligner extracted from scikit-bio
5
+ Author: NaturalAntibody, scikit-bio development team, Boston College (SSW C library)
6
+ License-Expression: BSD-3-Clause AND MIT
7
+ License-File: LICENSE.txt
8
+ Project-URL: Homepage, https://github.com/NaturalAntibody/ssw-aligner
9
+ Requires-Python: >=3.9
10
+ Requires-Dist: numpy>=1.17.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # ssw-aligner
14
+
15
+ Standalone [StripedSmithWaterman (SSW)](http://www.plosone.org/article/info:doi/10.1371/journal.pone.0082138) aligner extracted from [scikit-bio](https://scikit.bio).
16
+
17
+ This micro-library provides the SSW C implementation and its Python/Cython wrapper as a drop-in replacement for `skbio.alignment.StripedSmithWaterman`.
18
+
19
+ `StripedSmithWaterman` keeps the original scikit-bio defaults for backward compatibility.
20
+ For RIOT-compatible defaults, use `NucleotideAligner` or `ProteinAligner`.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install ssw-aligner-na # prebuilt wheels for Linux, macOS and Windows
26
+ ```
27
+
28
+ The distribution is named `ssw-aligner-na` on PyPI (`ssw_aligner` is taken by an
29
+ unrelated project); the import name is still `ssw_aligner`.
30
+
31
+ ## Development
32
+
33
+ The project is managed with [uv](https://docs.astral.sh/uv/) and built with
34
+ [scikit-build-core](https://scikit-build-core.readthedocs.io/) (CMake + Cython).
35
+ You need a C compiler; CMake, Cython and NumPy are installed into the isolated
36
+ build environment automatically.
37
+
38
+ ```bash
39
+ uv sync # create .venv, build the extension, install dev deps
40
+ uv run pytest # run the tests (incl. regression against scikit-bio)
41
+ uv build # build the sdist and a wheel for this machine into dist/
42
+ ```
43
+
44
+ `uv sync` rebuilds the extension whenever `CMakeLists.txt` or a `.pyx`/`.c`/`.h`
45
+ file changes; the CMake build tree is kept in `build/` so rebuilds are incremental.
46
+
47
+ ## Releasing
48
+
49
+ Every push to `master` runs `.github/workflows/ci.yml`: python-semantic-release
50
+ bumps the version from the conventional commits (and refreshes `uv.lock`),
51
+ cibuildwheel builds wheels for Linux (x86_64, aarch64), macOS (universal2) and
52
+ Windows (AMD64) for CPython 3.10–3.15 and PyPy 3.11, `uv build --sdist` builds
53
+ the sdist, and `uv publish` uploads everything to PyPI with trusted publishing.
54
+
55
+ ## RIOT-Compatible Wrappers
56
+
57
+ These wrappers use the same defaults as RIOT while leaving
58
+ `StripedSmithWaterman` unchanged for scikit-bio compatibility.
59
+
60
+ `NucleotideAligner` uses RIOT's `ALIGNER_PARAMS` defaults:
61
+ `match_score=1`, `mismatch_score=-1`, `gap_open_penalty=4`, `gap_extend_penalty=1`.
62
+
63
+ `ProteinAligner` uses RIOT's `AA_ALIGNER_PARAMS` defaults:
64
+ `gap_open_penalty=11`, `gap_extend_penalty=1`, `protein=True`, and `substitution_matrix=BLOSUM_62`.
65
+
66
+ ```python
67
+ from ssw_aligner import NucleotideAligner, ProteinAligner
68
+
69
+ nt_aligner = NucleotideAligner(query_sequence="ACTGACTG")
70
+ nt_result = nt_aligner(target_sequence="AACTGACTGA")
71
+
72
+ protein_aligner = ProteinAligner(query_sequence="ARNDCQEGHILKMFPSTWYV")
73
+ protein_result = protein_aligner(target_sequence="ARNDAQEGHILKMFASTWYV")
74
+
75
+ print(nt_result["optimal_alignment_score"])
76
+ print(protein_result["optimal_alignment_score"])
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ```python
82
+ from ssw_aligner import BLOSUM_62, StripedSmithWaterman
83
+
84
+ # Nucleotide alignment
85
+ aligner = StripedSmithWaterman(query_sequence="ACTGACTG")
86
+ result = aligner(target_sequence="AACTGACTGA")
87
+ print(result["optimal_alignment_score"])
88
+ print(result["cigar"])
89
+
90
+ # Protein alignment
91
+ aligner = StripedSmithWaterman(
92
+ query_sequence="ARNDCQEGHILKMFPSTWYV",
93
+ protein=True,
94
+ substitution_matrix=BLOSUM_62,
95
+ gap_open_penalty=11,
96
+ gap_extend_penalty=1,
97
+ )
98
+ result = aligner(target_sequence="ARNDCQEGHILKMFPSTWYV")
99
+ print(result["optimal_alignment_score"])
100
+ ```
101
+
102
+ ## Migrating from scikit-bio
103
+
104
+ Replace:
105
+ ```python
106
+ from skbio.alignment import StripedSmithWaterman
107
+ ```
108
+
109
+ With:
110
+ ```python
111
+ from ssw_aligner import StripedSmithWaterman
112
+ ```
113
+
114
+ No other code changes are needed.
115
+
116
+ ## License
117
+
118
+ This package is licensed as `BSD-3-Clause AND MIT`. Full text is in
119
+ [`LICENSE.txt`](LICENSE.txt):
120
+
121
+ - SSW C library (`ssw.c` / `ssw.h`): MIT License (Copyright 2012-2015 Boston College)
122
+ - Cython wrapper: Modified BSD License (Copyright 2013-- scikit-bio development team)
123
+ - SIMDe header: MIT License
@@ -0,0 +1,111 @@
1
+ # ssw-aligner
2
+
3
+ Standalone [StripedSmithWaterman (SSW)](http://www.plosone.org/article/info:doi/10.1371/journal.pone.0082138) aligner extracted from [scikit-bio](https://scikit.bio).
4
+
5
+ This micro-library provides the SSW C implementation and its Python/Cython wrapper as a drop-in replacement for `skbio.alignment.StripedSmithWaterman`.
6
+
7
+ `StripedSmithWaterman` keeps the original scikit-bio defaults for backward compatibility.
8
+ For RIOT-compatible defaults, use `NucleotideAligner` or `ProteinAligner`.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install ssw-aligner-na # prebuilt wheels for Linux, macOS and Windows
14
+ ```
15
+
16
+ The distribution is named `ssw-aligner-na` on PyPI (`ssw_aligner` is taken by an
17
+ unrelated project); the import name is still `ssw_aligner`.
18
+
19
+ ## Development
20
+
21
+ The project is managed with [uv](https://docs.astral.sh/uv/) and built with
22
+ [scikit-build-core](https://scikit-build-core.readthedocs.io/) (CMake + Cython).
23
+ You need a C compiler; CMake, Cython and NumPy are installed into the isolated
24
+ build environment automatically.
25
+
26
+ ```bash
27
+ uv sync # create .venv, build the extension, install dev deps
28
+ uv run pytest # run the tests (incl. regression against scikit-bio)
29
+ uv build # build the sdist and a wheel for this machine into dist/
30
+ ```
31
+
32
+ `uv sync` rebuilds the extension whenever `CMakeLists.txt` or a `.pyx`/`.c`/`.h`
33
+ file changes; the CMake build tree is kept in `build/` so rebuilds are incremental.
34
+
35
+ ## Releasing
36
+
37
+ Every push to `master` runs `.github/workflows/ci.yml`: python-semantic-release
38
+ bumps the version from the conventional commits (and refreshes `uv.lock`),
39
+ cibuildwheel builds wheels for Linux (x86_64, aarch64), macOS (universal2) and
40
+ Windows (AMD64) for CPython 3.10–3.15 and PyPy 3.11, `uv build --sdist` builds
41
+ the sdist, and `uv publish` uploads everything to PyPI with trusted publishing.
42
+
43
+ ## RIOT-Compatible Wrappers
44
+
45
+ These wrappers use the same defaults as RIOT while leaving
46
+ `StripedSmithWaterman` unchanged for scikit-bio compatibility.
47
+
48
+ `NucleotideAligner` uses RIOT's `ALIGNER_PARAMS` defaults:
49
+ `match_score=1`, `mismatch_score=-1`, `gap_open_penalty=4`, `gap_extend_penalty=1`.
50
+
51
+ `ProteinAligner` uses RIOT's `AA_ALIGNER_PARAMS` defaults:
52
+ `gap_open_penalty=11`, `gap_extend_penalty=1`, `protein=True`, and `substitution_matrix=BLOSUM_62`.
53
+
54
+ ```python
55
+ from ssw_aligner import NucleotideAligner, ProteinAligner
56
+
57
+ nt_aligner = NucleotideAligner(query_sequence="ACTGACTG")
58
+ nt_result = nt_aligner(target_sequence="AACTGACTGA")
59
+
60
+ protein_aligner = ProteinAligner(query_sequence="ARNDCQEGHILKMFPSTWYV")
61
+ protein_result = protein_aligner(target_sequence="ARNDAQEGHILKMFASTWYV")
62
+
63
+ print(nt_result["optimal_alignment_score"])
64
+ print(protein_result["optimal_alignment_score"])
65
+ ```
66
+
67
+ ## Usage
68
+
69
+ ```python
70
+ from ssw_aligner import BLOSUM_62, StripedSmithWaterman
71
+
72
+ # Nucleotide alignment
73
+ aligner = StripedSmithWaterman(query_sequence="ACTGACTG")
74
+ result = aligner(target_sequence="AACTGACTGA")
75
+ print(result["optimal_alignment_score"])
76
+ print(result["cigar"])
77
+
78
+ # Protein alignment
79
+ aligner = StripedSmithWaterman(
80
+ query_sequence="ARNDCQEGHILKMFPSTWYV",
81
+ protein=True,
82
+ substitution_matrix=BLOSUM_62,
83
+ gap_open_penalty=11,
84
+ gap_extend_penalty=1,
85
+ )
86
+ result = aligner(target_sequence="ARNDCQEGHILKMFPSTWYV")
87
+ print(result["optimal_alignment_score"])
88
+ ```
89
+
90
+ ## Migrating from scikit-bio
91
+
92
+ Replace:
93
+ ```python
94
+ from skbio.alignment import StripedSmithWaterman
95
+ ```
96
+
97
+ With:
98
+ ```python
99
+ from ssw_aligner import StripedSmithWaterman
100
+ ```
101
+
102
+ No other code changes are needed.
103
+
104
+ ## License
105
+
106
+ This package is licensed as `BSD-3-Clause AND MIT`. Full text is in
107
+ [`LICENSE.txt`](LICENSE.txt):
108
+
109
+ - SSW C library (`ssw.c` / `ssw.h`): MIT License (Copyright 2012-2015 Boston College)
110
+ - Cython wrapper: Modified BSD License (Copyright 2013-- scikit-bio development team)
111
+ - SIMDe header: MIT License
@@ -0,0 +1,95 @@
1
+ [build-system]
2
+ # Building against NumPy 2 produces binaries that work with both NumPy 1.x and 2.x at runtime.
3
+ requires = ["scikit-build-core>=0.11", "cython>=3.0", "cython-cmake>=0.2", "numpy>=2.0"]
4
+ build-backend = "scikit_build_core.build"
5
+
6
+ [project]
7
+ name = "ssw-aligner-na"
8
+ version = "1.0.0"
9
+ description = "Standalone StripedSmithWaterman (SSW) aligner extracted from scikit-bio"
10
+ readme = "README.md"
11
+ authors = [
12
+ { name = "NaturalAntibody" },
13
+ { name = "scikit-bio development team" },
14
+ { name = "Boston College (SSW C library)" },
15
+ ]
16
+ license = "BSD-3-Clause AND MIT"
17
+ license-files = ["LICENSE.txt"]
18
+ requires-python = ">=3.9"
19
+ dependencies = [
20
+ "numpy>=1.17.0",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/NaturalAntibody/ssw-aligner"
25
+
26
+ [dependency-groups]
27
+ dev = ["pytest>=8", "scikit-bio==0.6.2"]
28
+ release = ["python-semantic-release~=10.0"]
29
+
30
+ [tool.scikit-build]
31
+ minimum-version = "build-system.requires"
32
+ wheel.packages = ["ssw_aligner"]
33
+ # A persistent build dir makes `uv sync` rebuilds incremental.
34
+ build-dir = "build/{wheel_tag}"
35
+ sdist.exclude = [".github/"]
36
+ # C/Cython sources belong in the sdist only; the wheel ships the compiled module.
37
+ wheel.exclude = ["ssw_aligner/**.pyx", "ssw_aligner/_lib/*.c", "ssw_aligner/_lib/*.h"]
38
+
39
+ [tool.uv]
40
+ # Reinstall (and so rebuild) the editable project when the C/Cython sources change.
41
+ cache-keys = [
42
+ { file = "pyproject.toml" },
43
+ { file = "CMakeLists.txt" },
44
+ { file = "ssw_aligner/**/*.pyx" },
45
+ { file = "ssw_aligner/**/*.c" },
46
+ { file = "ssw_aligner/**/*.h" },
47
+ ]
48
+
49
+ [tool.cibuildwheel]
50
+ # Same interpreters as riot_na's wheels: CPython 3.10-3.15 and PyPy 3.11.
51
+ build = ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*", "cp315-*", "pp311-*"]
52
+ skip = ["*-musllinux_*", "*-win32"]
53
+ enable = ["pypy"]
54
+ build-frontend = "build[uv]"
55
+ test-requires = ["pytest"]
56
+ test-sources = ["tests"]
57
+ # test_regression.py compares against scikit-bio, which only the dev group installs.
58
+ test-command = "pytest tests/test_aligners.py"
59
+
60
+ [tool.cibuildwheel.macos]
61
+ archs = ["universal2"]
62
+
63
+ [tool.cibuildwheel.windows]
64
+ archs = ["AMD64"]
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+
69
+ [tool.semantic_release]
70
+ # uv.lock records the project version, so refresh it in the release commit.
71
+ # The real build happens later in CI (cibuildwheel + uv build --sdist).
72
+ build_command = "uv lock --upgrade-package ssw-aligner-na && git add uv.lock"
73
+ commit_message = "bump: {version} [skip ci]\n\nAutomatically generated by python-semantic-release"
74
+ tag_format = "v{version}"
75
+ version_toml = ["pyproject.toml:project.version"]
76
+ version_variables = ["ssw_aligner/__init__.py:__version__"]
77
+
78
+ [tool.semantic_release.remote]
79
+ type = "github"
80
+
81
+ [tool.semantic_release.commit_parser_options]
82
+ allowed_tags = [
83
+ "build",
84
+ "chore",
85
+ "ci",
86
+ "docs",
87
+ "feat",
88
+ "fix",
89
+ "perf",
90
+ "style",
91
+ "refactor",
92
+ "test",
93
+ ]
94
+ minor_tags = ["feat"]
95
+ patch_tags = ["fix", "perf", "docs", "build"]