From b82ab35630a96fc129600ae55295fb9a612fac38 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Wed, 2 Oct 2024 21:40:15 -0700 Subject: [PATCH] feat(is_rna): moving the check if a transcript is RNA only to datacompiler --- src/hgvs/pretty/console/tx_pos.py | 7 ++----- src/hgvs/pretty/datacompiler.py | 3 +++ src/hgvs/pretty/models.py | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hgvs/pretty/console/tx_pos.py b/src/hgvs/pretty/console/tx_pos.py index bf2d09f1..eae78577 100644 --- a/src/hgvs/pretty/console/tx_pos.py +++ b/src/hgvs/pretty/console/tx_pos.py @@ -11,10 +11,7 @@ def display(self, data: VariantData) -> str: """show the position of the transcript seq""" var_str = "" - if data.var_c_or_n: - rna_coding = data.var_c_or_n.ac.startswith("NR_") - else: - rna_coding = False + is_rna = data.is_rna count = -1 for pdata in data.position_details: @@ -25,7 +22,7 @@ def display(self, data: VariantData) -> str: c_pos = pdata.c_pos interval = pdata.c_interval - if rna_coding: + if is_rna: c_pos = pdata.n_pos interval = pdata.n_interval diff --git a/src/hgvs/pretty/datacompiler.py b/src/hgvs/pretty/datacompiler.py index 8418aea5..a037bcce 100644 --- a/src/hgvs/pretty/datacompiler.py +++ b/src/hgvs/pretty/datacompiler.py @@ -351,6 +351,8 @@ def data( pd = reversed(position_details) position_details = list(pd) + is_rna = var_c_or_n.ac.startswith("NR_") # not sure how to check this for ENSTs + vd = VariantData( seq_start, seq_end, @@ -365,6 +367,7 @@ def data( var_c_or_n, var_p, position_details, + is_rna ) return vd diff --git a/src/hgvs/pretty/models.py b/src/hgvs/pretty/models.py index 54e2d945..d5fcd472 100644 --- a/src/hgvs/pretty/models.py +++ b/src/hgvs/pretty/models.py @@ -90,6 +90,7 @@ class VariantData: var_p: SequenceVariant = None position_details: List[PositionDetail] = None all: bool = False + is_rna: bool = False @dataclass