aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/correlations.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-10-26 08:59:30 +0300
committerFrederick Muriuki Muriithi2021-10-26 08:59:30 +0300
commitb7c77e2e846a6ddcf308fef5dfb9941f44d6e72a (patch)
treeca5337f25edf42abd4a5d87441e2400572ab1634 /gn3/db/correlations.py
parentc13afb3af166d2b01e4f9fd9b09bb231f0a63cb1 (diff)
downloadgenenetwork3-b7c77e2e846a6ddcf308fef5dfb9941f44d6e72a.tar.gz
Implement `fetch_gene_symbol_tissue_value_dict_for_trait`
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `fetch_gene_symbol_tissue_value_dict_for_trait` function which is a migration of the `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait` function in GeneNetwork1.
Diffstat (limited to 'gn3/db/correlations.py')
-rw-r--r--gn3/db/correlations.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py
index 87ab082..cae8080 100644
--- a/gn3/db/correlations.py
+++ b/gn3/db/correlations.py
@@ -266,7 +266,22 @@ def fetch_tissue_probeset_xref_info(
(tuple(), {}, {}, {}, {}, {}, {}))
def correlations_of_all_tissue_traits() -> Tuple[dict, dict]:
+def fetch_gene_symbol_tissue_value_dict_for_trait(
+ gene_name_list: Tuple[str, ...], probeset_freeze_id: int,
+ conn: Any) -> dict:
+ """
+ Fetches a map of the gene symbols to the tissue values.
+
+ This is a migration of the
+ `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait`
+ function in GeneNetwork1.
"""
+ xref_info = fetch_tissue_probeset_xref_info(
+ gene_name_list, probeset_freeze_id, conn)
+ if xref_info[0]:
+ return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn)
+ return {}
+
This is a migration of the
`web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait`
function in GeneNetwork1.