vcztools 0.0.1a3__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 (65) hide show
  1. vcztools-0.0.1a3/.clang-format +21 -0
  2. vcztools-0.0.1a3/.github/workflows/cd.yml +97 -0
  3. vcztools-0.0.1a3/.github/workflows/ci.yml +202 -0
  4. vcztools-0.0.1a3/.github/workflows/docker/buildwheel.sh +30 -0
  5. vcztools-0.0.1a3/.github/workflows/docker/shared.env +6 -0
  6. vcztools-0.0.1a3/.gitignore +166 -0
  7. vcztools-0.0.1a3/.pre-commit-config.yaml +15 -0
  8. vcztools-0.0.1a3/LICENSE +201 -0
  9. vcztools-0.0.1a3/MANIFEST.in +1 -0
  10. vcztools-0.0.1a3/Makefile +10 -0
  11. vcztools-0.0.1a3/PKG-INFO +304 -0
  12. vcztools-0.0.1a3/README.md +67 -0
  13. vcztools-0.0.1a3/dev.py +162 -0
  14. vcztools-0.0.1a3/lib/meson.build +25 -0
  15. vcztools-0.0.1a3/lib/tests.c +978 -0
  16. vcztools-0.0.1a3/lib/vcf_encoder.c +1000 -0
  17. vcztools-0.0.1a3/lib/vcf_encoder.h +111 -0
  18. vcztools-0.0.1a3/performance/compare.py +49 -0
  19. vcztools-0.0.1a3/performance/data/.gitignore +3 -0
  20. vcztools-0.0.1a3/performance/data/Makefile +47 -0
  21. vcztools-0.0.1a3/performance/data/requirements.txt +3 -0
  22. vcztools-0.0.1a3/pyproject.toml +97 -0
  23. vcztools-0.0.1a3/setup.cfg +4 -0
  24. vcztools-0.0.1a3/setup.py +14 -0
  25. vcztools-0.0.1a3/tests/__init__.py +4 -0
  26. vcztools-0.0.1a3/tests/data/txt/samples.txt +2 -0
  27. vcztools-0.0.1a3/tests/data/vcf/1kg_2020_chr20_annotations.bcf +0 -0
  28. vcztools-0.0.1a3/tests/data/vcf/1kg_2020_chr20_annotations.bcf.csi +0 -0
  29. vcztools-0.0.1a3/tests/data/vcf/1kg_2020_chrM.vcf.gz +0 -0
  30. vcztools-0.0.1a3/tests/data/vcf/1kg_2020_chrM.vcf.gz.csi +0 -0
  31. vcztools-0.0.1a3/tests/data/vcf/chr22.vcf.gz +0 -0
  32. vcztools-0.0.1a3/tests/data/vcf/chr22.vcf.gz.csi +0 -0
  33. vcztools-0.0.1a3/tests/data/vcf/field_type_combos.vcf.gz +0 -0
  34. vcztools-0.0.1a3/tests/data/vcf/field_type_combos.vcf.gz.csi +0 -0
  35. vcztools-0.0.1a3/tests/data/vcf/sample.vcf.gz +0 -0
  36. vcztools-0.0.1a3/tests/data/vcf/sample.vcf.gz.csi +0 -0
  37. vcztools-0.0.1a3/tests/test_bcftools_validation.py +149 -0
  38. vcztools-0.0.1a3/tests/test_cli.py +183 -0
  39. vcztools-0.0.1a3/tests/test_cpython_interface.py +455 -0
  40. vcztools-0.0.1a3/tests/test_filter.py +136 -0
  41. vcztools-0.0.1a3/tests/test_query.py +168 -0
  42. vcztools-0.0.1a3/tests/test_regions.py +20 -0
  43. vcztools-0.0.1a3/tests/test_stats.py +49 -0
  44. vcztools-0.0.1a3/tests/test_utils.py +44 -0
  45. vcztools-0.0.1a3/tests/test_vcf_roundtrip.py +25 -0
  46. vcztools-0.0.1a3/tests/test_vcf_writer.py +347 -0
  47. vcztools-0.0.1a3/tests/utils.py +153 -0
  48. vcztools-0.0.1a3/vcztools/__init__.py +0 -0
  49. vcztools-0.0.1a3/vcztools/__main__.py +4 -0
  50. vcztools-0.0.1a3/vcztools/_vcztoolsmodule.c +600 -0
  51. vcztools-0.0.1a3/vcztools/_version.py +16 -0
  52. vcztools-0.0.1a3/vcztools/cli.py +242 -0
  53. vcztools-0.0.1a3/vcztools/constants.py +32 -0
  54. vcztools-0.0.1a3/vcztools/filter.py +180 -0
  55. vcztools-0.0.1a3/vcztools/query.py +345 -0
  56. vcztools-0.0.1a3/vcztools/regions.py +181 -0
  57. vcztools-0.0.1a3/vcztools/stats.py +44 -0
  58. vcztools-0.0.1a3/vcztools/utils.py +53 -0
  59. vcztools-0.0.1a3/vcztools/vcf_writer.py +645 -0
  60. vcztools-0.0.1a3/vcztools.egg-info/PKG-INFO +304 -0
  61. vcztools-0.0.1a3/vcztools.egg-info/SOURCES.txt +63 -0
  62. vcztools-0.0.1a3/vcztools.egg-info/dependency_links.txt +1 -0
  63. vcztools-0.0.1a3/vcztools.egg-info/entry_points.txt +2 -0
  64. vcztools-0.0.1a3/vcztools.egg-info/requires.txt +12 -0
  65. vcztools-0.0.1a3/vcztools.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ Language: Cpp
2
+ BasedOnStyle: GNU
3
+ SortIncludes: false
4
+ AllowShortIfStatementsOnASingleLine: false
5
+ BreakBeforeBraces: Linux
6
+ TabWidth: 4
7
+ IndentWidth: 4
8
+ ColumnLimit: 89
9
+ SpaceBeforeParens:
10
+ ControlStatements
11
+ SpacesInCStyleCastParentheses: false
12
+ SpaceAfterCStyleCast: true
13
+ IndentCaseLabels: true
14
+ AlignAfterOpenBracket: DontAlign
15
+ BinPackArguments: true
16
+ BinPackParameters: true
17
+ AlwaysBreakAfterReturnType: AllDefinitions
18
+
19
+ # These are disabled for version 6 compatibility
20
+ # StatementMacros: ["PyObject_HEAD"]
21
+ # AlignConsecutiveMacros: true
@@ -0,0 +1,97 @@
1
+ name: CD
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ tags:
9
+ - '*'
10
+ release:
11
+ types: [published]
12
+
13
+ jobs:
14
+ packaging:
15
+ if: github.repository_owner == 'sgkit-dev'
16
+ name: Packaging
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.11'
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip build validate-pyproject[all]
26
+ python -m build --sdist
27
+ - name: Upload sdist
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: sdist
31
+ path: dist
32
+ - name: Build wheels
33
+ run: |
34
+ validate-pyproject pyproject.toml
35
+ docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash .github/workflows/docker/buildwheel.sh
36
+ - name: Check vcztools CLI
37
+ run: |
38
+ pip install numpy "zarr>=2.17,<3" click pyranges pyparsing
39
+ pip install vcztools --no-index --only-binary vcztools -f dist/wheelhouse
40
+ vcztools --help
41
+ # Make sure we don't have ``vcztools`` in the CWD
42
+ cd tests
43
+ python -m vcztools --help
44
+ - name: Store the distribution packages
45
+ uses: actions/upload-artifact@v4
46
+ with:
47
+ name: linux-wheels
48
+ path: dist/wheelhouse
49
+
50
+ publish-to-pypi:
51
+ if: github.repository_owner == 'sgkit-dev' && github.event_name == 'release'
52
+ needs:
53
+ - packaging
54
+ runs-on: ubuntu-latest
55
+
56
+ environment:
57
+ name: pypi
58
+ url: https://pypi.org/p/vcztools
59
+ permissions:
60
+ id-token: write # IMPORTANT: mandatory for trusted publishing
61
+
62
+ steps:
63
+ - name: Download all
64
+ uses: actions/download-artifact@v4.1.8
65
+ - name: Move to dist
66
+ run: |
67
+ mkdir dist
68
+ cp */*.{whl,gz} dist/.
69
+ ls dist
70
+ - uses: pypa/gh-action-pypi-publish@release/v1
71
+
72
+
73
+ publish-to-testpypi:
74
+ if: github.repository_owner == 'sgkit-dev' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
75
+ needs:
76
+ - packaging
77
+ runs-on: ubuntu-latest
78
+
79
+ environment:
80
+ name: testpypi
81
+ url: https://test.pypi.org/p/vcztools
82
+
83
+ permissions:
84
+ id-token: write # IMPORTANT: mandatory for trusted publishing
85
+
86
+ steps:
87
+ - name: Download all
88
+ uses: actions/download-artifact@v4.1.8
89
+ - name: Move to dist
90
+ run: |
91
+ mkdir dist
92
+ cp */*.{whl,gz} dist/.
93
+ ls dist
94
+ - uses: pypa/gh-action-pypi-publish@release/v1
95
+ with:
96
+ verbose: true
97
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,202 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ pre-commit:
11
+ name: Lint
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.11'
18
+ - uses: pre-commit/action@v3.0.1
19
+ python_test:
20
+ name: Python tests
21
+ runs-on: ${{ matrix.os }}
22
+ defaults:
23
+ run:
24
+ shell: bash -el {0}
25
+ strategy:
26
+ matrix:
27
+ # Use macos-13 because pip binary packages for ARM aren't
28
+ # available for many dependencies
29
+ os: [macos-13, macos-14, ubuntu-latest]
30
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
31
+ exclude:
32
+ # Just run macos tests on one Python version
33
+ - os: macos-13
34
+ python-version: "3.10"
35
+ - os: macos-13
36
+ python-version: "3.11"
37
+ - os: macos-13
38
+ python-version: "3.12"
39
+ - os: macos-14
40
+ python-version: "3.9"
41
+ - os: macos-14
42
+ python-version: "3.10"
43
+ - os: macos-14
44
+ python-version: "3.12"
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - name: Set up Miniconda with Python ${{ matrix.python-version }}
48
+ uses: conda-incubator/setup-miniconda@v3
49
+ with:
50
+ auto-update-conda: true
51
+ python-version: ${{ matrix.python-version }}
52
+ channels: conda-forge,bioconda
53
+ - name: Install dependencies
54
+ run: |
55
+ conda install bcftools
56
+ python -m pip install --upgrade pip
57
+ python -m pip install '.[dev]'
58
+ # Build the extension module in-place so pytest can find it
59
+ python3 setup.py build_ext --inplace
60
+ - name: Run tests
61
+ run: |
62
+ pytest
63
+
64
+ c_python_test:
65
+ name: CPython interface tests
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+ - name: Set up Python
70
+ uses: actions/setup-python@v5
71
+ with:
72
+ python-version: '3.11'
73
+ - name: Install system dependencies
74
+ run: |
75
+ sudo apt install -y gcovr
76
+ - name: Install python dependencies
77
+ run: |
78
+ python -m pip install --upgrade pip
79
+ python -m pip install numpy pytest pytest_cov
80
+ - name: Build module with coverage
81
+ run: |
82
+ # Build the extension module in-place so pytest can find it
83
+ CFLAGS="--coverage" python3 setup.py build_ext --inplace
84
+ - name: Run tests
85
+ run: |
86
+ pytest -vs tests/test_cpython_interface.py
87
+ - name: Show coverage
88
+ run: |
89
+ gcovr --filter vcztools
90
+
91
+ c_test:
92
+ name: C tests
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - name: Install dependencies
97
+ run: |
98
+ sudo apt install -y ninja-build libcunit1-dev valgrind meson gcovr
99
+ - name: Build
100
+ working-directory: ./lib
101
+ run: |
102
+ meson setup -Db_coverage=true build
103
+ - name: Tests
104
+ working-directory: ./lib
105
+ run: |
106
+ ninja -C build test
107
+ - name: Show coverage
108
+ working-directory: ./lib
109
+ run: |
110
+ ninja -C build coverage-text
111
+ cat build/meson-logs/coverage.txt
112
+ - name: Valgrind
113
+ working-directory: ./lib
114
+ run: |
115
+ valgrind --leak-check=full --error-exitcode=1 ./build/tests
116
+
117
+ packaging:
118
+ name: Packaging
119
+ runs-on: ubuntu-latest
120
+ steps:
121
+ - uses: actions/checkout@v4
122
+ - uses: actions/setup-python@v5
123
+ with:
124
+ python-version: '3.11'
125
+ - name: Install dependencies
126
+ run: |
127
+ python -m pip install --upgrade pip
128
+ python -m pip install build twine validate-pyproject[all]
129
+ - name: Check and install package
130
+ run: |
131
+ validate-pyproject pyproject.toml
132
+ python -m build
133
+ python -m twine check --strict dist/*
134
+ python -m pip install dist/*.whl
135
+ - name: Check vcztools CLI
136
+ run: |
137
+ vcztools --help
138
+ # Make sure we don't have ``vcztools`` in the CWD
139
+ cd tests
140
+ python -m vcztools --help
141
+
142
+ test-numpy-version:
143
+ name: Test numpy versions
144
+ runs-on: ubuntu-latest
145
+ defaults:
146
+ run:
147
+ shell: bash -el {0}
148
+ strategy:
149
+ matrix:
150
+ numpy: ["==1.26", ">=2"]
151
+ steps:
152
+ - uses: actions/checkout@v4
153
+ - name: Set up Miniconda
154
+ uses: conda-incubator/setup-miniconda@v3
155
+ with:
156
+ auto-update-conda: true
157
+ python-version: '3.11'
158
+ channels: conda-forge,bioconda
159
+ - name: Install dependencies
160
+ run: |
161
+ conda install bcftools
162
+ python -m pip install --upgrade pip
163
+ python -m pip install '.[dev]'
164
+ # Build the extension module in-place so pytest can find it
165
+ python3 setup.py build_ext --inplace
166
+ - name: Install numpy${{ matrix.numpy }}
167
+ run: |
168
+ python -m pip install 'numpy${{ matrix.numpy }}'
169
+ - name: Run tests
170
+ run: |
171
+ pytest
172
+
173
+ test-zarr-version:
174
+ name: Test Zarr versions
175
+ runs-on: ubuntu-latest
176
+ defaults:
177
+ run:
178
+ shell: bash -el {0}
179
+ strategy:
180
+ matrix:
181
+ zarr: ["==2.18.3", ">=3"]
182
+ steps:
183
+ - uses: actions/checkout@v4
184
+ - name: Set up Miniconda
185
+ uses: conda-incubator/setup-miniconda@v3
186
+ with:
187
+ auto-update-conda: true
188
+ python-version: '3.11'
189
+ channels: conda-forge,bioconda
190
+ - name: Install dependencies
191
+ run: |
192
+ conda install bcftools
193
+ python -m pip install --upgrade pip
194
+ python -m pip install '.[dev]'
195
+ # Build the extension module in-place so pytest can find it
196
+ python3 setup.py build_ext --inplace
197
+ - name: Install zarr${{ matrix.zarr }}
198
+ run: |
199
+ python -m pip install 'zarr${{ matrix.zarr }}'
200
+ - name: Run tests
201
+ run: |
202
+ pytest
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+ DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3
+ source "$DOCKER_DIR/shared.env"
4
+
5
+ set -e -x
6
+
7
+ ARCH=`uname -p`
8
+ echo "arch=$ARCH"
9
+
10
+ # We're running as root in the docker container so git commands issued by
11
+ # setuptools_scm will fail without this:
12
+ git config --global --add safe.directory /project
13
+ # Fetch the full history as we'll be missing tags otherwise.
14
+ git fetch --unshallow
15
+ for V in "${PYTHON_VERSIONS[@]}"; do
16
+ git reset --hard
17
+ git clean -fd
18
+ PYBIN=/opt/python/$V/bin
19
+ rm -rf build/ # Avoid lib build by one Python is used by another
20
+ $PYBIN/python -m venv env
21
+ source env/bin/activate
22
+ $PYBIN/python -m pip install --upgrade build
23
+ SETUPTOOLS_SCM_DEBUG=1 $PYBIN/python -m build
24
+ done
25
+
26
+ cd dist
27
+ for whl in *.whl; do
28
+ auditwheel -v repair "$whl"
29
+ rm "$whl"
30
+ done
@@ -0,0 +1,6 @@
1
+ PYTHON_VERSIONS=(
2
+ cp39-cp39
3
+ cp310-cp310
4
+ cp311-cp311
5
+ cp312-cp312
6
+ )
@@ -0,0 +1,166 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ .idea/
163
+
164
+ .vscode
165
+ vcz_test_cache/
166
+ **/.DS_Store
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: check-merge-conflict
6
+ - id: debug-statements
7
+ - id: mixed-line-ending
8
+ - id: check-case-conflict
9
+ - id: check-yaml
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.4.2
12
+ hooks:
13
+ - id: ruff
14
+ args: [ --fix ]
15
+ - id: ruff-format