Skip to content
Snippets Groups Projects
Commit 9e87861b authored by van den Berg's avatar van den Berg
Browse files

Add check for phased calls

Since it is not clear how we should handle phased calls, we check if the
variants are phased and error out if this is the case.
parent fb075df9
No related branches found
No related tags found
2 merge requests!6Merge testing into master,!5Merge new testing code into devel
File added
File added
......@@ -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'])
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment