From 8ac1649d3d965155cc2978fb9e5955883632ed26 Mon Sep 17 00:00:00 2001 From: korikuzma Date: Thu, 24 Aug 2023 00:35:37 -0400 Subject: [PATCH] didnt use new allele for state --- src/ga4gh/vrs/normalize.py | 5 ++--- tests/test_vrs_normalize.py | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ga4gh/vrs/normalize.py b/src/ga4gh/vrs/normalize.py index c4f98ce2..819fa677 100644 --- a/src/ga4gh/vrs/normalize.py +++ b/src/ga4gh/vrs/normalize.py @@ -158,10 +158,9 @@ def _normalize_allele(input_allele, data_proxy): # a Location specified by the coordinates of the new ival, a length # specified by the length of the alternate allele, and a repeat subunit # length - allele.state = models.ReferenceLengthExpression( + new_allele.state = models.ReferenceLengthExpression( length=len(new_alleles[1]), - sequence=models.SequenceString(new_ref_seq), - repeat_subunit_length=repeat_subunit_len + repeatSubunitLength=repeat_subunit_len ) except ValueError: # Occurs for ref agree Alleles (when alt = ref) diff --git a/tests/test_vrs_normalize.py b/tests/test_vrs_normalize.py index 908080bb..7bdcaa73 100644 --- a/tests/test_vrs_normalize.py +++ b/tests/test_vrs_normalize.py @@ -36,6 +36,22 @@ } +allele_dict2_normalized = { + "type": "Allele", + "location": { + "type": "SequenceLocation", + "sequence": "refseq:NC_000023.11", + "start": [None, 155980375], + "end": [155980377, None] + }, + "state": { + "length": 0, + "repeatSubunitLength": 2, + "type": "ReferenceLengthExpression" + } +} + + allele_dict3 = { "type": "Allele", "location": { @@ -59,7 +75,8 @@ def test_normalize_allele(rest_dataproxy): allele1 = models.Allele(**allele_dict2) allele2 = normalize(allele1, rest_dataproxy) - assert allele1 == allele2 + assert allele1 != allele2 + assert allele2 == models.Allele(**allele_dict2_normalized) # Definite ranges are not normalized allele3 = models.Allele(**allele_dict3)