aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/traits.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-08-31 10:50:56 +0300
committerMuriithi Frederick Muriuki2021-08-31 10:50:56 +0300
commite441509a59c20a051fd5ab94710513f1968a5e02 (patch)
tree88da10c528f6d4cee8cbb111d83c47a4bf9b555a /gn3/db/traits.py
parentc3f8013347e3e8850c90cb787edb2bec1f367f7d (diff)
downloadgenenetwork3-e441509a59c20a051fd5ab94710513f1968a5e02.tar.gz
Update `heatmap_data` function: remove extraneous data
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/heatmap.py: update function * gn3/db/traits.py: new function Remove extraneous data and arguments from the function. - Load the genotype file - Generate traits file - Provide both raw traits data, and exported traits data in return
Diffstat (limited to 'gn3/db/traits.py')
-rw-r--r--gn3/db/traits.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gn3/db/traits.py b/gn3/db/traits.py
index 1031e44..ccb101a 100644
--- a/gn3/db/traits.py
+++ b/gn3/db/traits.py
@@ -1,4 +1,5 @@
"""This class contains functions relating to trait data manipulation"""
+from gn3.settings import TMPDIR
from typing import Any, Dict, Union, Sequence
from gn3.function_helpers import compose
from gn3.db.datasets import retrieve_trait_dataset
@@ -666,3 +667,7 @@ def retrieve_trait_data(trait: dict, conn: Any, strainlist: Sequence[str] = tupl
{k:v for k, v in x.items() if x != "strain_name"}),
data))}
return {}
+
+def generate_traits_filename(base_path: str = TMPDIR):
+ return "{}/traits_test_file_{}.txt".format(
+ os.path.abspath(base_path), random_string(10))