|
@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) |
Remove Beacon Translator (and all references to Beacon)
vrs-python/src/ga4gh/vrs/extras/translator.py
Lines 218 to 278 in b573565
In #568 (PR #578) we added a deprecation warning that the translator does not match the Beacon spec and will be removed in v3.