Skip to content

Commit

Permalink
didnt use new allele for state
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Aug 24, 2023
1 parent 1ed754c commit 8ac1649
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/ga4gh/vrs/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion tests/test_vrs_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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)
Expand Down

0 comments on commit 8ac1649

Please sign in to comment.