diff options
author | Alexander Kabui | 2021-06-20 09:04:55 +0300 |
---|---|---|
committer | Alexander Kabui | 2021-06-20 09:04:55 +0300 |
commit | 864f231bbdbe2c3b3c96b0158a15811ac7790c3f (patch) | |
tree | d0d0eee217c984bd72ecfacc0b131848fcb5b89d /gn3/computations/biweight.py | |
parent | b566a8950864a373f95ae2914b862e9846297b2d (diff) | |
download | genenetwork3-864f231bbdbe2c3b3c96b0158a15811ac7790c3f.tar.gz |
make requested changes to biweight
Diffstat (limited to 'gn3/computations/biweight.py')
-rw-r--r-- | gn3/computations/biweight.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/gn3/computations/biweight.py b/gn3/computations/biweight.py index e598a5b..f5eecb2 100644 --- a/gn3/computations/biweight.py +++ b/gn3/computations/biweight.py @@ -1,20 +1,17 @@ - - -"""module contains script to call biweight mid\ -correlation in R""" +"""module contains script to call biweight midcorrelation in R""" import subprocess -import os -from pathlib import Path + from typing import List +from typing import Tuple -FILE_PATH = os.path.join(Path(__file__).parent.absolute(), "biweight.R") +from gn3.settings import BIWEIGHT_RSCRIPT -def call_biweight_script(trait_vals: List, - target_vals: List, - path_to_script: str = FILE_PATH, - command: str = "Rscript" - ): +def calculate_biweight_corr(trait_vals: List, + target_vals: List, + path_to_script: str = BIWEIGHT_RSCRIPT, + command: str = "Rscript" + ) -> Tuple[float, float]: '''biweight function''' args_1 = ' '.join(str(trait_val) for trait_val in trait_vals) @@ -23,4 +20,6 @@ def call_biweight_script(trait_vals: List, results = subprocess.check_output(cmd, universal_newlines=True) - return tuple([float(y) for y in results.split()]) + (corr_coeff, p_val) = tuple([float(y) for y in results.split()]) + + return (corr_coeff, p_val) |