Skip to content

Remove Beacon Translator #622

Description

@korikuzma

Remove Beacon Translator (and all references to Beacon)

@deprecated("This method does not match the Beacon spec and will be removed in v3.")
def _from_beacon(self, beacon_expr: str, **kwargs) -> models.Allele | None:
"""Parse beacon expression into VRS Allele
kwargs:
assembly_name (str): Assembly used for `beacon_expr`.
rle_seq_limit Optional(int): If RLE is set as the new state after
normalization, this sets the limit for the length of the `sequence`.
To exclude `sequence` from the response, set to 0.
For no limit, set to `None`.
Defaults value set in instance variable, `rle_seq_limit`.
do_normalize (bool): `True` if fully justified normalization should be
performed. `False` otherwise. Defaults to `True`
#>>> a = tlr.from_beacon("19 : 44908822 C > T")
#>>> a.model_dump()
{
'location': {
'end': 44908822,
'start': 44908821,
'sequenceReference': {
'type': 'SequenceReference',
'refgetAccession': 'SQ.IIB53T8CNeJJdUqzn9V_JnRtQadwWCbl'
},
'type': 'SequenceLocation'
},
'state': {
'sequence': 'C',
'type': 'LiteralSequenceExpression'
},
'type': 'Allele'
}
"""
if not isinstance(beacon_expr, str):
return None
m = self.beacon_re.match(beacon_expr.replace(" ", ""))
if not m:
return None
g = m.groupdict()
assembly_name = kwargs.get("assembly_name", self.default_assembly_name)
sequence = assembly_name + ":" + g["chr"]
refget_accession = self.data_proxy.derive_refget_accession(sequence)
if not refget_accession:
return None
start = int(g["pos"]) - 1
ref = g["ref"]
alt = g["alt"]
end = start + len(ref)
ins_seq = alt
values = {
"refget_accession": refget_accession,
"start": start,
"end": end,
"literal_sequence": ins_seq,
}
return self._create_allele(values, **kwargs)

In #568 (PR #578) we added a deprecation warning that the translator does not match the Beacon spec and will be removed in v3.

Activity

  1. self-assigned this
    on Apr 15, 2026
  2. added 3 commits that reference this issue on Apr 15, 2026
    1683475
    de2e192
    a91377d
  3. moved this from Backlog to In review in VRS-Python v3 releaseon Apr 15, 2026
  4. added a commit that references this issue on Apr 15, 2026
    92d5767
  5. theferrit32 commented on Apr 15, 2026

    @theferrit32
    Contributor

    Completed in #625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions