aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorAlexander Kabui2021-04-16 02:42:02 +0300
committerAlexander Kabui2021-04-16 02:42:02 +0300
commit114f80d96d8bd8742b74a0aefdcbdcd22c42767b (patch)
treeba5c66284cd7e484009b4b1c8a1533842140ca1c /gn3/computations
parent6c14eccb7a10cc598d4fa7ee4036cb44bddd9627 (diff)
downloadgenenetwork3-114f80d96d8bd8742b74a0aefdcbdcd22c42767b.tar.gz
add benchmark function for sample r
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/correlations.py54
1 files changed, 27 insertions, 27 deletions
diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py
index 90b6c8c..a311b8d 100644
--- a/gn3/computations/correlations.py
+++ b/gn3/computations/correlations.py
@@ -152,42 +152,42 @@ def compute_all_sample_correlation(this_trait,
return corr_results
- def benchmark_compute_all_sample(this_trait,
- target_datasets,
- corr_method="pearson") ->List:
- """Temp function to benchmark with compute_all_sample_r
- """
+def benchmark_compute_all_sample(this_trait,
+ target_dataset,
+ corr_method="pearson") ->List:
+ """Temp function to benchmark with compute_all_sample_r
+ """
- this_trait_samples = this_trait["trait_sample_data"]
+ this_trait_samples = this_trait["trait_sample_data"]
- corr_results = []
+ corr_results = []
- for target_trait in target_dataset:
- trait_id = target_trait.get("trait_id")
- target_trait_data = target_trait["trait_sample_data"]
- this_vals, target_vals = filter_shared_sample_keys(
- this_trait_samples, target_trait_data)
+ for target_trait in target_dataset:
+ trait_id = target_trait.get("trait_id")
+ target_trait_data = target_trait["trait_sample_data"]
+ this_vals, target_vals = filter_shared_sample_keys(
+ this_trait_samples, target_trait_data)
- sample_correlation = compute_sample_r_correlation(
- corr_method=corr_method,
- trait_vals=this_vals,
- target_samples_vals=target_vals)
+ sample_correlation = compute_sample_r_correlation(
+ corr_method=corr_method,
+ trait_vals=this_vals,
+ target_samples_vals=target_vals)
- if sample_correlation is not None:
- (corr_coeffient, p_value, num_overlap) = sample_correlation
+ if sample_correlation is not None:
+ (corr_coeffient, p_value, num_overlap) = sample_correlation
- else:
- continue
+ else:
+ continue
- corr_result = {
- "corr_coeffient": corr_coeffient,
- "p_value": p_value,
- "num_overlap": num_overlap
- }
+ corr_result = {
+ "corr_coeffient": corr_coeffient,
+ "p_value": p_value,
+ "num_overlap": num_overlap
+ }
- corr_results.append({trait_id: corr_result})
+ corr_results.append({trait_id: corr_result})
- return corr_results
+ return corr_results
def tissue_lit_corr_for_probe_type(corr_type: str, top_corr_results):