about summary refs log tree commit diff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-12-13 15:56:01 +0300
committerFrederick Muriuki Muriithi2021-12-13 15:56:01 +0300
commit131394ac737aac7e6fced7cfb07f9e9d538b9506 (patch)
tree82c8a9dae60c4f8466ee6ea49fb0f6ba09817a30 /gn3
parent07c94ab13460a2289b386f3a164954ac7920e28c (diff)
downloadgenenetwork3-131394ac737aac7e6fced7cfb07f9e9d538b9506.tar.gz
Run partial correlations against chosen database
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi

* Run the partial correlations against the database that the user selects, and
  not the one from which the primary trait is. This was a bug in the code.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/partial_correlations.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index 719c605..bda6ba2 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -640,12 +640,20 @@ def partial_correlations_entry(# pylint: disable=[R0913, R0914, R0911]
                 "any associated Tissue Correlation Information."),
             "error_type": "Tissue Correlation"}
 
+    target_dataset = retrieve_trait_dataset(
+        ("Temp" if "Temp" in target_db_name else
+         ("Publish" if "Publish" in target_db_name else
+          "Geno" if "Geno" in target_db_name else "ProbeSet")),
+        {"db": {"dataset_name": target_db_name}, "trait_name": "_"},
+        threshold,
+        conn)
+
     database_filename = get_filename(conn, target_db_name, TEXTDIR)
     _total_traits, all_correlations = partial_corrs(
         conn, common_primary_control_samples, fixed_primary_vals,
         fixed_control_vals, len(fixed_primary_vals), species,
         input_trait_geneid, input_trait_symbol, tissue_probeset_freeze_id,
-        method, primary_trait["db"], database_filename)
+        method, {**target_dataset, "dataset_type": target_dataset["type"]}, database_filename)
 
 
     def __make_sorter__(method):