aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-05-24 04:46:57 +0300
committerFrederick Muriuki Muriithi2022-05-24 05:16:55 +0300
commit36f8421a8fe223189ab88ee1df3923719ffa4fc0 (patch)
tree7f79b4f594ec787190c9a7c7dcbdd4bec40a0db1 /gn3/computations
parent63d9c9932721e98a9d6715686214157e276af105 (diff)
downloadgenenetwork3-36f8421a8fe223189ab88ee1df3923719ffa4fc0.tar.gz
New script to compute partial correlations
* Add a new script to compute the partial correlations against: - a select list of traits, or - an entire dataset depending on the specified subcommand. This new script is meant to supercede the `scripts/partial_correlations.py` script. * Fix the check for errors * Reorganise the order of arguments for the `partial_correlations_with_target_traits` function: move the `method` argument before the `target_trait_names` argument so that the common arguments in the partial correlation computation functions share the same order.
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/partial_correlations.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index 530dd71..f316f67 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -681,7 +681,7 @@ def partial_correlations_with_target_db(# pylint: disable=[R0913, R0914, R0911]
check_res = check_for_common_errors(
conn, primary_trait_name, control_trait_names, threshold)
- if check_res.get("status") == "error":
+ if check_res.get("status") != "success":
return check_res
primary_trait = check_res["primary_trait"]
@@ -819,15 +819,15 @@ def partial_correlations_with_target_db(# pylint: disable=[R0913, R0914, R0911]
def partial_correlations_with_target_traits(
conn: Any, primary_trait_name: str,
- control_trait_names: Tuple[str, ...],
- target_trait_names: Tuple[str, ...], method: str) -> dict:
+ control_trait_names: Tuple[str, ...], method: str,
+ target_trait_names: Tuple[str, ...]) -> dict:
"""
Compute partial correlation against a specific selection of traits.
"""
threshold = 0
check_res = check_for_common_errors(
conn, primary_trait_name, control_trait_names, threshold)
- if check_res.get("status") == "error":
+ if check_res.get("status") != "success":
return check_res
target_traits = {