kalign 3.4.6__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.
Files changed (178) hide show
  1. kalign-3.4.6/.github/workflows/benchmark.yml +122 -0
  2. kalign-3.4.6/.github/workflows/cmake.yml +96 -0
  3. kalign-3.4.6/.github/workflows/codeql-analysis.yml +62 -0
  4. kalign-3.4.6/.github/workflows/python.yml +152 -0
  5. kalign-3.4.6/.github/workflows/wheels.yml +265 -0
  6. kalign-3.4.6/.gitignore +419 -0
  7. kalign-3.4.6/.gitmodules +0 -0
  8. kalign-3.4.6/AUTHORS +1 -0
  9. kalign-3.4.6/CITATION.cff +39 -0
  10. kalign-3.4.6/CLAUDE.md +190 -0
  11. kalign-3.4.6/CMakeLists.txt +322 -0
  12. kalign-3.4.6/CONTRIBUTING.md +236 -0
  13. kalign-3.4.6/COPYING +674 -0
  14. kalign-3.4.6/ChangeLog +141 -0
  15. kalign-3.4.6/PKG-INFO +696 -0
  16. kalign-3.4.6/README-python.md +623 -0
  17. kalign-3.4.6/README.md +389 -0
  18. kalign-3.4.6/benchmarks/__init__.py +1 -0
  19. kalign-3.4.6/benchmarks/__main__.py +5 -0
  20. kalign-3.4.6/benchmarks/app.py +371 -0
  21. kalign-3.4.6/benchmarks/datasets.py +277 -0
  22. kalign-3.4.6/benchmarks/runner.py +186 -0
  23. kalign-3.4.6/benchmarks/scoring.py +111 -0
  24. kalign-3.4.6/build.zig +113 -0
  25. kalign-3.4.6/doc/images/Balibase_scores.jpeg +0 -0
  26. kalign-3.4.6/doc/images/Balibase_scores.png +0 -0
  27. kalign-3.4.6/doc/images/Bralibase_scores.jpeg +0 -0
  28. kalign-3.4.6/doc/images/Homfam_scores.jpeg +0 -0
  29. kalign-3.4.6/doc/images/Quantest2_scores.jpeg +0 -0
  30. kalign-3.4.6/doc/paper/kalign3.bib +185 -0
  31. kalign-3.4.6/doc/paper/kalign3.org +96 -0
  32. kalign-3.4.6/doc/paper/revision/main.tex +112 -0
  33. kalign-3.4.6/lib/CMakeLists.txt +281 -0
  34. kalign-3.4.6/lib/include/kalign/kalign.h +52 -0
  35. kalign-3.4.6/lib/kalignConfig.cmake.in +5 -0
  36. kalign-3.4.6/lib/src/aln_controller.c +436 -0
  37. kalign-3.4.6/lib/src/aln_controller.h +22 -0
  38. kalign-3.4.6/lib/src/aln_mem.c +94 -0
  39. kalign-3.4.6/lib/src/aln_mem.h +22 -0
  40. kalign-3.4.6/lib/src/aln_param.c +269 -0
  41. kalign-3.4.6/lib/src/aln_param.h +37 -0
  42. kalign-3.4.6/lib/src/aln_profileprofile.c +410 -0
  43. kalign-3.4.6/lib/src/aln_profileprofile.h +22 -0
  44. kalign-3.4.6/lib/src/aln_run.c +276 -0
  45. kalign-3.4.6/lib/src/aln_run.h +32 -0
  46. kalign-3.4.6/lib/src/aln_seqprofile.c +339 -0
  47. kalign-3.4.6/lib/src/aln_seqprofile.h +26 -0
  48. kalign-3.4.6/lib/src/aln_seqseq.c +341 -0
  49. kalign-3.4.6/lib/src/aln_seqseq.h +24 -0
  50. kalign-3.4.6/lib/src/aln_setup.c +400 -0
  51. kalign-3.4.6/lib/src/aln_setup.h +30 -0
  52. kalign-3.4.6/lib/src/aln_struct.h +44 -0
  53. kalign-3.4.6/lib/src/aln_wrap.c +144 -0
  54. kalign-3.4.6/lib/src/aln_wrap.h +24 -0
  55. kalign-3.4.6/lib/src/alphabet.c +459 -0
  56. kalign-3.4.6/lib/src/alphabet.h +63 -0
  57. kalign-3.4.6/lib/src/bisectingKmeans.c +1052 -0
  58. kalign-3.4.6/lib/src/bisectingKmeans.h +52 -0
  59. kalign-3.4.6/lib/src/bpm.c +604 -0
  60. kalign-3.4.6/lib/src/bpm.h +60 -0
  61. kalign-3.4.6/lib/src/bpm_test.c +607 -0
  62. kalign-3.4.6/lib/src/core.h +52 -0
  63. kalign-3.4.6/lib/src/coretralign.c +244 -0
  64. kalign-3.4.6/lib/src/coretralign.h +71 -0
  65. kalign-3.4.6/lib/src/esl_stopwatch.c +445 -0
  66. kalign-3.4.6/lib/src/esl_stopwatch.h +81 -0
  67. kalign-3.4.6/lib/src/euclidean_dist.c +230 -0
  68. kalign-3.4.6/lib/src/euclidean_dist.h +44 -0
  69. kalign-3.4.6/lib/src/io.h +18 -0
  70. kalign-3.4.6/lib/src/mod_tldevel.h +10 -0
  71. kalign-3.4.6/lib/src/msa_alloc.c +156 -0
  72. kalign-3.4.6/lib/src/msa_alloc.h +27 -0
  73. kalign-3.4.6/lib/src/msa_check.c +310 -0
  74. kalign-3.4.6/lib/src/msa_check.h +23 -0
  75. kalign-3.4.6/lib/src/msa_cmp.c +250 -0
  76. kalign-3.4.6/lib/src/msa_cmp.h +21 -0
  77. kalign-3.4.6/lib/src/msa_io.c +1309 -0
  78. kalign-3.4.6/lib/src/msa_io.h +27 -0
  79. kalign-3.4.6/lib/src/msa_misc.c +33 -0
  80. kalign-3.4.6/lib/src/msa_misc.h +18 -0
  81. kalign-3.4.6/lib/src/msa_op.c +585 -0
  82. kalign-3.4.6/lib/src/msa_op.h +39 -0
  83. kalign-3.4.6/lib/src/msa_sort.c +92 -0
  84. kalign-3.4.6/lib/src/msa_sort.h +20 -0
  85. kalign-3.4.6/lib/src/msa_struct.h +53 -0
  86. kalign-3.4.6/lib/src/pick_anchor.c +106 -0
  87. kalign-3.4.6/lib/src/pick_anchor.h +22 -0
  88. kalign-3.4.6/lib/src/sequence_distance.c +405 -0
  89. kalign-3.4.6/lib/src/sequence_distance.h +52 -0
  90. kalign-3.4.6/lib/src/task.c +215 -0
  91. kalign-3.4.6/lib/src/task.h +47 -0
  92. kalign-3.4.6/lib/src/test.c +16 -0
  93. kalign-3.4.6/lib/src/test.h +5 -0
  94. kalign-3.4.6/lib/src/tldevel.c +368 -0
  95. kalign-3.4.6/lib/src/tldevel.h +291 -0
  96. kalign-3.4.6/lib/src/tlmisc.c +230 -0
  97. kalign-3.4.6/lib/src/tlmisc.h +26 -0
  98. kalign-3.4.6/lib/src/tlrng.c +437 -0
  99. kalign-3.4.6/lib/src/tlrng.h +34 -0
  100. kalign-3.4.6/lib/src/version.h.in +2 -0
  101. kalign-3.4.6/lib/src/weave_alignment.c +133 -0
  102. kalign-3.4.6/lib/src/weave_alignment.h +44 -0
  103. kalign-3.4.6/pyproject.toml +235 -0
  104. kalign-3.4.6/pytest.ini +19 -0
  105. kalign-3.4.6/python-docs/python-api.md +526 -0
  106. kalign-3.4.6/python-docs/python-ecosystem.md +1454 -0
  107. kalign-3.4.6/python-docs/python-performance.md +1049 -0
  108. kalign-3.4.6/python-docs/python-quickstart.md +632 -0
  109. kalign-3.4.6/python-docs/python-troubleshooting.md +1083 -0
  110. kalign-3.4.6/python-examples/README.md +290 -0
  111. kalign-3.4.6/python-examples/basic_usage.py +226 -0
  112. kalign-3.4.6/python-examples/ecosystem_integration.py +474 -0
  113. kalign-3.4.6/python-examples/performance_benchmarks.py +467 -0
  114. kalign-3.4.6/python-examples/sample_sequences.fasta +6 -0
  115. kalign-3.4.6/python-kalign/__init__.py +733 -0
  116. kalign-3.4.6/python-kalign/_core.cpp +404 -0
  117. kalign-3.4.6/python-kalign/cli.py +172 -0
  118. kalign-3.4.6/python-kalign/io.py +351 -0
  119. kalign-3.4.6/python-kalign/py.typed +0 -0
  120. kalign-3.4.6/python-kalign/utils.py +327 -0
  121. kalign-3.4.6/scripts/balibase_test.org +1308 -0
  122. kalign-3.4.6/scripts/benchmark.org +804 -0
  123. kalign-3.4.6/scripts/bralibase.org +241 -0
  124. kalign-3.4.6/src/CMakeLists.txt +60 -0
  125. kalign-3.4.6/src/parameters.c +126 -0
  126. kalign-3.4.6/src/parameters.h +76 -0
  127. kalign-3.4.6/src/run_kalign.c +400 -0
  128. kalign-3.4.6/src/run_reformat.c +347 -0
  129. kalign-3.4.6/src/version.h.in +2 -0
  130. kalign-3.4.6/test_thresholds.py +423 -0
  131. kalign-3.4.6/tests/CMakeLists.txt +103 -0
  132. kalign-3.4.6/tests/data/BB11001.msf +26 -0
  133. kalign-3.4.6/tests/data/BB11001.tfa +12 -0
  134. kalign-3.4.6/tests/data/BB11001_EOF.msf +25 -0
  135. kalign-3.4.6/tests/data/BB12006.msf +44 -0
  136. kalign-3.4.6/tests/data/BB12006.tfa +24 -0
  137. kalign-3.4.6/tests/data/BB30014.msf +376 -0
  138. kalign-3.4.6/tests/data/BB30014.tfa +264 -0
  139. kalign-3.4.6/tests/data/README +5 -0
  140. kalign-3.4.6/tests/data/a2m.good.1 +16 -0
  141. kalign-3.4.6/tests/data/a2m.good.2 +15 -0
  142. kalign-3.4.6/tests/data/afa.good.1 +16 -0
  143. kalign-3.4.6/tests/data/afa.good.2 +15 -0
  144. kalign-3.4.6/tests/data/afa.good.3 +24 -0
  145. kalign-3.4.6/tests/data/clustal.good.1 +20 -0
  146. kalign-3.4.6/tests/data/clustal.good.2 +15 -0
  147. kalign-3.4.6/tests/data/small.fa +34 -0
  148. kalign-3.4.6/tests/data/tiny.fa +4 -0
  149. kalign-3.4.6/tests/data/tiny_internal.fa +4 -0
  150. kalign-3.4.6/tests/dssim.c +608 -0
  151. kalign-3.4.6/tests/dssim.h +19 -0
  152. kalign-3.4.6/tests/dssim_test.c +137 -0
  153. kalign-3.4.6/tests/kalign_cmp_test.c +23 -0
  154. kalign-3.4.6/tests/kalign_io_test.c +21 -0
  155. kalign-3.4.6/tests/kalign_lib_test.c +74 -0
  156. kalign-3.4.6/tests/kalign_lib_testCXX.cpp +40 -0
  157. kalign-3.4.6/tests/large_benchmark.c +472 -0
  158. kalign-3.4.6/tests/python/conftest.py +282 -0
  159. kalign-3.4.6/tests/python/pytest.ini +19 -0
  160. kalign-3.4.6/tests/python/test_basic_alignment.py +68 -0
  161. kalign-3.4.6/tests/python/test_cli.py +54 -0
  162. kalign-3.4.6/tests/python/test_compare.py +83 -0
  163. kalign-3.4.6/tests/python/test_data/dna_sequences.fasta +6 -0
  164. kalign-3.4.6/tests/python/test_data/invalid_sequences.fasta +4 -0
  165. kalign-3.4.6/tests/python/test_data/protein_sequences.fasta +6 -0
  166. kalign-3.4.6/tests/python/test_data/rna_sequences.fasta +6 -0
  167. kalign-3.4.6/tests/python/test_ecosystem_integration.py +323 -0
  168. kalign-3.4.6/tests/python/test_edge_cases.py +82 -0
  169. kalign-3.4.6/tests/python/test_error_handling.py +56 -0
  170. kalign-3.4.6/tests/python/test_file_operations.py +75 -0
  171. kalign-3.4.6/tests/python/test_input_validation.py +72 -0
  172. kalign-3.4.6/tests/python/test_integration.py +103 -0
  173. kalign-3.4.6/tests/python/test_parameters.py +47 -0
  174. kalign-3.4.6/tests/python/test_performance.py +129 -0
  175. kalign-3.4.6/tests/python/test_sequence_types.py +96 -0
  176. kalign-3.4.6/tests/python/test_thresholds.py +483 -0
  177. kalign-3.4.6/tests/zig_test.c +20 -0
  178. kalign-3.4.6/uv.lock +4462 -0
@@ -0,0 +1,122 @@
1
+ name: Benchmark
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - 'lib/**'
8
+ - 'python-kalign/**'
9
+ - 'benchmarks/**'
10
+ - 'CMakeLists.txt'
11
+ - '.github/workflows/benchmark.yml'
12
+ pull_request:
13
+ branches: [main]
14
+ paths:
15
+ - 'lib/**'
16
+ - 'python-kalign/**'
17
+ - 'benchmarks/**'
18
+ - 'CMakeLists.txt'
19
+ - '.github/workflows/benchmark.yml'
20
+ workflow_dispatch:
21
+
22
+ permissions:
23
+ contents: write
24
+ deployments: write
25
+
26
+ jobs:
27
+ benchmark:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Set up Python
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: '3.11'
36
+
37
+ - name: Install system dependencies
38
+ run: |
39
+ sudo apt-get update
40
+ sudo apt-get install -y libomp-dev cmake
41
+
42
+ - name: Build C binary
43
+ run: |
44
+ mkdir -p build
45
+ cd build
46
+ cmake ..
47
+ make -j$(nproc)
48
+
49
+ - name: Install Python package
50
+ run: |
51
+ python -m pip install --upgrade pip
52
+ python -m pip install -e .
53
+
54
+ - name: Cache BAliBASE dataset
55
+ uses: actions/cache@v4
56
+ with:
57
+ path: benchmarks/data/downloads
58
+ key: benchmark-datasets-balibase-v1
59
+
60
+ - name: Run benchmarks
61
+ run: |
62
+ python -m benchmarks \
63
+ --dataset balibase \
64
+ --method python_api cli \
65
+ --binary build/src/kalign \
66
+ --output benchmarks/results/latest.json \
67
+ -v
68
+
69
+ - name: Convert results for github-action-benchmark
70
+ run: |
71
+ python -c "
72
+ import json
73
+ with open('benchmarks/results/latest.json') as f:
74
+ data = json.load(f)
75
+ entries = []
76
+ for method, stats in data.get('summary', {}).items():
77
+ entries.append({
78
+ 'name': f'SP Score Mean ({method})',
79
+ 'unit': 'score',
80
+ 'value': round(stats['sp_mean'], 2),
81
+ 'range': f\"{stats['sp_min']:.1f}-{stats['sp_max']:.1f}\",
82
+ })
83
+ entries.append({
84
+ 'name': f'Total Time ({method})',
85
+ 'unit': 'seconds',
86
+ 'value': round(stats['total_time'], 2),
87
+ })
88
+ with open('benchmarks/results/benchmark_output.json', 'w') as f:
89
+ json.dump(entries, f, indent=2)
90
+ "
91
+
92
+ - name: Store benchmark result
93
+ if: github.ref == 'refs/heads/main'
94
+ uses: benchmark-action/github-action-benchmark@v1
95
+ with:
96
+ tool: 'customBiggerIsBetter'
97
+ output-file-path: benchmarks/results/benchmark_output.json
98
+ gh-pages-branch: gh-pages
99
+ benchmark-data-dir-path: dev/bench
100
+ auto-push: true
101
+ alert-threshold: '95%'
102
+ comment-on-alert: true
103
+ fail-on-alert: false
104
+
105
+ - name: Compare with baseline (PRs only)
106
+ if: github.event_name == 'pull_request'
107
+ uses: benchmark-action/github-action-benchmark@v1
108
+ with:
109
+ tool: 'customBiggerIsBetter'
110
+ output-file-path: benchmarks/results/benchmark_output.json
111
+ gh-pages-branch: gh-pages
112
+ benchmark-data-dir-path: dev/bench
113
+ auto-push: false
114
+ alert-threshold: '95%'
115
+ comment-on-alert: true
116
+ fail-on-alert: true
117
+
118
+ - name: Upload results artifact
119
+ uses: actions/upload-artifact@v4
120
+ with:
121
+ name: benchmark-results
122
+ path: benchmarks/results/
@@ -0,0 +1,96 @@
1
+ name: CMake
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main", "python" ]
6
+ paths:
7
+ - 'lib/**'
8
+ - 'src/**'
9
+ - 'tests/**'
10
+ - 'CMakeLists.txt'
11
+ - '.github/workflows/cmake.yml'
12
+ pull_request:
13
+ branches: [ "main" ]
14
+ paths:
15
+ - 'lib/**'
16
+ - 'src/**'
17
+ - 'tests/**'
18
+ - 'CMakeLists.txt'
19
+ - '.github/workflows/cmake.yml'
20
+
21
+ jobs:
22
+ build:
23
+ name: Build C/C++ on ${{ matrix.os }}
24
+ runs-on: ${{ matrix.os }}
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ os: [ubuntu-latest, macos-latest]
29
+ build_type: [Release, Debug]
30
+
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - name: Install dependencies (Ubuntu)
35
+ if: runner.os == 'Linux'
36
+ run: |
37
+ sudo apt-get update
38
+ sudo apt-get install -y libomp-dev cmake
39
+
40
+ - name: Install dependencies (macOS)
41
+ if: runner.os == 'macOS'
42
+ run: |
43
+ brew install --formula libomp cmake
44
+
45
+ - name: Configure CMake
46
+ run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
47
+
48
+ - name: Build
49
+ run: cmake --build ${{github.workspace}}/build --config ${{ matrix.build_type }} --parallel 2
50
+
51
+ - name: Test
52
+ working-directory: ${{github.workspace}}/build
53
+ run: ctest -C ${{ matrix.build_type }} --output-on-failure
54
+
55
+ - name: Test kalign executable
56
+ run: |
57
+ # Create test input
58
+ echo ">seq1" > test.fasta
59
+ echo "ATCGATCGATCG" >> test.fasta
60
+ echo ">seq2" >> test.fasta
61
+ echo "ATCGTCGATCG" >> test.fasta
62
+ echo ">seq3" >> test.fasta
63
+ echo "ATCGATCATCG" >> test.fasta
64
+
65
+ # Test kalign executable
66
+ ./build/src/kalign -i test.fasta -o test_output.fasta
67
+
68
+ # Verify output exists and is not empty
69
+ if [ -f test_output.fasta ] && [ -s test_output.fasta ]; then
70
+ echo "✓ kalign executable test passed"
71
+ else
72
+ echo "✗ kalign executable test failed"
73
+ exit 1
74
+ fi
75
+
76
+ address-sanitizer:
77
+ name: Address Sanitizer
78
+ runs-on: ubuntu-latest
79
+
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+
83
+ - name: Install dependencies
84
+ run: |
85
+ sudo apt-get update
86
+ sudo apt-get install -y libomp-dev cmake
87
+
88
+ - name: Configure CMake with ASAN
89
+ run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=ASAN
90
+
91
+ - name: Build
92
+ run: cmake --build ${{github.workspace}}/build --config ASAN --parallel 2
93
+
94
+ - name: Test with ASAN
95
+ working-directory: ${{github.workspace}}/build
96
+ run: ctest -C ASAN --output-on-failure
@@ -0,0 +1,62 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [main, python]
6
+ pull_request:
7
+ # The branches below must be a subset of the branches above
8
+ branches: [main, python]
9
+ schedule:
10
+ - cron: '0 2 * * 4'
11
+
12
+ jobs:
13
+ analyze:
14
+ name: Analyze
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ actions: read
18
+ contents: read
19
+ security-events: write
20
+
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ # Override automatic language detection by changing the below list
25
+ # Supported options are ['c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift']
26
+ language: ['c-cpp']
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+
32
+ # Initializes the CodeQL tools for scanning.
33
+ - name: Initialize CodeQL
34
+ uses: github/codeql-action/init@v3
35
+ with:
36
+ languages: ${{ matrix.language }}
37
+ # If you wish to specify custom queries, you can do so here or in a config file.
38
+ # By default, queries listed here will override any specified in a config file.
39
+ # Prefix the list here with "+" to use these queries and those in the config file.
40
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
41
+
42
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
43
+ # If this step fails, then you should remove it and run the build manually (see below)
44
+ - name: Autobuild
45
+ uses: github/codeql-action/autobuild@v3
46
+
47
+ # ℹ️ Command-line programs to run using the OS shell.
48
+ # 📚 https://git.io/JvXDl
49
+
50
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
51
+ # and modify them (or add more) to build your code if your project
52
+ # uses a compiled language
53
+
54
+ #- run: |
55
+ # mkdir build && cd build
56
+ # cmake ..
57
+ # make
58
+
59
+ - name: Perform CodeQL Analysis
60
+ uses: github/codeql-action/analyze@v3
61
+ with:
62
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,152 @@
1
+ name: Python
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, python ]
6
+ paths:
7
+ - 'python-kalign/**'
8
+ - 'lib/**'
9
+ - 'CMakeLists.txt'
10
+ - 'pyproject.toml'
11
+ - '.github/workflows/python.yml'
12
+ pull_request:
13
+ branches: [ main ]
14
+ paths:
15
+ - 'python-kalign/**'
16
+ - 'lib/**'
17
+ - 'CMakeLists.txt'
18
+ - 'pyproject.toml'
19
+ - '.github/workflows/python.yml'
20
+ workflow_dispatch:
21
+
22
+ jobs:
23
+ lint:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: '3.11'
32
+
33
+ - name: Install dependencies
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install flake8 black isort mypy
37
+
38
+ - name: Lint with flake8
39
+ run: |
40
+ flake8 python-kalign --count --select=E9,F63,F7,F82 --show-source --statistics
41
+ flake8 python-kalign --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
42
+
43
+ - name: Check formatting with black
44
+ run: |
45
+ black --check --diff python-kalign/
46
+
47
+ - name: Check import sorting with isort
48
+ run: |
49
+ isort --check-only --diff python-kalign/
50
+
51
+ test:
52
+ runs-on: ${{ matrix.os }}
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ os: [ubuntu-latest, macos-latest]
57
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
58
+
59
+ steps:
60
+ - uses: actions/checkout@v4
61
+
62
+ - name: Set up Python ${{ matrix.python-version }}
63
+ uses: actions/setup-python@v5
64
+ with:
65
+ python-version: ${{ matrix.python-version }}
66
+
67
+ - name: Install system dependencies (Ubuntu)
68
+ if: runner.os == 'Linux'
69
+ run: |
70
+ sudo apt-get update
71
+ sudo apt-get install -y libomp-dev cmake
72
+
73
+ - name: Install system dependencies (macOS)
74
+ if: runner.os == 'macOS'
75
+ run: |
76
+ brew install libomp cmake
77
+
78
+ - name: Install Python dependencies
79
+ run: |
80
+ python -m pip install --upgrade pip
81
+ python -m pip install pytest pytest-cov pytest-benchmark numpy
82
+
83
+ - name: Build and install package
84
+ run: |
85
+ python -m pip install -e .
86
+
87
+ - name: Test with pytest
88
+ run: |
89
+ pytest tests/python/ -v --cov=kalign --cov-report=xml --cov-report=term-missing
90
+
91
+ - name: Upload coverage to Codecov
92
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
93
+ uses: codecov/codecov-action@v4
94
+ with:
95
+ file: coverage.xml
96
+ flags: python
97
+ name: codecov-umbrella
98
+
99
+ build-test:
100
+ name: Build and test package
101
+ runs-on: ${{ matrix.os }}
102
+ strategy:
103
+ fail-fast: false
104
+ matrix:
105
+ os: [ubuntu-latest, macos-latest]
106
+
107
+ steps:
108
+ - uses: actions/checkout@v4
109
+
110
+ - name: Set up Python
111
+ uses: actions/setup-python@v5
112
+ with:
113
+ python-version: '3.11'
114
+
115
+ - name: Install system dependencies (Ubuntu)
116
+ if: runner.os == 'Linux'
117
+ run: |
118
+ sudo apt-get update
119
+ sudo apt-get install -y libomp-dev cmake
120
+
121
+ - name: Install system dependencies (macOS)
122
+ if: runner.os == 'macOS'
123
+ run: |
124
+ brew install libomp cmake
125
+
126
+ - name: Install build dependencies
127
+ run: |
128
+ python -m pip install --upgrade pip
129
+ python -m pip install build twine
130
+
131
+ - name: Build package
132
+ run: |
133
+ python -m build
134
+
135
+ - name: Check package
136
+ run: |
137
+ twine check dist/*
138
+
139
+ - name: Test installation from wheel
140
+ run: |
141
+ python -m pip install dist/*.whl
142
+ python -c "import kalign; print(f'kalign {kalign.__version__} installed successfully')"
143
+
144
+ - name: Test basic functionality
145
+ run: |
146
+ python -c "
147
+ import kalign
148
+ sequences = ['ATCGATCG', 'ATCGTCG', 'ATCGATCG']
149
+ aligned = kalign.align(sequences, seq_type='dna')
150
+ assert len(aligned) == 3
151
+ print('✓ Basic alignment test passed')
152
+ "
@@ -0,0 +1,265 @@
1
+ name: Build Python Wheels
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, python ]
6
+ tags:
7
+ - 'v*'
8
+ pull_request:
9
+ branches: [ main ]
10
+ paths:
11
+ - 'python-kalign/**'
12
+ - 'lib/**'
13
+ - 'CMakeLists.txt'
14
+ - 'pyproject.toml'
15
+ - '.github/workflows/wheels.yml'
16
+ workflow_dispatch:
17
+ inputs:
18
+ publish_target:
19
+ description: "Publish target (manual runs only)"
20
+ required: true
21
+ default: "none"
22
+ type: choice
23
+ options:
24
+ - none
25
+ - testpypi
26
+
27
+ jobs:
28
+ build_wheels:
29
+ name: Build wheels on ${{ matrix.os }} (${{ matrix.cibw_archs }})
30
+ runs-on: ${{ matrix.os }}
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ include:
35
+ - os: ubuntu-latest
36
+ cibw_archs: "x86_64"
37
+ - os: macos-14
38
+ cibw_archs: "x86_64"
39
+ - os: macos-14
40
+ cibw_archs: "arm64"
41
+
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ with:
45
+ submodules: recursive
46
+
47
+ - name: Set up Python
48
+ uses: actions/setup-python@v5
49
+ with:
50
+ python-version: '3.11'
51
+
52
+ - name: Install dependencies
53
+ run: |
54
+ python -m pip install --upgrade pip
55
+ python -m pip install cibuildwheel build
56
+
57
+ - name: Build wheels
58
+ env:
59
+ CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
60
+ CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
61
+ CIBW_ARCHS: ${{ matrix.cibw_archs }}
62
+ # Set minimum macOS version to match OpenMP requirements
63
+ CIBW_ENVIRONMENT_MACOS: >
64
+ CMAKE_BUILD_PARALLEL_LEVEL=2
65
+ OMP_NUM_THREADS=1
66
+ MACOSX_DEPLOYMENT_TARGET=14.0
67
+ CMAKE_OSX_DEPLOYMENT_TARGET=14.0
68
+
69
+ # Linux specific settings - handle different package managers
70
+ CIBW_BEFORE_ALL_LINUX: >
71
+ (yum install -y cmake3) ||
72
+ (apt-get update && apt-get install -y cmake) ||
73
+ (apk add --no-cache cmake)
74
+ CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
75
+
76
+ # macOS specific settings
77
+ CIBW_BEFORE_ALL_MACOS: |
78
+ brew install --formula cmake libomp || echo "Dependencies may already be installed"
79
+ CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
80
+ delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
81
+
82
+ # Environment variables for builds
83
+ CIBW_ENVIRONMENT: >
84
+ CMAKE_BUILD_PARALLEL_LEVEL=2
85
+ OMP_NUM_THREADS=1
86
+
87
+ # Skip testing during wheel build to avoid cross-compilation issues
88
+ CIBW_TEST_SKIP: "*"
89
+
90
+ run: |
91
+ python -m cibuildwheel --output-dir wheelhouse
92
+
93
+ - name: Upload wheels
94
+ uses: actions/upload-artifact@v4
95
+ with:
96
+ name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
97
+ path: wheelhouse/*.whl
98
+
99
+ build_sdist:
100
+ name: Build source distribution
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ with:
105
+ submodules: recursive
106
+
107
+ - name: Set up Python
108
+ uses: actions/setup-python@v5
109
+ with:
110
+ python-version: '3.11'
111
+
112
+ - name: Install dependencies
113
+ run: |
114
+ python -m pip install --upgrade pip
115
+ python -m pip install build
116
+
117
+ - name: Build sdist
118
+ run: |
119
+ python -m build --sdist --outdir dist/
120
+
121
+ - name: Upload sdist
122
+ uses: actions/upload-artifact@v4
123
+ with:
124
+ name: cibw-sdist
125
+ path: dist/*.tar.gz
126
+
127
+ test_install:
128
+ name: Test wheel installation
129
+ needs: [build_wheels]
130
+ runs-on: ${{ matrix.os }}
131
+ strategy:
132
+ fail-fast: false
133
+ matrix:
134
+ os: [ubuntu-latest, macos-14]
135
+ python-version: ['3.9', '3.10', '3.11', '3.12']
136
+
137
+ steps:
138
+ - name: Set up Python ${{ matrix.python-version }}
139
+ uses: actions/setup-python@v5
140
+ with:
141
+ python-version: ${{ matrix.python-version }}
142
+
143
+ - name: Download wheels
144
+ uses: actions/download-artifact@v4
145
+ with:
146
+ pattern: cibw-wheels-*
147
+ merge-multiple: true
148
+ path: wheelhouse/
149
+
150
+ - name: Test installation and import
151
+ run: |
152
+ # Let pip find and install the appropriate wheel
153
+ echo "=== Available wheels ==="
154
+ ls -la wheelhouse/*.whl
155
+
156
+ # Determine the distribution name from the wheel filenames (PEP 427)
157
+ # e.g. kalign_test-3.4.5-...whl -> kalign-test
158
+ DIST_NAME="$(ls wheelhouse/*.whl | head -n 1 | xargs basename | cut -d- -f1 | tr '_' '-')"
159
+ echo "=== Detected dist name: ${DIST_NAME} ==="
160
+
161
+ echo "=== Installing wheel ==="
162
+ pip install --find-links wheelhouse/ "${DIST_NAME}" --force-reinstall
163
+
164
+ # Check what got installed
165
+ echo "=== Checking installed packages ==="
166
+ pip list | grep -E 'kalign' || true
167
+
168
+ # Check the kalign module structure
169
+ echo "=== Checking kalign module ==="
170
+ python -c "
171
+ import sys
172
+ print('Python version:', sys.version)
173
+ print('Attempting to import kalign...')
174
+ try:
175
+ import kalign
176
+ print('✓ kalign imported successfully')
177
+ print('kalign location:', kalign.__file__)
178
+ import os
179
+ kalign_dir = os.path.dirname(kalign.__file__)
180
+ print('kalign dir contents:', sorted(os.listdir(kalign_dir)))
181
+
182
+ # Check for _core specifically
183
+ core_files = [f for f in os.listdir(kalign_dir) if '_core' in f]
184
+ print('_core files found:', core_files)
185
+ except ImportError as e:
186
+ print('✗ Import failed:', str(e))
187
+ import os
188
+ import site
189
+ print('Site packages:', site.getsitepackages())
190
+ for site_dir in site.getsitepackages():
191
+ kalign_path = os.path.join(site_dir, 'kalign')
192
+ if os.path.exists(kalign_path):
193
+ print(f'Found kalign at {kalign_path}')
194
+ print('Contents:', sorted(os.listdir(kalign_path)))
195
+ break
196
+ sys.exit(1)
197
+ "
198
+
199
+ # Test the installation
200
+ python -c "
201
+ import kalign
202
+ print('kalign version:', kalign.__version__)
203
+
204
+ # Test basic functionality
205
+ sequences = ['ATCGATCG', 'ATCGTCG', 'ATCGATCG']
206
+ aligned = kalign.align(sequences, seq_type='dna')
207
+ print('Number of aligned sequences:', len(aligned))
208
+ print('Alignment lengths:', [len(seq) for seq in aligned])
209
+ assert len(aligned) == 3
210
+ assert all(len(seq) == len(aligned[0]) for seq in aligned)
211
+ print('✓ Basic alignment test passed')
212
+
213
+ # Test with different sequence types
214
+ protein_seqs = ['MKTAYIAKQRQ', 'MKTAYIAKQ', 'MKTAYIAK']
215
+ aligned_proteins = kalign.align(protein_seqs, seq_type='protein')
216
+ print('✓ Protein alignment test passed')
217
+
218
+ print('All tests passed successfully!')
219
+ "
220
+
221
+ upload_pypi:
222
+ name: Upload to PyPI
223
+ needs: [build_wheels, build_sdist, test_install]
224
+ runs-on: ubuntu-latest
225
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
226
+ permissions:
227
+ id-token: write
228
+ environment:
229
+ name: pypi
230
+
231
+ steps:
232
+ - name: Download all artifacts
233
+ uses: actions/download-artifact@v4
234
+ with:
235
+ pattern: cibw-*
236
+ merge-multiple: true
237
+ path: dist/
238
+
239
+ - name: Publish to PyPI (trusted publishing)
240
+ uses: pypa/gh-action-pypi-publish@release/v1
241
+ with:
242
+ packages_dir: dist/
243
+
244
+ upload_testpypi:
245
+ name: Upload to TestPyPI
246
+ needs: [build_wheels, build_sdist, test_install]
247
+ runs-on: ubuntu-latest
248
+ if: github.event_name == 'workflow_dispatch' && inputs.publish_target == 'testpypi'
249
+
250
+ steps:
251
+ - name: Download all artifacts
252
+ uses: actions/download-artifact@v4
253
+ with:
254
+ pattern: cibw-*
255
+ merge-multiple: true
256
+ path: dist/
257
+
258
+ - name: Publish to TestPyPI (API token)
259
+ uses: pypa/gh-action-pypi-publish@release/v1
260
+ with:
261
+ user: __token__
262
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
263
+ packages_dir: dist/
264
+ repository-url: https://test.pypi.org/legacy/
265
+ verbose: true