[med-svn] [Git][med-team/cyvcf2][master] 4 commits: New upstream version 0.20.7

Nilesh Patra gitlab at salsa.debian.org
Mon Sep 28 18:18:47 BST 2020



Nilesh Patra pushed to branch master at Debian Med / cyvcf2


Commits:
eba05721 by Nilesh Patra at 2020-09-28T22:44:39+05:30
New upstream version 0.20.7
- - - - -
04ad5ee7 by Nilesh Patra at 2020-09-28T22:44:39+05:30
routine-update: New upstream version

- - - - -
ceed2e9c by Nilesh Patra at 2020-09-28T22:44:40+05:30
Update upstream source from tag 'upstream/0.20.7'

Update to upstream version '0.20.7'
with Debian dir e82196999e29b3e2e0c28b7e7380fe15be9ef30c
- - - - -
2b61c2bd by Nilesh Patra at 2020-09-28T22:45:14+05:30
routine-update: Ready to upload to unstable

- - - - -


4 changed files:

- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pyx
- cyvcf2/tests/test_reader.py
- debian/changelog


Changes:

=====================================
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.20.6"
+__version__ = "0.20.7"


=====================================
cyvcf2/cyvcf2.pyx
=====================================
@@ -1029,17 +1029,24 @@ cdef class Genotypes(object):
         array returns an int16 numpy array  of shape n_samples, (ploidy + 1).
         The last column indicates phased (1 is phased, 0 is unphased).
         The other columns indicate the alleles, e.g. [0, 1, 1] is 0|1.
+        Unknown alleles are represented by -1 and mixed-ploidy arrays
+        are padded with -2 to indicate non-alleles.
         """
         cdef np.ndarray[np.int16_t, ndim=2] to_return = np.zeros((self.n_samples, self.ploidy + 1),
                 dtype=np.int16)
 
+        cdef int raw
         cdef int ind
         cdef int allele
         cdef int p = self.ploidy + 1
 
         for ind in range(self.n_samples):
             for allele in range(self.ploidy):
-                to_return[ind, allele] = (self._raw[ind * self.ploidy + allele] >> 1) - 1
+                raw = self._raw[ind * self.ploidy + allele]
+                if raw == bcf_int32_vector_end:
+                    to_return[ind, allele] = -2
+                else:
+                    to_return[ind, allele] = (raw >> 1) - 1
             to_return[ind, self.ploidy] = (self._raw[ind * self.ploidy + 1] & 1) == 1
 
         return to_return


=====================================
cyvcf2/tests/test_reader.py
=====================================
@@ -808,6 +808,38 @@ def test_access_genotype():
     v.genotype = gts
     assert "1/0:6728,1:F	0/1:22,1:G" in str(v)
 
+def test_access_genotype_array():
+    vcf = VCF('{}/test-format-string.vcf'.format(HERE))
+    """
+7	55086956	.	C	G	0	.	.	GT:ADP_ALL:RULE	0/0:6728,1:F	1|1:22,1:G
+7	55086957	.	T	A,C,G	0	.	.	GT:ADP_ALL:RULE	1/2:6768,2,2,1:F2,F3,F4	2|3:1,2,3,4:G2,G3,G4
+7	55086958	.	T	G	0	.	.	GT:ADP_ALL:RULE	0/1/.:6768,2,2,1:F2,F3,F4	0:1,2,3,4:G2,G3,G4
+7	55086959	.	T	G,T	0	.	.	GT:ADP_ALL:RULE	.	0|2:1,2,3,4:G2,G3,G4
+    """
+
+    v = next(vcf)
+    np.testing.assert_array_equal(
+        v.genotype.array(),
+        np.array([[0, 0, 0], [1, 1, 1]], dtype=np.int16)
+    )
+
+    v = next(vcf)
+    np.testing.assert_array_equal(
+        v.genotype.array(),
+        np.array([[1, 2, 0], [2, 3, 1]], dtype=np.int16)
+    )
+
+    v = next(vcf)
+    np.testing.assert_array_equal(
+        v.genotype.array(),
+        np.array([[0, 1, -1, 0], [0, -2, -2, 1]], dtype=np.int16)
+    )
+
+    v = next(vcf)
+    np.testing.assert_array_equal(
+        v.genotype.array(),
+        np.array([[-1, -2, 1], [0, 2, 1]], dtype=np.int16)
+    )
 
 def test_alt_homozygous_gt():
     vcf = VCF(os.path.join(HERE, "test-multiallelic-homozygous-alt.vcf.gz"))


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+cyvcf2 (0.20.7-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream version
+
+ -- Nilesh Patra <npatra974 at gmail.com>  Mon, 28 Sep 2020 22:45:14 +0530
+
 cyvcf2 (0.20.6-1) unstable; urgency=medium
 
   * Team upload.



View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/compare/821fa640498e5928b3d3384339716ae3a74d0c2f...2b61c2bdc6ccdcfd9d089d6198f1bf0f855f31a7

-- 
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/compare/821fa640498e5928b3d3384339716ae3a74d0c2f...2b61c2bdc6ccdcfd9d089d6198f1bf0f855f31a7
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/20200928/3343ea21/attachment-0001.html>


More information about the debian-med-commit mailing list