aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-11-22 09:06:52 +0300
committerFrederick Muriuki Muriithi2021-11-22 12:06:47 +0300
commit854416ba850b7793aa9aa95528b89bc69df26888 (patch)
treef3b61260e0c8ca030157adb3823d3227f470d033
parent92d5766f5514181cd6aa82fc0d0f225666e892cb (diff)
downloadgenenetwork3-854416ba850b7793aa9aa95528b89bc69df26888.tar.gz
Make the DB connection argument the first
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * To make the code more composable down the line, make the database connection argument the first argument for functions that access the database, since they will always require the connection.
-rw-r--r--gn3/db/correlations.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py
index 06b3310..f327dc3 100644
--- a/gn3/db/correlations.py
+++ b/gn3/db/correlations.py
@@ -34,7 +34,7 @@ def get_filename(target_db_name: str, conn: Any) -> str:
return ""
def build_temporary_literature_table(
- species: str, gene_id: int, return_number: int, conn: Any) -> str:
+ conn: Any, species: str, gene_id: int, return_number: int) -> str:
"""
Build and populate a temporary table to hold the literature correlation data
to be used in computations.
@@ -128,7 +128,7 @@ def fetch_literature_correlations(
GeneNetwork1.
"""
temp_table = build_temporary_literature_table(
- species, gene_id, return_number, conn)
+ conn, species, gene_id, return_number)
query_fns = {
"Geno": fetch_geno_literature_correlations,
# "Temp": fetch_temp_literature_correlations,
@@ -268,8 +268,8 @@ def fetch_gene_symbol_tissue_value_dict_for_trait(
return {}
def build_temporary_tissue_correlations_table(
- trait_symbol: str, probeset_freeze_id: int, method: str,
- return_number: int, conn: Any) -> str:
+ conn: Any, trait_symbol: str, probeset_freeze_id: int, method: str,
+ return_number: int) -> str:
"""
Build a temporary table to hold the tissue correlations data.
@@ -320,7 +320,7 @@ def fetch_tissue_correlations(# pylint: disable=R0913
GeneNetwork1.
"""
temp_table = build_temporary_tissue_correlations_table(
- trait_symbol, probeset_freeze_id, method, return_number, conn)
+ conn, trait_symbol, probeset_freeze_id, method, return_number)
with conn.cursor() as cursor:
cursor.execute(
(