Skip to content

Commit

Permalink
revert test updates - will address in another pr
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl committed Jul 12, 2024
1 parent 170c311 commit cf9124d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
8 changes: 7 additions & 1 deletion src/fusor/fusor.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,14 @@ async def transcript_segment_element(
)
_logger.warning(msg)
return None, [msg]
residue_mode = kwargs.get("residue_mode")
# TODO: Remove once fixed in cool_seq_tool - need to verify that this code isn't still needed
if residue_mode != ResidueMode.INTER_RESIDUE:
start = kwargs.get("start")
kwargs["start"] = start - 1 if start is not None else None
kwargs["residue_mode"] = "inter-residue"
chromosome = kwargs.get("chromosome")
# if chromosome is a string, assume it's an accession, add it to the kwargs
# if chromosome is a string, assume it's an accession, fix it for the kwargs since CST expects
if type(chromosome) is str:
kwargs["alt_ac"] = chromosome
data = await self.cool_seq_tool.ex_g_coords_mapper.genomic_to_transcript_exon_coordinates(
Expand Down
77 changes: 38 additions & 39 deletions tests/test_fusor.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def regulatory_element_min(braf_gene_descr_min):
def location_descriptor_tpm3():
"""Create location descriptor test fixture."""
params = {
"id": "fusor.location_descriptor:NM_152263.4",
"id": "fusor.location_descriptor:NM_152263.3",
"type": "LocationDescriptor",
"location": {
"sequence_id": "refseq:NM_152263.4",
"sequence_id": "refseq:NM_152263.3",
"type": "SequenceLocation",
"interval": {
"start": {"type": "Number", "value": 154170398},
Expand Down Expand Up @@ -254,14 +254,14 @@ def transcript_segment_element():
"label": "TPM3",
"type": "GeneDescriptor",
},
"transcript": "refseq:NM_152263.4",
"transcript": "refseq:NM_152263.3",
"element_genomic_end": {
"id": "fusor.location_descriptor:NC_000001.11",
"label": "NC_000001.11",
"location": {
"interval": {
"end": {"type": "Number", "value": 154170401},
"start": {"type": "Number", "value": 154170400},
"end": {"type": "Number", "value": 154170400},
"start": {"type": "Number", "value": 154170399},
"type": "SequenceInterval",
},
"sequence_id": "refseq:NC_000001.11",
Expand All @@ -274,8 +274,8 @@ def transcript_segment_element():
"label": "NC_000001.11",
"location": {
"interval": {
"end": {"type": "Number", "value": 154192100},
"start": {"type": "Number", "value": 154192099},
"end": {"type": "Number", "value": 154192136},
"start": {"type": "Number", "value": 154192135},
"type": "SequenceInterval",
},
"sequence_id": "refseq:NC_000001.11",
Expand Down Expand Up @@ -632,17 +632,17 @@ async def test_transcript_segment_element(
"""Test that transcript_segment_element method works correctly"""
# Transcript Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4", exon_start=1, exon_end=8, tx_to_genomic_coords=True
transcript="NM_152263.3", exon_start=1, exon_end=8, tx_to_genomic_coords=True
)
assert tsg[0]
assert tsg[1] is None
assert tsg[0].model_dump() == transcript_segment_element.model_dump()

# Genomic input, residue
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
start=154192100,
end=154170400,
transcript="NM_152263.3",
start=154192136,
end=154170399,
chromosome="NC_000001.11",
tx_to_genomic_coords=False,
)
Expand All @@ -652,9 +652,9 @@ async def test_transcript_segment_element(

# Genomic input, inter-residue
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
start=154192099,
end=154170400,
transcript="NM_152263.3",
start=154192135,
end=154170399,
chromosome="NC_000001.11",
tx_to_genomic_coords=False,
residue_mode="inter-residue",
Expand All @@ -665,7 +665,7 @@ async def test_transcript_segment_element(

# Transcript Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
transcript="NM_152263.3",
exon_start=1,
exon_end=8,
gene="TPM3",
Expand All @@ -685,7 +685,7 @@ async def test_transcript_segment_element(

# Transcript Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
transcript="NM_152263.3",
exon_start=1,
exon_end=8,
tx_to_genomic_coords=True,
Expand All @@ -697,9 +697,9 @@ async def test_transcript_segment_element(

# Genomic input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
start=154192100,
end=154170400,
transcript="NM_152263.3",
start=154192136,
end=154170399,
chromosome="NC_000001.11",
tx_to_genomic_coords=False,
seq_id_target_namespace="ga4gh",
Expand All @@ -709,12 +709,12 @@ async def test_transcript_segment_element(
assert tsg[0].model_dump() == expected.model_dump()

expected.exon_end_offset = -5
expected.element_genomic_end.location.interval.start.value = 154170405
expected.element_genomic_end.location.interval.end.value = 154170406
expected.element_genomic_end.location.interval.start.value = 154170404
expected.element_genomic_end.location.interval.end.value = 154170405

# Transcript Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
transcript="NM_152263.3",
exon_start=1,
exon_end=8,
exon_end_offset=-5,
Expand All @@ -727,9 +727,9 @@ async def test_transcript_segment_element(

# Genomic Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
start=154192100,
end=154170405,
transcript="NM_152263.3",
start=154192136,
end=154170404,
chromosome="NC_000001.11",
tx_to_genomic_coords=False,
seq_id_target_namespace="ga4gh",
Expand All @@ -744,7 +744,7 @@ async def test_transcript_segment_element(

# Transcript Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
transcript="NM_152263.3",
exon_start=1,
tx_to_genomic_coords=True,
seq_id_target_namespace="ga4gh",
Expand All @@ -755,8 +755,8 @@ async def test_transcript_segment_element(

# Genomic Input
tsg = await fusor_instance.transcript_segment_element(
transcript="NM_152263.4",
start=154192100,
transcript="NM_152263.3",
start=154192136,
chromosome="NC_000001.11",
tx_to_genomic_coords=False,
seq_id_target_namespace="ga4gh",
Expand All @@ -766,7 +766,6 @@ async def test_transcript_segment_element(
assert tsg[0].model_dump() == expected.model_dump()

# MANE
# help wanted!!! I can't get this test to work and I can't figure out why - this is a valid start, but CST returns no data
tsg = await fusor_instance.transcript_segment_element(
tx_to_genomic_coords=False,
chromosome="NC_000011.10",
Expand Down Expand Up @@ -1015,7 +1014,7 @@ def compare_domains(actual, expected):
)
assert cd[0] is None
assert (
"End inter-residue coordinate (712000) is out of index on "
"End inter-residue coordinate (711999) is out of index on "
"NP_004324.2" in cd[1]
)

Expand All @@ -1042,34 +1041,34 @@ def compare_re(actual, expected):

def test__location_descriptor(fusor_instance, location_descriptor_tpm3):
"""Test that _location_descriptor method works correctly."""
ld = fusor_instance._location_descriptor(154170398, 154170399, "NM_152263.4")
ld = fusor_instance._location_descriptor(154170398, 154170399, "NM_152263.3")
assert ld.model_dump() == location_descriptor_tpm3.model_dump()

expected = copy.deepcopy(location_descriptor_tpm3)
expected.location.sequence_id = "ga4gh:SQ.J5ZWC7S_-_e_vj-Si6LrRWTX9dk9W1vn"
expected.location.sequence_id = "ga4gh:SQ.ijXOSP3XSsuLWZhXQ7_TJ5JXu4RJO6VT"
ld = fusor_instance._location_descriptor(
154170398, 154170399, "NM_152263.4", seq_id_target_namespace="ga4gh"
154170398, 154170399, "NM_152263.3", seq_id_target_namespace="ga4gh"
)
assert ld.model_dump() == expected.model_dump()

expected.id = "ga4gh:VSL.6SYEqiRy5gRXfQCuZ8GSxMIlCAziZt3a"
expected.id = "ga4gh:VSL._1bRdL4I6EtpBvVK5RUaXb0NN3k0gpqa"
ld = fusor_instance._location_descriptor(
154170398,
154170399,
"NM_152263.4",
"NM_152263.3",
seq_id_target_namespace="ga4gh",
use_location_id=True,
)
assert ld.model_dump() == expected.model_dump()

expected.location.sequence_id = "refseq:NM_152263.4"
expected.id = "fusor.location_descriptor:refseq%3ANM_152263.4"
ld = fusor_instance._location_descriptor(154170398, 154170399, "refseq:NM_152263.4")
expected.location.sequence_id = "refseq:NM_152263.3"
expected.id = "fusor.location_descriptor:refseq%3ANM_152263.3"
ld = fusor_instance._location_descriptor(154170398, 154170399, "refseq:NM_152263.3")
assert ld.model_dump() == expected.model_dump()

expected.id = "fusor.location_descriptor:example_label"
expected.label = "example_label"
ld = fusor_instance._location_descriptor(
154170398, 154170399, "refseq:NM_152263.4", label="example_label"
154170398, 154170399, "refseq:NM_152263.3", label="example_label"
)
assert ld.model_dump() == expected.model_dump()

0 comments on commit cf9124d

Please sign in to comment.