From 4e0208c5f44b086f1f58dffdf11b1fb2acc03ecf Mon Sep 17 00:00:00 2001 From: Jeremy Arbesfeld Date: Tue, 27 Feb 2024 08:58:50 -0500 Subject: [PATCH] Revert warning statement, change tx_genomic_coords structure, edit docstrings --- src/cool_seq_tool/mappers/exon_genomic_coords.py | 14 ++++++++------ src/cool_seq_tool/sources/uta_database.py | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cool_seq_tool/mappers/exon_genomic_coords.py b/src/cool_seq_tool/mappers/exon_genomic_coords.py index 63c880ae..96bb8a43 100644 --- a/src/cool_seq_tool/mappers/exon_genomic_coords.py +++ b/src/cool_seq_tool/mappers/exon_genomic_coords.py @@ -554,12 +554,11 @@ async def _genomic_to_transcript_exon_coordinate( resp, f"Could not find a transcript for {gene} on {alt_ac}", ) - tx_genomic_coords = await self.uta_db.get_tx_exons_genomic_coords( + tx_genomic_coords, w = await self.uta_db.get_tx_exons_genomic_coords( tx_ac=transcript, alt_ac=alt_ac ) - tx_genomic_coords = tx_genomic_coords[0] if not tx_genomic_coords: - return self._return_warnings(resp, tx_genomic_coords[1]) + return self._return_warnings(resp, w) # Check if breakpoint occurs on an exon. # If not, determine the adjacent exon given the selected transcript if not self._is_exonic_breakpoint(pos, tx_genomic_coords): @@ -629,8 +628,8 @@ async def _genomic_to_transcript_exon_coordinate( params["pos"] = pos params["chr"] = alt_ac warning = await self._set_genomic_data(params, strand, is_start) - if warning: - return self._return_warnings(resp, warning) + if warning: + return self._return_warnings(resp, warning) resp.transcript_exon_data = TranscriptExonData(**params) return resp @@ -922,7 +921,10 @@ def _get_adjacent_exon( :param: tx_exons_genomic_coords: List of tuples describing exons and genomic coordinates for a transcript. Each tuple contains the transcript number (0-indexed), the transcript coordinates for the exon, and the genomic - coordinates for the exon. + coordinates for the exon. Pos 0 in the tuple corresponds to the exon + number, pos 1 and pos 2 refer to the start and end transcript coordinates, + respectively, and pos 3 and 4 refer to the start and end genomic + coordinates, respectively. :param strand: Strand :param: start: Genomic coordinate of breakpoint :param: end: Genomic coordinate of breakpoint diff --git a/src/cool_seq_tool/sources/uta_database.py b/src/cool_seq_tool/sources/uta_database.py index b59784f5..4ff5e3de 100644 --- a/src/cool_seq_tool/sources/uta_database.py +++ b/src/cool_seq_tool/sources/uta_database.py @@ -352,7 +352,7 @@ async def get_tx_exons_genomic_coords( self, tx_ac: str, alt_ac: str, - ) -> Optional[Tuple[int, int, int, int, int]]: + ) -> Tuple[Optional[Tuple[int, int, int, int, int]], Optional[str]]: """Get exon number, transcript coordinates, and genomic coordinates :param tx_ac: Transcript accession