Implemented normalizing genotype
Some checks failed
ydeng/modvcfsamples/pipeline/head There was a failure building this commit

This commit is contained in:
2023-06-27 06:15:32 +00:00
parent 08ba073ef9
commit 7bae01b1af
5 changed files with 58 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
from modvcfsamples.sample import keep_specific_call_data, get_records_from_vcf
from modvcfsamples.sample import keep_specific_call_data, get_records_from_vcf, normalize_gt_to_length
import os
def test_filter_all_sample_datatypes_not_empty():
@@ -16,3 +16,15 @@ def test_filter_all_sample_datatypes_filtered():
assert len(call.data.keys()) <= len(filter_for)
for key, _ in call.data.items():
assert key in filter_for
def test_normalize_gt_to_length_not_empty():
records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened_haploid.vcf"))
modified_records, _ = normalize_gt_to_length(records, header, 4)
assert len(modified_records) > 0
def test_normalize_gt_to_length_gt_normalized():
records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened_haploid.vcf"))
modified_records, _ = normalize_gt_to_length(records, header, 4)
for modified_record in modified_records:
for call in modified_record.calls:
assert len(call.data["GT"].split("|")) == 4 or "/" in call.data["GT"]