diff --git a/tests/cases/dummy_phased_blank.vcf.gz b/tests/cases/dummy_phased_blank.vcf.gz new file mode 100644 index 0000000000000000000000000000000000000000..22772c816c36e81870a0a72d8862064c60c2a056 Binary files /dev/null and b/tests/cases/dummy_phased_blank.vcf.gz differ diff --git a/tests/cases/dummy_phased_blank.vcf.gz.tbi b/tests/cases/dummy_phased_blank.vcf.gz.tbi new file mode 100644 index 0000000000000000000000000000000000000000..3e846195d35e95a729b46de1b2f0a5a3429bed8e Binary files /dev/null and b/tests/cases/dummy_phased_blank.vcf.gz.tbi differ diff --git a/tests/test_evaluate.py b/tests/test_evaluate.py index dbb3cb5dc6516d5a5025b44b6e5b11aefeac1f23..ec177393b8ed0ff7c2aa8eb6648276c9cc929a53 100644 --- a/tests/test_evaluate.py +++ b/tests/test_evaluate.py @@ -133,3 +133,27 @@ def test_truncated_positive_no_call(NA12878_positive_truncated): """ Variants which are missing from the positive vcf do not count towards alleles_no_call """ assert NA12878_positive_truncated['alleles_no_call'] == 0 + + +def test_phased_positive(): + """ Test error message when the positive vcf contains phased variants """ + filename = 'tests/cases/gatk.vcf.gz' + phased = 'tests/cases/dummy_phased_blank.vcf.gz' + call = VCF(filename, gts012=True) + phased = VCF(phased, gts012=True) + with pytest.raises(NotImplementedError, + match='Phased variants are not supported'): + site_concordancy(call, phased, call_samples=['NA12878'], + positive_samples=['BLANK']) + + +def test_phased_call(): + """ Test error message when the call vcf contains phased variants """ + filename = 'tests/cases/gatk.vcf.gz' + phased = 'tests/cases/dummy_phased_blank.vcf.gz' + call = VCF(phased, gts012=True) + positive = VCF(filename, gts012=True) + with pytest.raises(NotImplementedError, + match='Phased variants are not supported'): + site_concordancy(call, positive, call_samples=['BLANK'], + positive_samples=['NA12878']) diff --git a/vtools/evaluate.py b/vtools/evaluate.py index 652dd3396099ee30b378ca6a592770389d866d5f..ea276ca08a3a54b533b4b46e56290e8b5b53b145 100644 --- a/vtools/evaluate.py +++ b/vtools/evaluate.py @@ -165,6 +165,10 @@ def site_concordancy(call_vcf: VCF, pos = pos_record.genotypes[p_s] cal = call_record.genotypes[c_s] + # If the genotypes are phased + if pos[2] or cal[2]: + raise NotImplementedError('Phased variants are not supported') + # Parse the genotypes and add the results into d parse_variants(pos, cal, d)