aboutsummaryrefslogtreecommitdiff
path: root/scripts/partial_correlations.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-06 12:31:05 +0300
committerFrederick Muriuki Muriithi2023-04-06 12:31:05 +0300
commit17abad9300e4a96a14f94da486ef8307f7d27e06 (patch)
tree38fe3bfd36be9a821adfc67b83fbbd587ceb8b5e /scripts/partial_correlations.py
parent3d873435f0d464864d4d691d6be4db40931fac05 (diff)
downloadgenenetwork3-17abad9300e4a96a14f94da486ef8307f7d27e06.tar.gz
Remove deprecated `gn3.db_utils.database_connector` function
Remove the deprecated function and fix a myriad of bugs that arise from removing the function. Issue: https://issues.genenetwork.org/issues/bugfix_coupling_current_app_and_db_utils
Diffstat (limited to 'scripts/partial_correlations.py')
-rw-r--r--scripts/partial_correlations.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/partial_correlations.py b/scripts/partial_correlations.py
index 1fbab78..aab8f08 100644
--- a/scripts/partial_correlations.py
+++ b/scripts/partial_correlations.py
@@ -4,7 +4,7 @@ import json
import traceback
from argparse import ArgumentParser
-from gn3.db_utils import database_connector
+from gn3.db_utils import database_connection
from gn3.responses.pcorrs_responses import OutputEncoder
from gn3.computations.partial_correlations import (
partial_correlations_with_target_db,
@@ -108,6 +108,10 @@ def process_cli_arguments():
help="The correlation method to use",
type=str,
choices=("pearsons", "spearmans"))
+ parser.add_argument(
+ "sql_uri",
+ help="The uri to use to connect to the database",
+ type=str)
against_db_parser(against_traits_parser(
parser.add_subparsers(
title="subcommands",
@@ -119,7 +123,7 @@ def main():
"""Entry point for the script"""
args = process_cli_arguments()
- with database_connector() as conn:
+ with database_connection(args.sql_uri) as conn:
print(json.dumps(run_pcorrs(conn, args), cls=OutputEncoder))