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

Nilesh Patra gitlab at salsa.debian.org
Mon Apr 19 12:53:37 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / cyvcf2


Commits:
fa644590 by Nilesh Patra at 2021-04-19T17:17:00+05:30
New upstream version 0.30.8
- - - - -


10 changed files:

- .github/workflows/build.yml
- .github/workflows/wheels.yml
- .travis.yml
- + CHANGES.md
- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pyx
- cyvcf2/helpers.c
- + cyvcf2/tests/issue_198.vcf
- + cyvcf2/tests/test.mnp.vcf
- cyvcf2/tests/test_reader.py


Changes:

=====================================
.github/workflows/build.yml
=====================================
@@ -8,7 +8,7 @@ jobs:
     runs-on: ubuntu-18.04
     strategy:
       matrix:
-        python-version: [3.5, 3.6, 3.7, 3.8]
+        python-version: [3.6, 3.7, 3.8]
 
     steps:
     - uses: actions/checkout at v2
@@ -22,6 +22,7 @@ jobs:
       run: |
         sudo apt-get install libcurl4-openssl-dev
         pip install -r requirements.txt
+        pip install nose
         cd htslib
         autoheader && autoconf
         ./configure --enable-s3 --disable-lzma --disable-bz2


=====================================
.github/workflows/wheels.yml
=====================================
@@ -1,6 +1,6 @@
 name: Wheels
 
-on: 
+on:
   push:
     tags:
       - 'v*.*.*'
@@ -31,7 +31,7 @@ jobs:
       run: |
         python -m cibuildwheel --output-dir wheelhouse
       env:
-        CIBW_SKIP: "pp* cp27-* cp34-* *i686*"
+        CIBW_SKIP: "pp* cp27-* cp34-* cp35-* *i686*"
         CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
         CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
         CIBW_TEST_COMMAND: "{project}/ci/test"
@@ -66,8 +66,21 @@ jobs:
         with:
           python-version: "3.7"
 
+      - name: Install dependencies
+        run: |
+          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: python setup.py sdist
+        run: CYTHONIZE=1 python setup.py sdist
 
       - uses: actions/upload-artifact at v2
         with:


=====================================
.travis.yml
=====================================
@@ -2,7 +2,6 @@ language: python
 dist: bionic
 python:
   - "2.7"
-  - "3.5"
   - "3.6"
   - "3.7"
   - "3.8"
@@ -30,7 +29,7 @@ jobs:
   - os: linux
     python: "3.7"
     env:
-      - CIBW_SKIP="pp* cp27-* cp34-* *i686*"
+      - CIBW_SKIP="pp* cp27-* cp34-* cp35-* *i686*"
       - CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
       - CIBW_BEFORE_BUILD_LINUX="{project}/ci/linux-deps"
       - CIBW_TEST_COMMAND="{project}/ci/test"
@@ -52,7 +51,7 @@ jobs:
     osx_image: xcode10.2
     language: shell
     env:
-      - CIBW_SKIP="pp* cp27-* cp34-* *i686*"
+      - CIBW_SKIP="pp* cp27-* cp34-* cp35-* *i686*"
       - CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
       - CIBW_BEFORE_BUILD_MACOS="{project}/ci/osx-deps"
       - CIBW_TEST_COMMAND="{project}/ci/test"


=====================================
CHANGES.md
=====================================
@@ -0,0 +1,5 @@
+# 0.3.8
++ just bumping for CI+wheels
+
+# 0.30.7
++ fix gt_types for phased variants (see: #198)


=====================================
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.4"
+__version__ = "0.30.8"


=====================================
cyvcf2/cyvcf2.pyx
=====================================
@@ -587,8 +587,9 @@ cdef class VCF(HTSFile):
             bcf_destroy(b)
         if  ret == -1:  # end-of-file
             raise StopIteration
-        else:  
-            raise Exception("error parsing variant with `htslib::bcf_read` error-code: %d" % (b.errcode))
+        else:
+            raise Exception("error parsing variant with `htslib::bcf_read` error-code: %d and ret: %d" % (
+                b.errcode, ret))
 
 
     property samples:
@@ -1176,7 +1177,7 @@ cdef class Variant(object):
                 else:
                     raise Exception("gt_bases not implemented for ploidy > 2")
 
-            return np.array(bases, np.str)
+            return np.array(bases, str)
 
     def relatedness(self,
                     int32_t[:, ::view.contiguous] ibs,
@@ -1811,6 +1812,20 @@ cdef class Variant(object):
                     return False
             return self.b.n_allele > 1
 
+    property is_mnp:
+        "boolean indicating if the variant is a MNP."
+        def __get__(self):
+            cdef int i
+            is_sv = self.is_sv
+            if len(self.b.d.allele[0]) == 1 and not is_sv: return False
+
+            if len(self.REF) == 1 and not is_sv: return False
+
+            if all([len(x)==len(self.REF) for x in self.ALT]):
+                if not is_sv:
+                    return True
+            return False
+
     property is_indel:
         "boolean indicating if the variant is an indel."
         def __get__(self):
@@ -1888,6 +1903,8 @@ cdef class Variant(object):
         def __get__(self):
            if self.is_snp:
                return "snp"
+           if self.is_mnp:
+               return "mnp"
            elif self.is_indel:
                return "indel"
            elif self.is_sv:


=====================================
cyvcf2/helpers.c
=====================================
@@ -2,15 +2,14 @@
 
 int as_gts(int32_t *gts, int num_samples, int ploidy, int strict_gt) {
     int j = 0, i, k;
-	int missing= 0;
+    int missing= 0;
     for (i = 0; i < ploidy * num_samples; i += ploidy){
 		missing = 0;
 		for (k = 0; k < ploidy; k++) {
-			if (gts[i+k] <= 0) {
+			if (gts[i+k] <= 1) {
 				missing += 1;
 			}
-			//fprintf(stderr, "%d\n", gts[i + k]);
-        }
+                }
 		if (missing == ploidy) {
 			gts[j++] = 2; // unknown
 			continue;
@@ -47,7 +46,7 @@ int as_gts(int32_t *gts, int num_samples, int ploidy, int strict_gt) {
         else if((a == 1) && (b == 1)) {
             gts[j] = 3; //  HOM_ALT
         }
-        else if((a  != b)) {
+        else if((a != b)) {
             gts[j] = 1; //  HET
         }
         else if((a == b)) {
@@ -66,10 +65,9 @@ int as_gts012(int32_t *gts, int num_samples, int ploidy, int strict_gt) {
     for (i = 0; i < ploidy * num_samples; i += ploidy){
 		missing = 0;
 		for (k = 0; k < ploidy; k++) {
-			if (gts[i+k] <= 0) {
+			if (gts[i+k] <= 1) {
 				missing += 1;
 			}
-			//fprintf(stderr, "%d\n", gts[i + k]);
         }
 		if (missing == ploidy) {
 			gts[j++] = 3; // unknown


=====================================
cyvcf2/tests/issue_198.vcf
=====================================
@@ -0,0 +1,6 @@
+##fileformat=VCFv4.2
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=chr1,length=248956422>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	sample_1
+chr1	231373681	rs560634812	T	C	12816.8	PASS	.	GT	0/.
+chr1	231373681	rs560634812	T	C	12816.8	PASS	.	GT	0|.


=====================================
cyvcf2/tests/test.mnp.vcf
=====================================
@@ -0,0 +1,72 @@
+##fileformat=VCFv4.2
+##fileDate=20200122
+##source=freeBayes v1.3.1-dirty
+##reference=assembly/scaffolds.fasta
+##contig=<ID=NODE_1_length_348724_cov_30.410613,length=348724>
+##contig=<ID=NODE_5_length_164027_cov_28.935175,length=164027>
+##contig=<ID=NODE_12_length_115292_cov_29.218192,length=115292>
+##contig=<ID=NODE_22_length_87915_cov_29.488718,length=87915>
+##contig=<ID=NODE_31_length_46922_cov_30.386978,length=46922>
+##contig=<ID=NODE_69_length_1317_cov_64.516129,length=1317>
+##phasing=none
+##commandline="freebayes -p 1 -f assembly/scaffolds.fasta mappings/evol1.sorted.dedup.q20.bam"
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total read depth at the locus">
+##INFO=<ID=DPB,Number=1,Type=Float,Description="Total read depth per bp at the locus; bases in reads overlapping / bases in haplotype">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Total number of alternate alleles in called genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=AF,Number=A,Type=Float,Description="Estimated allele frequency in the range (0,1]">
+##INFO=<ID=RO,Number=1,Type=Integer,Description="Count of full observations of the reference haplotype.">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Count of full observations of this alternate haplotype.">
+##INFO=<ID=PRO,Number=1,Type=Float,Description="Reference allele observation count, with partial observations recorded fractionally">
+##INFO=<ID=PAO,Number=A,Type=Float,Description="Alternate allele observations, with partial observations recorded fractionally">
+##INFO=<ID=QR,Number=1,Type=Integer,Description="Reference allele quality sum in phred">
+##INFO=<ID=QA,Number=A,Type=Integer,Description="Alternate allele quality sum in phred">
+##INFO=<ID=PQR,Number=1,Type=Float,Description="Reference allele quality sum in phred for partial observations">
+##INFO=<ID=PQA,Number=A,Type=Float,Description="Alternate allele quality sum in phred for partial observations">
+##INFO=<ID=SRF,Number=1,Type=Integer,Description="Number of reference observations on the forward strand">
+##INFO=<ID=SRR,Number=1,Type=Integer,Description="Number of reference observations on the reverse strand">
+##INFO=<ID=SAF,Number=A,Type=Integer,Description="Number of alternate observations on the forward strand">
+##INFO=<ID=SAR,Number=A,Type=Integer,Description="Number of alternate observations on the reverse strand">
+##INFO=<ID=SRP,Number=1,Type=Float,Description="Strand balance probability for the reference allele: Phred-scaled upper-bounds estimate of the probability of observing the deviation between SRF and SRR given E(SRF/SRR) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=SAP,Number=A,Type=Float,Description="Strand balance probability for the alternate allele: Phred-scaled upper-bounds estimate of the probability of observing the deviation between SAF and SAR given E(SAF/SAR) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=AB,Number=A,Type=Float,Description="Allele balance at heterozygous sites: a number between 0 and 1 representing the ratio of reads showing the reference allele to all reads, considering only reads from individuals called as heterozygous">
+##INFO=<ID=ABP,Number=A,Type=Float,Description="Allele balance probability at heterozygous sites: Phred-scaled upper-bounds estimate of the probability of observing the deviation between ABR and ABA given E(ABR/ABA) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=RUN,Number=A,Type=Integer,Description="Run length: the number of consecutive repeats of the alternate allele in the reference genome">
+##INFO=<ID=RPP,Number=A,Type=Float,Description="Read Placement Probability: Phred-scaled upper-bounds estimate of the probability of observing the deviation between RPL and RPR given E(RPL/RPR) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=RPPR,Number=1,Type=Float,Description="Read Placement Probability for reference observations: Phred-scaled upper-bounds estimate of the probability of observing the deviation between RPL and RPR given E(RPL/RPR) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=RPL,Number=A,Type=Float,Description="Reads Placed Left: number of reads supporting the alternate balanced to the left (5') of the alternate allele">
+##INFO=<ID=RPR,Number=A,Type=Float,Description="Reads Placed Right: number of reads supporting the alternate balanced to the right (3') of the alternate allele">
+##INFO=<ID=EPP,Number=A,Type=Float,Description="End Placement Probability: Phred-scaled upper-bounds estimate of the probability of observing the deviation between EL and ER given E(EL/ER) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=EPPR,Number=1,Type=Float,Description="End Placement Probability for reference observations: Phred-scaled upper-bounds estimate of the probability of observing the deviation between EL and ER given E(EL/ER) ~ 0.5, derived using Hoeffding's inequality">
+##INFO=<ID=DPRA,Number=A,Type=Float,Description="Alternate allele depth ratio.  Ratio between depth in samples with each called alternate allele and those without.">
+##INFO=<ID=ODDS,Number=1,Type=Float,Description="The log odds ratio of the best genotype combination to the second-best.">
+##INFO=<ID=GTI,Number=1,Type=Integer,Description="Number of genotyping iterations required to reach convergence or bailout.">
+##INFO=<ID=TYPE,Number=A,Type=String,Description="The type of allele, either snp, mnp, ins, del, or complex.">
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="The extended CIGAR representation of each alternate allele, with the exception that '=' is replaced by 'M' to ease VCF parsing.  Note that INDEL alleles do not have the first matched base (which is provided by default, per the spec) referred to by the CIGAR.">
+##INFO=<ID=NUMALT,Number=1,Type=Integer,Description="Number of unique non-reference alleles in called genotypes at this position.">
+##INFO=<ID=MEANALT,Number=A,Type=Float,Description="Mean number of unique non-reference allele observations per sample with the corresponding alternate alleles.">
+##INFO=<ID=LEN,Number=A,Type=Integer,Description="allele length">
+##INFO=<ID=MQM,Number=A,Type=Float,Description="Mean mapping quality of observed alternate alleles">
+##INFO=<ID=MQMR,Number=1,Type=Float,Description="Mean mapping quality of observed reference alleles">
+##INFO=<ID=PAIRED,Number=A,Type=Float,Description="Proportion of observed alternate alleles which are supported by properly paired read fragments">
+##INFO=<ID=PAIREDR,Number=1,Type=Float,Description="Proportion of observed reference alleles which are supported by properly paired read fragments">
+##INFO=<ID=MIN_DP,Number=1,Type=Integer,Description="Minimum depth in gVCF output block.">
+##INFO=<ID=END,Number=1,Type=Integer,Description="Last position (inclusive) in gVCF output record.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Float,Description="Genotype Quality, the Phred-scaled marginal (or unconditional) probability of the called genotype">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood, log10-scaled likelihoods of the data given the called genotype for each possible genotype generated from the reference and alternate alleles given the sample ploidy">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Number of observation for each allele">
+##FORMAT=<ID=RO,Number=1,Type=Integer,Description="Reference allele observation count">
+##FORMAT=<ID=QR,Number=1,Type=Integer,Description="Sum of quality of the reference observations">
+##FORMAT=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observation count">
+##FORMAT=<ID=QA,Number=A,Type=Integer,Description="Sum of quality of the alternate observations">
+##FORMAT=<ID=MIN_DP,Number=1,Type=Integer,Description="Minimum depth in gVCF output block.">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	unknown
+NODE_1_length_348724_cov_30.410613	146999	.	TCGGT	GCGGG,GCGGT	0	.	AB=0,0;ABP=0,0;AC=0,0;AF=0,0;AN=1;AO=2,2;CIGAR=1X3M1X,1X4M;DP=33;DPB=33;DPRA=0,0;EPP=7.35324,7.35324;EPPR=3.0103;GTI=0;LEN=5,1;MEANALT=3,3;MQM=60,60;MQMR=60;NS=1;NUMALT=2;ODDS=180.296;PAIRED=1,1;PAIREDR=1;PAO=0,0;PQA=0,0;PQR=0;PRO=0;QA=51,26;QR=928;RO=28;RPL=0,0;RPP=7.35324,7.35324;RPPR=3.32051;RPR=2,2;RUN=1,1;SAF=0,0;SAP=7.35324,7.35324;SAR=2,2;SRF=15;SRP=3.32051;SRR=13;TYPE=complex,snp	GT:DP:AD:RO:QR:AO:QA:GL	0:33:28,2,2:28:928:2,2:51,26:0,-79.0317,-81.2895
+NODE_5_length_164027_cov_28.935175	46218	.	CGT	CGG	9.34428e-16	.	AB=0;ABP=0;AC=0;AF=0;AN=1;AO=3;CIGAR=2M1X;DP=38;DPB=38.6667;DPRA=0;EPP=9.52472;EPPR=13.4954;GTI=0;LEN=1;MEANALT=1;MQM=60;MQMR=60;NS=1;NUMALT=1;ODDS=227.003;PAIRED=1;PAIREDR=1;PAO=0.5;PQA=12.5;PQR=12.5;PRO=0.5;QA=61;QR=1175;RO=35;RPL=0;RPP=9.52472;RPPR=10.5174;RPR=3;RUN=1;SAF=0;SAP=9.52472;SAR=3;SRF=19;SRP=3.56868;SRR=16;TYPE=snp	GT:DP:AD:RO:QR:AO:QA:GL	0:38:35,3:35:1175:3:61:0,-100.335
+NODE_12_length_115292_cov_29.218192	69322	.	GCC	TCC,GCA,GCG	4.33994e-15	.	AB=0,0,0;ABP=0,0,0;AC=0,0,0;AF=0,0,0;AN=1;AO=2,5,2;CIGAR=1X2M,2M1X,2M1X;DP=33;DPB=35;DPRA=0,0,0;EPP=3.0103,13.8677,7.35324;EPPR=3.40511;GTI=0;LEN=1,1,1;MEANALT=5,5,5;MQM=21,60,60;MQMR=55.5909;NS=1;NUMALT=3;ODDS=124.05;PAIRED=1,1,1;PAIREDR=1;PAO=0,1,1;PQA=0,35.3333,35.3333;PQR=35.3333;PRO=1;QA=29,95,60;QR=714;RO=22;RPL=1,4,2;RPP=3.0103,6.91895,7.35324;RPPR=12.8806;RPR=1,1,0;RUN=1,1,1;SAF=0,4,2;SAP=7.35324,6.91895,7.35324;SAR=2,1,0;SRF=16;SRP=12.8806;SRR=6;TYPE=snp,snp,snp	GT:DP:AD:RO:QR:AO:QA:GL	0:33:22,2,5,2:22:714:2,5,2:29,95,60:0,-61.2863,-55.0685,-58.2018
+NODE_22_length_87915_cov_29.488718	87208	.	GCA	GA	0	.	AB=0;ABP=0;AC=0;AF=0;AN=1;AO=2;CIGAR=1M1D1M;DP=34;DPB=33.3333;DPRA=0;EPP=3.0103;EPPR=5.45321;GTI=0;LEN=1;MEANALT=1;MQM=60;MQMR=60;NS=1;NUMALT=1;ODDS=206.136;PAIRED=1;PAIREDR=0.96875;PAO=0;PQA=0;PQR=0;PRO=0;QA=74;QR=1091;RO=32;RPL=2;RPP=7.35324;RPPR=4.09604;RPR=0;RUN=1;SAF=1;SAP=3.0103;SAR=1;SRF=13;SRP=5.45321;SRR=19;TYPE=del	GT:DP:AD:RO:QR:AO:QA:GL	0:34:32,2:32:1091:2:74:0,-91.4633
+NODE_31_length_46922_cov_30.386978	253	.	AGG	CGA	1.10297e-14	.	AB=0;ABP=0;AC=0;AF=0;AN=1;AO=6;CIGAR=1X1M1X;DP=49;DPB=49;DPRA=0;EPP=4.45795;EPPR=4.27278;GTI=0;LEN=3;MEANALT=1;MQM=38.1667;MQMR=58.7209;NS=1;NUMALT=1;ODDS=265.514;PAIRED=0.833333;PAIREDR=0.976744;PAO=0;PQA=0;PQR=0;PRO=0;QA=202;QR=1477;RO=43;RPL=5;RPP=8.80089;RPPR=3.0608;RPR=1;RUN=1;SAF=3;SAP=3.0103;SAR=3;SRF=25;SRP=5.48477;SRR=18;TYPE=complex	GT:DP:AD:RO:QR:AO:QA:GL	0:49:43,6:43:1477:6:202:0,-116.271
+NODE_69_length_1317_cov_64.516129	720	.	ATTAC	ATAC,AATAC	6.69002e-15	.	AB=0,0;ABP=0,0;AC=0,0;AF=0,0;AN=1;AO=2,2;CIGAR=1M1D3M,1M1X3M;DP=18;DPB=17.6;DPRA=0,0;EPP=3.0103,7.35324;EPPR=5.49198;GTI=0;LEN=1,1;MEANALT=2,2;MQM=60,60;MQMR=60;NS=1;NUMALT=2;ODDS=79.4694;PAIRED=1,1;PAIREDR=0.928571;PAO=0,0;PQA=0,0;PQR=0;PRO=0;QA=69,30;QR=467;RO=14;RPL=2,1;RPP=7.35324,3.0103;RPPR=5.49198;RPR=0,1;RUN=1,1;SAF=1,1;SAP=3.0103,3.0103;SAR=1,1;SRF=8;SRP=3.63072;SRR=6;TYPE=del,snp	GT:DP:AD:RO:QR:AO:QA:GL	0:18:14,2,2:14:467:2,2:69,30:0,-35.8718,-39.4036


=====================================
cyvcf2/tests/test_reader.py
=====================================
@@ -16,6 +16,7 @@ except ImportError:
 HERE = os.path.dirname(__file__)
 VCF_PATH = os.path.join(HERE, "test.vcf.gz")
 VCF_PATH2 = os.path.join(HERE, "test.snpeff.vcf")
+VCF_PATH3 = os.path.join(HERE, "test.mnp.vcf")
 VCF_PHASE_PATH = os.path.join(HERE, "test.comp_het.3.vcf")
 VCF_ALTFREQ_PATH = os.path.join(HERE, "test_gt_alt_freqs.vcf")
 
@@ -59,6 +60,23 @@ def test_type():
         else:
             print(v.var_type, v.REF, v.ALT)
 
+def test_type_mnp():
+    vcf = VCF(VCF_PATH3)
+    for v in vcf:
+        if len(v.ALT) == 1:
+            if (v.REF, v.ALT[0]) in [("CGT","CGG"), ("AGG","CGA")]:
+                assert v.var_type == 'mnp'
+            if (v.REF, v.ALT[0]) in [("GCA","GA")]:
+                assert v.var_type == 'indel'
+        if len(v.ALT) == 2:
+            if (v.REF, v.ALT[0], v.ALT[1]) in [("TCGGT","GCGGG","GCGGT")]:
+                assert v.var_type == 'mnp'
+            if (v.REF, v.ALT[0], v.ALT[1]) in [("ATTAC","ATAC","AATAC")]:
+                assert v.var_type == 'indel'
+        if len(v.ALT) == 3:
+            if (v.REF, v.ALT[0], v.ALT[1], v.ALT[2]) in [("GCC","TCC","GCA","GCG")]:
+                assert v.var_type == 'mnp'
+
 def test_format_str():
     vcf = VCF(os.path.join(HERE, "test-format-string.vcf"))
 
@@ -333,7 +351,9 @@ def test_add_flag():
     w.write_record(rec)
     w.close()
 
-    v = next(VCF(f))
+    fh = VCF(f)
+    v = next(fh)
+    fh.close()
     assert v.INFO["myflag"] is True, dict(v.INFO)
 
     f = tempfile.mktemp(suffix=".vcf")
@@ -341,9 +361,20 @@ def test_add_flag():
     w = Writer(f, vcf)
     rec.INFO["myflag"] = False
     w.write_record(rec)
-    v = next(VCF(f))
+    w.close()
+    fh = VCF(f)
+    v = next(fh)
+    fh.close()
     assert_raises(KeyError, v.INFO.__getitem__, "myflag")
 
+def test_issue198():
+    vcf = VCF(os.path.join(HERE, "issue_198.vcf"), strict_gt=True)
+    for v in vcf:
+        assert all(v.gt_types == [2]), v.gt_types
+
+    vcf = VCF(os.path.join(HERE, "issue_198.vcf"), strict_gt=False)
+    for v in vcf:
+        assert all(v.gt_types == [0]), v.gt_types
 
 def test_constants():
     v = VCF(VCF_PATH)



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

-- 
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/fa6445904f673c138b87e9867d3b09e1baf10172
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/20210419/2e7413c5/attachment-0001.htm>


More information about the debian-med-commit mailing list