Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cool_seq_tool/mappers/mane_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,12 @@ async def grch38_to_mane_c_p(
mane_transcripts = set() # Used if getting longest compatible remaining
for current_mane_data in mane_data:
mane_c_ac = current_mane_data["RefSeq_nuc"]
mane_alt_ac = current_mane_data["GRCh38_chr"]
mane_transcripts |= {mane_c_ac, current_mane_data["Ensembl_nuc"]}

# GRCh38 -> MANE C
mane_tx_genomic_data = await self.uta_db.get_mane_c_genomic_data(
mane_c_ac, None, start_pos, end_pos
ac=mane_c_ac, alt_ac=mane_alt_ac, start_pos=start_pos, end_pos=end_pos
)
if not mane_tx_genomic_data:
continue
Expand Down
13 changes: 10 additions & 3 deletions src/cool_seq_tool/sources/uta_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ async def get_mane_c_genomic_data(
self, ac: str, alt_ac: str | None, start_pos: int, end_pos: int
) -> GenomicTxMetadata | None:
"""Get MANE transcript and genomic data. Used when going from g. to MANE c.
representation.
representation. This function parses queried data from the tx_exon_aln_v
table, and sorts the queried data by the most recent genomic build

>>> import asyncio
>>> from cool_seq_tool.sources import UtaDatabase
Expand All @@ -569,11 +570,17 @@ async def get_mane_c_genomic_data(
successful
"""
results = await self.get_tx_exon_aln_v_data(
ac, start_pos, end_pos, alt_ac=alt_ac, use_tx_pos=False
tx_ac=ac,
start_pos=start_pos,
end_pos=end_pos,
alt_ac=alt_ac,
use_tx_pos=False,
)
if not results:
return None
result = results[0]

# Sort by most recent chromosomal accession
result = results[-1]

genomic_tx_data = self.data_from_result(result)
if not genomic_tx_data:
Expand Down
27 changes: 27 additions & 0 deletions tests/sources/test_uta_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,33 @@ async def test_mane_c_genomic_data(test_db):
}
assert resp == GenomicTxMetadata(**expected_params)

# Test example where sorting of tx_exon_aln_v is needed
resp = await test_db.get_mane_c_genomic_data(
"NM_000077.5", "NC_000009.12", 21971186, 21971187
)
expected_params = {
"gene": "CDKN2A",
"strand": Strand.NEGATIVE,
"tx_pos_range": (180, 487),
"alt_pos_range": (21970901, 21971208),
"alt_aln_method": "splign",
"tx_exon_id": 8314723,
"alt_exon_id": 8960507,
"coding_start_site": 30,
"coding_end_site": 501,
"pos_change": (21, 285),
"alt_pos_change_range": (21971187, 21971186),
"tx_ac": "NM_000077.5",
"alt_ac": "NC_000009.12",
}
assert resp == GenomicTxMetadata(**expected_params)

# Test case where chromosomal accession is not provided
resp = await test_db.get_mane_c_genomic_data(
"NM_000077.5", None, 21971186, 21971187
)
assert resp == GenomicTxMetadata(**expected_params)


@pytest.mark.asyncio
async def test_get_genomic_tx_data(test_db, genomic_tx_data):
Expand Down