ipr.ipr¶
Contains functions specific to formatting reports for IPR that are unlikely to be used by other reporting systems
filter_structural_variants()¶
Filter structural variants to remove non-high quality events unless they are matched/annotated or they involve a gene that is a known fusion partner
def filter_structural_variants(
structural_variants: List[IprStructuralVariant],
kb_matches: List[KbMatch],
gene_annotations: List[IprGene],
) -> List[IprStructuralVariant]:
Args
- structural_variants (List[IprStructuralVariant])
- kb_matches (List[KbMatch])
- gene_annotations (List[IprGene])
Returns
- List[IprStructuralVariant]
convert_statements_to_alterations()¶
Given a set of statements matched from graphkb, convert these into their IPR equivalent representations
def convert_statements_to_alterations(
graphkb_conn: GraphKBConnection,
statements: List[Statement],
disease_name: str,
variant_matches: Iterable[str],
) -> List[KbMatch]:
Args
- graphkb_conn (
GraphKBConnection
): the graphkb connection object - statements (
List[Statement]
): list of statement records from graphkb - disease_name (
str
): name of the cancer type for the patient being reported on - variant_matches (
Iterable[str]
): the list of RIDs the variant matched for these statements
Returns
- List[KbMatch]: IPR graphkb row representations Notes: - only report disease matched prognostic markers https://www.bcgsc.ca/jira/browse/GERO-72 and GERO-196
Raises
ValueError
: could not find the disease type in GraphKB
select_expression_plots()¶
Given the list of expression variants, determine which expression historgram plots should be included in the IPR upload. This filters them based on the graphkb annotations to avoid loading more images than are required
def select_expression_plots(
kb_matches: List[KbMatch], all_variants: List[IprVariant]
) -> List[Dict[str, ImageDefinition]]:
Args
- kb_matches (List[KbMatch]): the IPR graphkb annoations for all variants
- all_variants (List[IprVariant])
Returns
- List[Dict[
str
, ImageDefinition]]: list of expression images to be loaded by IPR
create_key_alterations()¶
Creates the list of genomic key alterations which summarizes all the variants matched by the KB This list of matches is also used to create the variant counts
def create_key_alterations(
kb_matches: List[KbMatch],
all_variants: List[IprVariant],
) -> Tuple[List[Dict], Dict]:
Args
- kb_matches (List[KbMatch])
- all_variants (List[IprVariant])
Returns
Tuple[List[Dict], Dict]