fusor.fusion_matching

Module for matching assayed fusions against categorical fusions

class fusor.fusion_matching.FusionMatcher(cache_dir=None, assayed_fusions=None, comparator_fusions=None, cache_files=None)[source]

Class for matching assayed fusions against assayed fusions and categorical fusions

__init__(cache_dir=None, assayed_fusions=None, comparator_fusions=None, cache_files=None)[source]

Initialize FusionMatcher class and comparator categorical fusion objects

Parameters:
  • cache_dir (Optional[Path]) – The directory containing the cached categorical fusions files. If this parameter is not provided, it will be set by default to be FUSOR_DATA_DIR.

  • assayed_fusions (Optional[list[AssayedFusion]]) – A list of AssayedFusion objects

  • comparator_fusions (Optional[list[AssayedFusion | CategoricalFusion]]) – A list of AssayedFusion or CategoricalFusion objects

  • cache_files (Optional[list[str]]) – A list of cache file names in cache_dir containing AssayedFusion or CategoricalFusion objects to load, or None. By default this is set to None. It assumes that files contain lists of valid AssayedFusion or CategoricalFusion objects.

Raises:

ValueError – If comparator_fusions is not provided and either cache_dir or cache_files is not provided.

async match_fusion()[source]

Return best matching fusion

This method prioritizes using categorical fusion objects that are provided in self.categorical_fusions as opposed those that exist in the cache_dir directory.

Raises:

ValueError – If a list of AssayedFusion objects is not provided

Return type:

list[Optional[list[tuple[AssayedFusion | CategoricalFusion, MatchType]]]]

Returns:

A list of list of tuples containing matching fusion objects and their associated match type, for each examined AssayedFusion object. This method iterates through all supplied AssayedFusion objects to find corresponding matches. The match type represents how many attributes are shared between an AssayedFusion and comparator fusion. The attributes that are compared include the gene partner, transcript accession, exon number, exon offset, and genomic breakpoint. Matches are returned according to the priority of their match type.

class fusor.fusion_matching.MatchInformation(**data)[source]

Helper for reporting matching information based off of MatchType

determine_match()[source]

Determine match type based on fields in MatchInformation class

Return type:

Optional[MatchType]

Returns:

A MatchType object, or None if no match exists

five_prime_match_info: PartnerMatch[source]
linker: Optional[bool][source]
three_prime_match_info: PartnerMatch[source]
class fusor.fusion_matching.MatchType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enum for defining different match types

EXACT = 'EXACT'[source]
FIVE_PRIME_EXACT = 'FIVE_PRIME_EXACT'[source]
FIVE_PRIME_GENE = 'FIVE_PRIME_GENE'[source]
SHARED_GENES = 'SHARED_GENES'[source]
SHARED_GENES_FIVE_PRIME_EXACT = 'SHARED_GENES_FIVE_PRIME_EXACT'[source]
SHARED_GENES_THREE_PRIME_EXACT = 'SHARED_GENES_THREE_PRIME_EXACT'[source]
THREE_PRIME_EXACT = 'THREE_PRIME_EXACT'[source]
THREE_PRIME_GENE = 'THREE_PRIME_GENE'[source]
property priority: int[source]

Return numeric priority for sorting, where the lower the score indicates the higher quality match

class fusor.fusion_matching.PartnerMatch(**data)[source]

Class for describing matching fields for a fusion partner

breakpoint: bool[source]
exon: bool[source]
exon_offset: bool[source]
gene: bool[source]
property partner_match: bool[source]

Check that all values are set to True

Returns:

True if all fields are True, False if not

transcript: bool[source]