aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorzsloan2017-04-05 15:37:29 +0000
committerzsloan2017-04-05 15:37:29 +0000
commit0408cc61181eaeda95bd1f60f76dc5798e315663 (patch)
treeecf1bfa89b1ab93565ed07947da905142c9776d8 /wqflask/base/data_set.py
parent2b14b0d04387a262f9895ddd87ce465c6835fa8c (diff)
downloadgenenetwork2-0408cc61181eaeda95bd1f60f76dc5798e315663.tar.gz
- Temporary traits can be created, viewed, and added to collections
- Correct PCA trait data is created but can't be saved yet - Added inner margins by increasing xDomain and yDomain of probability plot on trait page - Increased X/Y-axis label font size - Turned "processes" to 0 on runserver.py for PROD setting, since it doesn't work with threading - Improved appearance of correlation page table - Added links to github to index page - Removed js_data from GEMMA/PLINK mapping results, since it isn't used for those - Removed "Tissue" from trait page for phenotype traits
Diffstat (limited to 'wqflask/base/data_set.py')
-rw-r--r--wqflask/base/data_set.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 54dd3c4b..7f08135f 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -61,14 +61,17 @@ logger = getLogger(__name__ )
# Each subclass will add to this
DS_NAME_MAP = {}
-def create_dataset(dataset_name, dataset_type = None, get_samplelist = True):
+def create_dataset(dataset_name, dataset_type = None, get_samplelist = True, group_name = None):
if not dataset_type:
dataset_type = Dataset_Getter(dataset_name)
logger.debug("dataset_type", dataset_type)
dataset_ob = DS_NAME_MAP[dataset_type]
dataset_class = globals()[dataset_ob]
- return dataset_class(dataset_name, get_samplelist)
+ if dataset_type == "Temp":
+ return dataset_class(dataset_name, get_samplelist, group_name)
+ else:
+ return dataset_class(dataset_name, get_samplelist)
class Dataset_Types(object):
@@ -261,10 +264,13 @@ class DatasetGroup(object):
has multiple datasets associated with it.
"""
- def __init__(self, dataset):
+ def __init__(self, dataset, name=None):
"""This sets self.group and self.group_id"""
#logger.debug("DATASET NAME2:", dataset.name)
- self.name, self.id, self.genetic_type = fetchone(dataset.query_for_group)
+ if name == None:
+ self.name, self.id, self.genetic_type = fetchone(dataset.query_for_group)
+ else:
+ self.name, self.id, self.genetic_type = fetchone("SELECT InbredSet.Name, InbredSet.Id, InbredSet.GeneticType FROM InbredSet where Name='%s'" % name)
if self.name == 'BXD300':
self.name = "BXD"
@@ -304,7 +310,7 @@ class DatasetGroup(object):
elif mapping_id == "2":
mapping_names = ["GEMMA"]
elif mapping_id == "4":
- mapping_names = ["PLINK"]
+ mapping_names = ["GEMMA", "PLINK"]
else:
mapping_names = []
@@ -319,9 +325,7 @@ class DatasetGroup(object):
def check_plink_gemma():
if flat_file_exists("mapping"):
MAPPING_PATH = flat_files("mapping")+"/"
- if (os.path.isfile(MAPPING_PATH+self.name+".bed") and
- (os.path.isfile(MAPPING_PATH+self.name+".map") or
- os.path.isfile(MAPPING_PATH+self.name+".bim"))):
+ if os.path.isfile(MAPPING_PATH+self.name+".bed"):
return True
return False
@@ -481,7 +485,7 @@ class DataSet(object):
"""
- def __init__(self, name, get_samplelist = True):
+ def __init__(self, name, get_samplelist = True, group_name = None):
assert name, "Need a name"
self.name = name
@@ -493,11 +497,12 @@ class DataSet(object):
self.setup()
- self.check_confidentiality()
-
- self.retrieve_other_names()
-
- self.group = DatasetGroup(self) # sets self.group and self.group_id and gets genotype
+ if self.type == "Temp": #Need to supply group name as input if temp trait
+ self.group = DatasetGroup(self, group_name) # sets self.group and self.group_id and gets genotype
+ else:
+ self.check_confidentiality()
+ self.retrieve_other_names()
+ self.group = DatasetGroup(self) # sets self.group and self.group_id and gets genotype
if get_samplelist == True:
self.group.get_samplelist()
self.species = species.TheSpecies(self)
@@ -1156,6 +1161,8 @@ class MrnaAssayDataSet(DataSet):
class TempDataSet(DataSet):
'''Temporary user-generated data set'''
+ DS_NAME_MAP['Temp'] = 'TempDataSet'
+
def setup(self):
self.search_fields = ['name',
'description']