diff options
author | Frederick Muriuki Muriithi | 2021-10-29 06:59:57 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-11-04 12:45:57 +0300 |
commit | 5a9db2162a0a694a76a256996bb296ff06c75126 (patch) | |
tree | 616f4adcde786d59f2b1b03ca3fea92a91dfe406 /gn3/computations | |
parent | a85db849660a63b09e5c40f7753d861f47eaaaeb (diff) | |
download | genenetwork3-5a9db2162a0a694a76a256996bb296ff06c75126.tar.gz |
Move `correlations_of_all_tissue_traits`
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* gn3/computations/partial_correlations.py: new
function (`correlations_of_all_tissue_traits`).
* gn3/db/correlations.py: delete
function (`correlations_of_all_tissue_traits`).
Move the function to `gn3.computations.partial_correlations` module and
comment out the db-access code.
Rework it to receive, as arguments, the data it previously fetched from the
database, and add comments on future rework to get the function working
again.
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/partial_correlations.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index e73edfd..4ba2ba4 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -157,3 +157,30 @@ def batch_computed_tissue_correlation( `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" raise Exception("Not implemented!") return ({}, {}) + +def correlations_of_all_tissue_traits( + primary_trait_symbol_value_dict: dict, symbol_value_dict: dict, + method: str) -> Tuple[dict, dict]: + """ + Computes and returns the correlation of all tissue traits. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` + function in GeneNetwork1. + """ + # The section below existed in the original function, but with the migration + # and the proposed rework (in the near future), the values from the database + # should be passed into this function, rather than have the function fetch + # the data for itself. + # --------------------------------------------------- + # primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # (trait_symbol,), probeset_freeze_id, conn) + # primary_trait_values = primary_trait_symbol_value_dict.vlaues()[0] + # symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # tuple(), probeset_freeze_id, conn) + # --------------------------------------------------- + # We might end up actually getting rid of this function all together as the + # rework is done. + primary_trait_values = primary_trait_symbol_value_dict.values()[0] + return batch_computed_tissue_correlation( + primary_trait_values, symbol_value_dict, method) |