Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: change CICERO fusion detection algorithm input parameters #206

Merged
merged 5 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
38 changes: 19 additions & 19 deletions src/fusor/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,24 +462,24 @@ async def from_arriba(

async def from_cicero(
self,
gene_a: str,
gene_b: str,
chr_a: str,
chr_b: str,
pos_a: int,
pos_b: int,
gene_5prime: str,
gene_3prime: str,
chr_5prime: str,
chr_3prime: str,
pos_5prime: int,
pos_3prime: int,
sv_ort: str,
event_type: str,
rb: Assembly,
) -> AssayedFusion | str:
"""Parse CICERO output to create AssayedFusion object

:param geneA: The gene symbol for the 5' partner
:param geneB: The gene symbol for the 3' partner
:param chrA: The chromosome for the 5' partner
:param chrB: The chromosome for the 3' partner
:param posA: The genomic breakpoint for the 5' partner
:param posB: The genomic breakpoint for the 3' partner
:param gene_5prime: The gene symbol for the 5' partner
:param gene_3prime: The gene symbol for the 3' partner
:param chr_5prime: The chromosome for the 5' partner
:param chr_3prime: The chromosome for the 3' partner
:param pos_5prime: The genomic breakpoint for the 5' partner
:param pos_3prime: The genomic breakpoint for the 3' partner
:param sv_ort: Whether the mapping orientation of assembled contig has
jarbesfeld marked this conversation as resolved.
Show resolved Hide resolved
confident biological meaning
:param event_type: The structural variation event that created the called fusion
Expand All @@ -490,7 +490,7 @@ async def from_cicero(
# gene symbols for `gene_a` or `gene_b`, which are separated by a column. As
jarbesfeld marked this conversation as resolved.
Show resolved Hide resolved
# there is not a precise way to resolve this ambiguity, we do not process
# these events
if "," in gene_a or "," in gene_b:
if "," in gene_5prime or "," in gene_3prime:
msg = "Ambiguous gene symbols are reported by CICERO for at least one of the fusion partners"
_logger.warning(msg)
return msg
Expand All @@ -502,21 +502,21 @@ async def from_cicero(
_logger.warning(msg)
return msg

gene_5prime = self._get_gene_element(gene_a, "cicero")[0].gene.label
gene_3prime = self._get_gene_element(gene_b, "cicero")[0].gene.label
gene_5prime = self._get_gene_element(gene_5prime, "cicero")[0].gene.label
gene_3prime = self._get_gene_element(gene_3prime, "cicero")[0].gene.label

tr_5prime = await self.fusor.transcript_segment_element(
tx_to_genomic_coords=False,
genomic_ac=self._get_genomic_ac(chr_a, rb),
seg_end_genomic=pos_a,
genomic_ac=self._get_genomic_ac(chr_5prime, rb),
seg_end_genomic=pos_5prime,
gene=gene_5prime,
get_nearest_transcript_junction=True,
)

tr_3prime = await self.fusor.transcript_segment_element(
tx_to_genomic_coords=False,
genomic_ac=self._get_genomic_ac(chr_b, rb),
seg_start_genomic=pos_b,
genomic_ac=self._get_genomic_ac(chr_3prime, rb),
seg_start_genomic=pos_3prime,
gene=gene_3prime,
get_nearest_transcript_junction=True,
)
Expand Down
96 changes: 48 additions & 48 deletions tests/test_translators.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,68 +368,68 @@ async def test_cicero(
):
"""Test CICERO translator"""
# Test exonic breakpoint
gene_a = "TPM3"
gene_b = "PDGFRB"
chr_a = "1"
chr_b = "5"
pos_a = 154170465
pos_b = 150126612
gene_5prime = "TPM3"
gene_3prime = "PDGFRB"
chr_5prime = "1"
chr_3prime = "5"
pos_5prime = 154170465
pos_3prime = 150126612
sv_ort = ">"
event_type = "CTX"

cicero_fusor = await translator_instance.from_cicero(
gene_a,
gene_b,
chr_a,
chr_b,
pos_a,
pos_b,
gene_5prime,
gene_3prime,
chr_5prime,
chr_3prime,
pos_5prime,
pos_3prime,
sv_ort,
event_type,
Assembly.GRCH38.value,
)
assert cicero_fusor.structure == fusion_data_example.structure

# Test non-exonic breakpoint
gene_a = "TPM3"
gene_b = "PDGFRB"
chr_a = "1"
chr_b = "5"
pos_a = 154173078
pos_b = 150127173
gene_5prime = "TPM3"
gene_3prime = "PDGFRB"
chr_5prime = "1"
chr_3prime = "5"
pos_5prime = 154173078
pos_3prime = 150127173
sv_ort = ">"
event_type = "CTX"

cicero_fusor_nonexonic = await translator_instance.from_cicero(
gene_a,
gene_b,
chr_a,
chr_b,
pos_a,
pos_b,
gene_5prime,
gene_3prime,
chr_5prime,
chr_3prime,
pos_5prime,
pos_3prime,
sv_ort,
event_type,
Assembly.GRCH38.value,
)
assert cicero_fusor_nonexonic.structure == fusion_data_example_nonexonic.structure

# Test case where the called fusion does not have confident biological meaning
gene_a = "TPM3"
gene_b = "PDGFRB"
chr_a = "1"
chr_b = "5"
pos_a = 154173078
pos_b = 150127173
gene_5prime = "TPM3"
gene_3prime = "PDGFRB"
chr_5prime = "1"
chr_3prime = "5"
pos_5prime = 154173078
pos_3prime = 150127173
sv_ort = "?"
event_type = "CTX"

non_confident_bio = await translator_instance.from_cicero(
gene_a,
gene_b,
chr_a,
chr_b,
pos_a,
pos_b,
gene_5prime,
gene_3prime,
chr_5prime,
chr_3prime,
pos_5prime,
pos_3prime,
sv_ort,
event_type,
Assembly.GRCH38.value,
Expand All @@ -440,22 +440,22 @@ async def test_cicero(
)

# Test case where multiple gene symbols are reported for a fusion partner
gene_a = "TPM3"
gene_b = "PDGFRB,PDGFRB-FGFR4,FGFR4"
chr_a = "1"
chr_b = "5"
pos_a = 154173078
pos_b = 150127173
gene_5prime = "TPM3"
gene_3prime = "PDGFRB,PDGFRB-FGFR4,FGFR4"
chr_5prime = "1"
chr_3prime = "5"
pos_5prime = 154173078
pos_3prime = 150127173
sv_ort = "?"
event_type = "CTX"

multiple_genes_fusion_partner = await translator_instance.from_cicero(
gene_a,
gene_b,
chr_a,
chr_b,
pos_a,
pos_b,
gene_5prime,
gene_3prime,
chr_5prime,
chr_3prime,
pos_5prime,
pos_3prime,
sv_ort,
event_type,
Assembly.GRCH38.value,
Expand Down