aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-11-18 11:59:53 +0300
committerFrederick Muriuki Muriithi2021-11-18 11:59:53 +0300
commit3dd5fbda7e08999b6470cfe1fbbd19d767adea9b (patch)
treefed4d0ae18d8d39a35184c7e9d80bd942c9f37a3 /gn3
parent21fbbfd599c841f082d88ddfc5f4cb362e1eb869 (diff)
downloadgenenetwork3-3dd5fbda7e08999b6470cfe1fbbd19d767adea9b.tar.gz
Fix some linting errors
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Fix some obvious linting errors and remove obsolete code
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/partial_correlations.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index 4b0cf30..ee47290 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -280,7 +280,7 @@ def build_data_frame(
return interm_df
def compute_partial(
- primary_val, control_vals, target_vals, target_names,
+ primary_vals, control_vals, target_vals, target_names,
method: str) -> Tuple[
Union[
Tuple[str, int, float, float, float, float], None],
@@ -300,18 +300,22 @@ def compute_partial(
"""
# replace the R code with `pingouin.partial_corr`
def __compute_trait_info__(target):
- df = build_data_frame(
- [prim for targ, prim in zip(target, primary_vals)
- if targ is not None],
+ primary = [
+ prim for targ, prim in zip(target, primary_vals)
+ if targ is not None]
+ datafrm = build_data_frame(
+ primary,
[targ for targ in target if targ is not None],
- [cont for i, cont in enumerate(control) if target[i] is not None])
- covariates = "z" if df.shape[1] == 3 else [
- col for col in df.columns if col not in ("x", "y")]
+ [cont for i, cont in enumerate(control_vals)
+ if target[i] is not None])
+ covariates = "z" if datafrm.shape[1] == 3 else [
+ col for col in datafrm.columns if col not in ("x", "y")]
ppc = pingouin.partial_corr(
- data=df, x="x", y="y", covar=covariates, method=method)
+ data=datafrm, x="x", y="y", covar=covariates, method=method)
pc_coeff = ppc["r"]
- zero_order_corr = pingouin.corr(df["x"], df["y"], method=method)
+ zero_order_corr = pingouin.corr(
+ datafrm["x"], datafrm["y"], method=method)
if math.isnan(pc_coeff):
return (