[med-svn] [Git][med-team/cyvcf2][upstream] New upstream version 0.30.15

Andreas Tille (@tille) gitlab at salsa.debian.org
Mon May 2 11:17:20 BST 2022



Andreas Tille pushed to branch upstream at Debian Med / cyvcf2


Commits:
90ed00e3 by Andreas Tille at 2022-05-02T12:02:51+02:00
New upstream version 0.30.15
- - - - -


4 changed files:

- CHANGES.md
- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pyx
- cyvcf2/tests/test_reader.py


Changes:

=====================================
CHANGES.md
=====================================
@@ -1,3 +1,6 @@
+# v0.30.15
++ fix num_unknown when gts012=True (#236)
+
 # v0.30.14
 + use warnings instead of sys.stderr (#229 from @grahamgower)
 + use libdeflate in wheel build (#231 from @grahamgower)


=====================================
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.14"
+__version__ = "0.30.15"


=====================================
cyvcf2/cyvcf2.pyx
=====================================
@@ -1274,9 +1274,9 @@ cdef class Variant(object):
             if self._gt_types == NULL:
                 self.gt_types
             cdef int n = 0, i = 0
+            cdef int unknown = 3 if self.vcf.gts012 else 2
             for i in range(self.vcf.n_samples):
-                if self._gt_types[i] == 2:
-                    n+=1
+                n += (self._gt_types[i] == unknown)
             return n
 
     property FORMAT:


=====================================
cyvcf2/tests/test_reader.py
=====================================
@@ -1302,3 +1302,17 @@ def test_genotypes():
             a = v.genotype.array()[0] # only 0'th item
             print("i:", i, " a:", v.genotype.array()[0], " exp:", exp_array[i])
             assert (a == exp_array[i]).all(), " error with array"
+
+def test_issue236():
+
+
+    for strict_gt in (False, True):
+        res = [[], []]
+
+        for gts in (False, True):
+            vcf = VCF(os.path.join(HERE, "test-genotypes.vcf"), gts012=gts, strict_gt=strict_gt)
+            for v in vcf:
+                res[int(gts)].append(v.num_unknown)
+
+        assert res[0] == res[1]
+        assert len(res[0]) > 0



View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/90ed00e3b986178d008be642b1ea8ff357e2af1d

-- 
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/90ed00e3b986178d008be642b1ea8ff357e2af1d
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/20220502/49eab0f3/attachment-0001.htm>


More information about the debian-med-commit mailing list