aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-10-29 08:25:13 +0300
committerFrederick Muriuki Muriithi2021-10-29 08:25:13 +0300
commit1394adf862f0f6c7f403301faf4dd7812c2d1ea2 (patch)
tree8a2d6601e5cad298e785cad3bce1c5d28111cb1c /gn3
parent6bfc0e9e9bce5e2505588372ce55ba892db6bda0 (diff)
downloadgenenetwork3-1394adf862f0f6c7f403301faf4dd7812c2d1ea2.tar.gz
Rework sorting: remove `compare_tissue_correlation_absolute_values`
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/correlations.py: Remove the `compare_tissue_correlation_absolute_values` function which is no longer needed.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/correlations.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py
index 28f050a..d7954e5 100644
--- a/gn3/db/correlations.py
+++ b/gn3/db/correlations.py
@@ -140,22 +140,6 @@ def fetch_literature_correlations(
cursor.execute("DROP TEMPORARY TABLE %s", temp_table)
return dict(results)
-def compare_tissue_correlation_absolute_values(val1, val2):
- """
- Comparison function for use when sorting tissue correlation values.
-
- This is a partial migration of the
- `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in
- GeneNetwork1."""
- try:
- if abs(val1) < abs(val2):
- return 1
- if abs(val1) == abs(val2):
- return 0
- return -1
- except TypeError:
- return 0
-
def fetch_symbol_value_pair_dict(
symbol_list: Tuple[str, ...], data_id_dict: dict,
conn: Any) -> Dict[str, Tuple[float, ...]]:
@@ -302,8 +286,7 @@ def build_temporary_tissue_correlations_table(
method)
symbol_corr_list = sorted(
- symbol_corr_dict.items(),
- key=compare_tissue_correlation_absolute_values)
+ symbol_corr_dict.items(), key=lambda key_val: key_val[1])
temp_table_name = f"TOPTISSUE{random_string(8)}"
create_query = (