aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-11-29 11:52:26 +0300
committerFrederick Muriuki Muriithi2021-11-29 12:05:16 +0300
commit6b147173d514093ec4e461f5843170c968290e5e (patch)
tree2ab665a999b32773803621c006a77f10db9bb353 /gn3/db
parent109b233f698a2ce41bb5634f12e966ad02798819 (diff)
downloadgenenetwork3-6b147173d514093ec4e461f5843170c968290e5e.tar.gz
Provide entry-point function for the partial correlations
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Provide the entry-point function to the partial correlation feature. This is the function that ochestrates the fetching of the data, and processing it for output by the API endpoint (to be implemented).
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/correlations.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py
index 401fd91..2a38bae 100644
--- a/gn3/db/correlations.py
+++ b/gn3/db/correlations.py
@@ -10,8 +10,6 @@ from gn3.random import random_string
from gn3.data_helpers import partition_all
from gn3.db.species import translate_to_mouse_gene_id
-from gn3.computations.partial_correlations import correlations_of_all_tissue_traits
-
def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[
str, bool]:
"""
@@ -282,6 +280,15 @@ def build_temporary_tissue_correlations_table(
# We should probably pass the `correlations_of_all_tissue_traits` function
# as an argument to this function and get rid of the one call immediately
# following this comment.
+ from gn3.computations.partial_correlations import correlations_of_all_tissue_traits
+ # This import above is necessary within the function to avoid
+ # circular-imports.
+ #
+ #
+ # This import above is indicative of convoluted code, with the computation
+ # being interwoven with the data retrieval. This needs to be changed, such
+ # that the function being imported here is no longer necessary, or have the
+ # imported function passed to this function as an argument.
symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits(
fetch_gene_symbol_tissue_value_dict_for_trait(
(trait_symbol,), probeset_freeze_id, conn),