aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-01-24 15:24:59 +0300
committerFrederick Muriuki Muriithi2022-01-27 10:02:02 +0300
commit7bc3d9a11ee1e5a863a01a91abd7510bdbfae54e (patch)
tree2592a5db5ac644846e0383062fa2dfabd30e9c8f /gn3/computations
parentf9dfc61b4fe5d78c6a09adbeafa28a4e5d91c2ad (diff)
downloadgenenetwork3-7bc3d9a11ee1e5a863a01a91abd7510bdbfae54e.tar.gz
Refactor: Remove circular importrefactor-circular-import
The function `gn3.computation.partial_correlations.correlations_of_all_tissue_traits` was, before this commit, called inside the `gn3.db.correlations.build_temporary_tissue_correlations_table` function, leading to a circular dependency. This commit removes the circular dependency by rearranging the calls.
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/partial_correlations.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index 9bad12a..4b35c51 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -406,6 +406,12 @@ def partial_corrs(# pylint: disable=[R0913]
`web.webqtl.correlation.PartialCorrDBPage.__init__` function in
GeneNetwork1.
"""
+ symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits(
+ fetch_gene_symbol_tissue_value_dict_for_trait(
+ (input_trait_symbol,), tissue_probeset_freeze_id, conn),
+ fetch_gene_symbol_tissue_value_dict_for_trait(
+ tuple(), tissue_probeset_freeze_id, conn),
+ method)
if database_filename:
return partial_correlations_fast(
samples, primary_vals, control_vals, database_filename,
@@ -414,15 +420,15 @@ def partial_corrs(# pylint: disable=[R0913]
species, input_trait_geneid, dataset, return_number, conn)
if "literature" in method.lower() else
fetch_tissue_correlations(
- dataset, input_trait_symbol, tissue_probeset_freeze_id,
- method, return_number, conn)),
+ dataset, symbol_corr_dict, symbol_p_value_dict,
+ return_number, conn)),
method,
("literature" if method.lower() == "sgo literature correlation"
else ("tissue" if "tissue" in method.lower() else "genetic")))
trait_database, data_start_pos = fetch_all_database_data(
- conn, species, input_trait_geneid, input_trait_symbol, samples, dataset,
- method, return_number, tissue_probeset_freeze_id)
+ conn, species, input_trait_geneid, samples, dataset, method,
+ symbol_corr_dict, symbol_p_value_dict, return_number)
return partial_correlations_normal(
primary_vals, control_vals, input_trait_geneid, trait_database,
data_start_pos, dataset, method)