Skip to content

Commit

Permalink
Merge pull request #114 from bcgsc/feature/make-preferred-gene-source…
Browse files Browse the repository at this point in the history
…-configurable

Feature/make preferred gene source configurable
  • Loading branch information
elewis2 authored Jan 11, 2024
2 parents f2bc298 + d520623 commit 15180c6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions graphkb/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ def get_preferred_gene_name(
return gene_names[0]


def get_cancer_predisposition_info(conn: GraphKBConnection) -> Tuple[List[str], Dict[str, str]]:
def get_cancer_predisposition_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
"""
Return two lists from GraphKB, one of cancer predisposition genes and one of associated variants.
Expand Down Expand Up @@ -287,7 +289,7 @@ def get_cancer_predisposition_info(conn: GraphKBConnection) -> Tuple[List[str],
if name and biotype == "gene":
genes.add(name)
elif name:
gene = get_preferred_gene_name(conn, name)
gene = get_preferred_gene_name(conn, name, source)
if gene:
infer_genes.add((gene, name, biotype))
else:
Expand All @@ -306,7 +308,9 @@ def get_cancer_predisposition_info(conn: GraphKBConnection) -> Tuple[List[str],
return sorted(genes), variants


def get_pharmacogenomic_info(conn: GraphKBConnection) -> Tuple[List[str], Dict[str, str]]:
def get_pharmacogenomic_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
"""
Return two lists from GraphKB, one of pharmacogenomic genes and one of associated variants.
Expand Down Expand Up @@ -362,7 +366,7 @@ def get_pharmacogenomic_info(conn: GraphKBConnection) -> Tuple[List[str], Dict[s
if name and biotype == "gene":
genes.add(name)
elif name:
gene = get_preferred_gene_name(conn, name)
gene = get_preferred_gene_name(conn, name, source)
if gene:
infer_genes.add((gene, name, biotype))
else:
Expand Down

0 comments on commit 15180c6

Please sign in to comment.