[med-svn] [Git][med-team/cyvcf2][upstream] New upstream version 0.30.22
Nilesh Patra (@nilesh)
gitlab at salsa.debian.org
Sat May 27 07:22:35 BST 2023
Nilesh Patra pushed to branch upstream at Debian Med / cyvcf2
Commits:
d029a8c5 by Nilesh Patra at 2023-05-27T11:21:31+05:30
New upstream version 0.30.22
- - - - -
12 changed files:
- − .github/workflows/build.yml
- − .github/workflows/wheels.yml
- CHANGES.md
- README.md
- ci/linux-deps
- ci/osx-arm64-deps
- ci/osx-deps
- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pyx
- + cyvcf2/tests/test-no-genotypes.vcf
- cyvcf2/tests/test_reader.py
- setup.py
Changes:
=====================================
.github/workflows/build.yml deleted
=====================================
@@ -1,36 +0,0 @@
-name: Build
-
-on: [push, pull_request]
-
-jobs:
- build:
- name: Run tests on Python ${{ matrix.python-version }}
- runs-on: ubuntu-18.04
- strategy:
- matrix:
- python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
-
- steps:
- - uses: actions/checkout at v2
- with:
- submodules: true
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python at v2
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install
- run: |
- sudo apt-get update
- sudo apt-get install libcurl4-openssl-dev
- pip install -r requirements.txt
- pip install pytest pytest-cov
- cd htslib
- autoheader && autoconf
- ./configure --enable-s3 --disable-lzma --disable-bz2
- make
- cd ..
- CYTHONIZE=1 python setup.py build_ext -i
- - name: Test
- run: |
- pytest --cov cyvcf2 --cov-report term-missing
-
=====================================
.github/workflows/wheels.yml deleted
=====================================
@@ -1,144 +0,0 @@
-name: Wheels
-
-on:
- push:
- branches:
- - main
- tags:
- - 'v*.*.*'
- workflow_dispatch:
- inputs:
- debug_enabled:
- description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
- required: false
- default: false
-
-jobs:
- build_wheels:
- name: Build wheels on ${{ matrix.os }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-18.04, macos-latest]
-
- steps:
- - uses: actions/checkout at v2
- with:
- submodules: true
- - uses: actions/setup-python at v2
- name: Install Python
- with:
- python-version: "3.7"
-
- - name: Install cibuildwheel
- run: |
- python -m pip install -U cibuildwheel
-
- - name: Build wheels for Linux
- if: matrix.os == 'ubuntu-18.04'
- run: |
- python -m cibuildwheel --output-dir wheelhouse
- env:
- CIBW_SKIP: "pp* *i686* *musllinux*"
- CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
- CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
- CIBW_TEST_COMMAND: "{project}/ci/test"
- CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 LDFLAGS='-L/usr/lib64/openssl11' CPPFLAGS='-I/usr/include/openssl11' C_INCLUDE_PATH='/root/include' LIBRARY_PATH='/root/lib'"
- CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH='/root/lib' auditwheel repair -w {dest_dir} {wheel}
-
- - name: Build wheels for Mac OS x86
- if: matrix.os == 'macos-latest'
- run: |
- python -m cibuildwheel --output-dir wheelhouse
- env:
- CIBW_SKIP: "pp* *i686*"
- CIBW_ARCHS_MACOS: "x86_64"
- CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
- CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
- CIBW_TEST_COMMAND: "{project}/ci/test"
- CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
- # https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
- CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
- DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
- DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
- LDFLAGS: "-L/usr/local/opt/openssl at 1.1/lib"
- CPPFLAGS: "-I/usr/local/opt/openssl at 1.1/include"
- PKG_CONFIG_PATH: "/usr/local/opt/openssl at 1.1/lib/pkgconfig"
-
- - name: Build wheels for Mac OS arm64
- # don't build with libdeflate, see https://github.com/brentp/cyvcf2/issues/252
- if: matrix.os == 'macos-latest'
- run: |
- python -m cibuildwheel --output-dir wheelhouse
- env:
- CIBW_SKIP: "pp* *i686*"
- CIBW_ARCHS_MACOS: "arm64"
- CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
- CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-arm64-deps"
- CIBW_TEST_COMMAND: "{project}/ci/test"
- CIBW_TEST_SKIP: "*-macosx_arm64"
- CIBW_ENVIRONMENT: "CYTHONIZE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
- # https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
- CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
- DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
- DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
- LDFLAGS: "-L/usr/local/opt/openssl at 1.1/lib"
- CPPFLAGS: "-I/usr/local/opt/openssl at 1.1/include"
- PKG_CONFIG_PATH: "/usr/local/opt/openssl at 1.1/lib/pkgconfig"
-
- # Enable tmate debugging of manually-triggered workflows if the input option was provided
- - name: Setup tmate session
- if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- uses: mxschmitt/action-tmate at v3
-
- - uses: actions/upload-artifact at v2
- with:
- path: ./wheelhouse/*.whl
-
- build_sdist:
- name: Build source distribution
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout at v2
-
- - uses: actions/setup-python at v2
- name: Install Python
- with:
- python-version: "3.7"
-
- - name: Install dependencies
- run: |
- sudo apt-get update
- sudo apt-get install libcurl4-openssl-dev libbz2-dev liblzma-dev libssl-dev
- git submodule init
- git submodule update
- cd htslib
- autoheader
- autoconf
- ./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2
- make
- cd ..
- pip install -r requirements.txt
-
- - name: Build sdist
- run: CYTHONIZE=1 python setup.py sdist
-
- - uses: actions/upload-artifact at v2
- with:
- path: dist/*.tar.gz
-
- upload_pypi:
- needs: [build_wheels, build_sdist]
- runs-on: ubuntu-latest
- # upload to PyPI on every tag starting with 'v'
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
- steps:
- - uses: actions/download-artifact at v2
- with:
- name: artifact
- path: dist
-
- - uses: pypa/gh-action-pypi-publish at release/v1
- with:
- user: __token__
- password: ${{ secrets.PYPI_API_TOKEN }}
=====================================
CHANGES.md
=====================================
@@ -1,3 +1,6 @@
+# v0.30.19
++ raise exception (instead of segfault) when calling num_called, etc. on variant without genotypes (#262 from @davmlaw)
+
# v0.30.15
+ fix num_unknown when gts012=True (#236)
=====================================
README.md
=====================================
@@ -18,7 +18,7 @@ Fast python **(2 and 3)** parsing of VCF and BCF including region-queries.
cyvcf2 is a cython wrapper around [htslib](https://github.com/samtools/htslib) built for fast parsing of [Variant Call Format](https://en.m.wikipedia.org/wiki/Variant_Call_Format) (VCF) files.
-Attributes like `variant.gt_ref_depths` return a numpy array directly so they are immediately ready for downstream use.
+Attributes like `variant.gt_ref_depths` work for diploid samples and return a numpy array directly so they are immediately ready for downstream use.
**note** that the array is backed by the underlying C data, so, once `variant` goes out of scope. The array will contain nonsense.
To persist a copy, use: `cpy = np.array(variant.gt_ref_depths)` instead of just `arr = variant.gt_ref_depths`.
=====================================
ci/linux-deps
=====================================
@@ -8,6 +8,7 @@ yum install -y bzip2-devel bzip2-libs xz-devel xz-libs
git submodule init
git submodule update
+git submodule update --init --recursive
curl -O https://www.libssh2.org/download/libssh2-1.9.0.tar.gz
tar xzf libssh2-1.9.0.tar.gz
=====================================
ci/osx-arm64-deps
=====================================
@@ -4,6 +4,7 @@ set -e
git submodule init
git submodule update
+git submodule update --init --recursive
# configure fails with autoconf 2.71, so downgrade
# see https://github.com/asdf-vm/asdf-erlang/issues/195
=====================================
ci/osx-deps
=====================================
@@ -4,6 +4,7 @@ set -e
git submodule init
git submodule update
+git submodule update --init --recursive
# configure fails with autoconf 2.71, so downgrade
# see https://github.com/asdf-vm/asdf-erlang/issues/195
=====================================
cyvcf2/__init__.py
=====================================
@@ -2,4 +2,4 @@ from .cyvcf2 import (VCF, Variant, Writer, r_ as r_unphased, par_relatedness,
par_het)
Reader = VCFReader = VCF
-__version__ = "0.30.18"
+__version__ = "0.30.22"
=====================================
cyvcf2/cyvcf2.pyx
=====================================
@@ -606,6 +606,7 @@ cdef class VCF(HTSFile):
return from_bytes(s.s)
property seqlens:
+ "list of chromosome lengths, if defined in the VCF header"
def __get__(self):
if len(self._seqlens) > 0: return self._seqlens
cdef int32_t nseq;
@@ -1082,6 +1083,8 @@ cdef class Variant(object):
INFO: `INFO`
a dictionary-like field that provides access to the VCF INFO field.
+ POS: the 1-based variant start.
+
"""
cdef bcf1_t *b
cdef VCF vcf
@@ -1491,6 +1494,8 @@ cdef class Variant(object):
if self._gt_types == NULL:
self._gt_phased = <int *>stdlib.malloc(sizeof(int) * self.vcf.n_samples)
ngts = bcf_get_genotypes(self.vcf.hdr, self.b, &self._gt_types, &ndst)
+ if ngts < 0:
+ raise Exception("error parsing genotypes; they may be absent from this record")
nper = int(ngts / self.vcf.n_samples)
self._ploidy = nper
self._gt_idxs = <int *>stdlib.malloc(sizeof(int) * self.vcf.n_samples * nper)
@@ -1611,7 +1616,7 @@ cdef class Variant(object):
return gls
property gt_ref_depths:
- """get the count of reference reads as a numpy array."""
+ """get the count of reference reads for a diploid sample as a numpy array."""
def __get__(self):
cdef int ndst, nret = 0, n, i, j = 0, nper = 0
if self.vcf.n_samples == 0:
@@ -1652,7 +1657,7 @@ cdef class Variant(object):
return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INT32, self._gt_ref_depths)
property gt_alt_depths:
- """get the count of alternate reads as a numpy array."""
+ """get the count of alternate reads for a diploid sample as a numpy array."""
def __get__(self):
cdef int ndst, nret = 0, n, i, j = 0, k = 0, nper = 0
if self.vcf.n_samples == 0:
@@ -1700,7 +1705,7 @@ cdef class Variant(object):
return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INT32, self._gt_alt_depths)
property gt_alt_freqs:
- """get the freq of alternate reads as a numpy array."""
+ """get the freq of alternate reads for a diploid sample as a numpy array."""
def __get__(self):
if self.vcf.n_samples == 0:
return []
@@ -1754,7 +1759,7 @@ cdef class Variant(object):
return a
property gt_depths:
- """get the read-depth for each sample as a numpy array."""
+ """get the read-depth for diploid samples as a numpy array."""
def __get__(self):
if self.vcf.n_samples == 0:
return []
=====================================
cyvcf2/tests/test-no-genotypes.vcf
=====================================
@@ -0,0 +1,6 @@
+##fileformat=VCFv4.1
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification">
+##contig=<ID=1,length=249250621,assembly=b37>
+#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT samplea sampleb
+1 8466747 . A T . PASS . PL . 36,0
=====================================
cyvcf2/tests/test_reader.py
=====================================
@@ -1316,3 +1316,10 @@ def test_issue236():
assert res[0] == res[1]
assert len(res[0]) > 0
+
+
+def test_issue17_no_gt():
+ vcf = VCF(os.path.join(HERE, "test-no-genotypes.vcf"))
+ with pytest.raises(Exception):
+ for v in vcf:
+ v.num_called # Used to give segmentation fault
=====================================
setup.py
=====================================
@@ -44,10 +44,11 @@ def no_cythonize(extensions, **_ignore):
# Build the Cython extension by statically linking to the bundled htslib
sources = [
- x for x in glob.glob('htslib/*.c')
+ x for x in glob.glob('htslib/*.c')
if not any(e in x for e in ['irods', 'plugin'])
]
sources += glob.glob('htslib/cram/*.c')
+sources += glob.glob('htslib/htscodecs/htscodecs/*.c')
# Exclude the htslib sources containing main()'s
sources = [x for x in sources if not x.endswith(('htsfile.c', 'tabix.c', 'bgzip.c'))]
sources.append('cyvcf2/helpers.c')
@@ -100,6 +101,7 @@ setup(
'cyvcf2 = cyvcf2.__main__:cli',
],
),
+ python_requires=">=3.7",
install_requires=['numpy', 'coloredlogs', 'click'],
include_package_data=True,
zip_safe=False,
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/d029a8c55e15bc4dccc5baa7681c8307a35303f5
--
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/d029a8c55e15bc4dccc5baa7681c8307a35303f5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230527/d3c1494a/attachment-0001.htm>
More information about the debian-med-commit
mailing list