From bbb226bcc2c4bb6ba3ebc019df76f49271c8fff1 Mon Sep 17 00:00:00 2001 From: Redmar van den Berg <RedmarvandenBerg@lumc.nl> Date: Fri, 25 Oct 2019 09:25:14 +0200 Subject: [PATCH] Add test for a rare bug with partial variants --- tests/test_evaluate.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_evaluate.py b/tests/test_evaluate.py index 0ae13a2..e62dda0 100644 --- a/tests/test_evaluate.py +++ b/tests/test_evaluate.py @@ -1,6 +1,8 @@ import pytest +from collections import defaultdict from vtools.evaluate import site_concordancy +from vtools.evaluate import parse_variants from cyvcf2 import VCF @@ -340,3 +342,23 @@ def test_ref_alt_changed_call_concordant(ref_alt_changed_call): def test_ref_alt_changed_call_no_call(ref_alt_changed_call): assert ref_alt_changed_call['alleles_no_call'] == 54 + + +def test_parse_variants_no_call(): + """ This should be counted as a single no call """ + results = defaultdict(int) + call = ['.', 'A'] + pos = ['A', 'G'] + + parse_variants('A', call, pos, results) + assert results['alleles_no_call'] == 1 + + +def test_parse_variants_concordant(): + """ This should be counted as a single concordant allele """ + results = defaultdict(int) + call = ['.', 'A'] + pos = ['A', 'G'] + + parse_variants('A', call, pos, results) + assert results['alleles_concordant'] == 1 -- GitLab