diff options
-rw-r--r-- | gn3/commands.py | 10 | ||||
-rw-r--r-- | scripts/partial_correlations.py | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gn3/commands.py b/gn3/commands.py index 0a74b7d..0b8db5b 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -67,9 +67,17 @@ def compose_pcorrs_command( primary_trait: str, control_traits: Tuple[str, ...], method: str, **kwargs): """Compose the command to run partias correlations""" + def __parse_method__(method): + mthd = method.lower().replace("'", "") + if "pearsons" in mthd: + return "pearsons" + if "spearmans" in mthd: + return "spearmans" + raise Exception(f"Invalid method '{method}'") + prefix_cmd = ( f"{sys.executable}", "-m", "scripts.partial_correlations", - primary_trait, ",".join(control_traits), method) + primary_trait, ",".join(control_traits), __parse_method__(method)) if ( kwargs.get("target_database") is not None and kwargs.get("target_traits") is None): diff --git a/scripts/partial_correlations.py b/scripts/partial_correlations.py index d28a17a..1fbab78 100644 --- a/scripts/partial_correlations.py +++ b/scripts/partial_correlations.py @@ -107,7 +107,7 @@ def process_cli_arguments(): "method", help="The correlation method to use", type=str, - choices=("Pearson's r", "Spearman's rho")) + choices=("pearsons", "spearmans")) against_db_parser(against_traits_parser( parser.add_subparsers( title="subcommands", |