Skip to content

Commit

Permalink
Do not require gene when using get_nearest_transcript_junction
Browse files Browse the repository at this point in the history
  • Loading branch information
jarbesfeld committed Sep 25, 2024
1 parent 0f7fc9a commit 293ac12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/cool_seq_tool/mappers/exon_genomic_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,10 @@ async def _genomic_to_tx_segment(
params = {key: None for key in GenomicTxSeg.model_fields}

if get_nearest_transcript_junction:
if not gene:
if not gene and not transcript:
return GenomicTxSeg(
errors=[
"`gene` must be provided to select the adjacent transcript junction"
"`gene` or `transcript` must be provided to select the adjacent transcript junction"
]
)

Expand Down
14 changes: 11 additions & 3 deletions tests/mappers/test_exon_genomic_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,16 +928,15 @@ async def test_genomic_to_transcript_fusion_context(
resp = await test_egc_mapper.genomic_to_tx_segment(**inputs)
genomic_tx_seg_service_checks(resp, gusbp3_exon5_start)

inputs = { # Test when gene and strand are not provided
inputs = { # Test when gene and transcript are not provided
"chromosome": "5",
"seg_start_genomic": 69645878,
"transcript": "NR_027386.2",
"get_nearest_transcript_junction": True,
}
resp = await test_egc_mapper.genomic_to_tx_segment(**inputs)
assert (
resp.errors[0]
== "`gene` must be provided to select the adjacent transcript junction"
== "`gene` or `transcipt` must be provided to select the adjacent transcript junction"
)

inputs = { # Test when transcript is provided
Expand All @@ -950,6 +949,15 @@ async def test_genomic_to_transcript_fusion_context(
resp = await test_egc_mapper.genomic_to_tx_segment(**inputs)
genomic_tx_seg_service_checks(resp, gusbp3_exon5_start)

inputs = { # Test when gene is not provided
"genomic_ac": "NC_000005.10",
"seg_start_genomic": 69645878,
"transcript": "NR_027386.2",
"get_nearest_transcript_junction": True,
}
resp = await test_egc_mapper.genomic_to_tx_segment(**inputs)
genomic_tx_seg_service_checks(resp, gusbp3_exon5_start)


@pytest.mark.asyncio()
async def test_get_alt_ac_start_and_end(
Expand Down

0 comments on commit 293ac12

Please sign in to comment.