aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorAlexander_Kabui2022-07-08 11:58:23 +0300
committerBonfaceKilz2022-07-22 14:52:08 +0300
commit7b95327210c45e289e0a2420228aeac02feb216b (patch)
treee8249fb6f17db79916ba58905d10e5225a2ce7a7 /gn3/computations
parent10256824e545d8e4115286389ef38f2d2c9735e1 (diff)
downloadgenenetwork3-7b95327210c45e289e0a2420228aeac02feb216b.tar.gz
code to parse tissue correlation input
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/rust_correlation.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/gn3/computations/rust_correlation.py b/gn3/computations/rust_correlation.py
index 0b37144..9f991b2 100644
--- a/gn3/computations/rust_correlation.py
+++ b/gn3/computations/rust_correlation.py
@@ -9,6 +9,8 @@ import json
import os
+from typing import Optional
+
from gn3.computations.qtlreaper import create_output_directory
from gn3.random import random_string
from gn3.settings import CORRELATION_COMMAND
@@ -141,3 +143,28 @@ def get_sample_corr_data(sample_type: str,
data = get_samples(
all_samples=all_samples, base_samples=[], excluded=[])
return data
+
+
+def parse_tissue_corr_data(tt_symbol: list[dict[str, str]],
+ symbols_dict: [str, str],
+ dataset_dict):
+ """get the correct datatype"""
+
+ data = []
+
+ if not (tt_symbol):
+ return [[], []]
+
+ for (name, symbol) in symbols_dict.items():
+ try:
+ exists = dataset_dict.get(symbol.lower())
+ if exists:
+ corr_values = insert(0, name)
+ ",".join([str(dt) for dt in data])
+
+ data.append(corr_values)
+
+ except Exception as e:
+ pass
+
+ return [symbol[0], data]