diff options
author | Alexander_Kabui | 2022-10-26 12:47:48 +0300 |
---|---|---|
committer | Alexander Kabui | 2022-10-27 06:27:02 +0300 |
commit | 5933321ff4077900a8d4ee7fa1588d8a4e52d0e5 (patch) | |
tree | f60a298c267d3f3aa3c3ba49642f0111596324a5 /wqflask | |
parent | df868dc400af039df469f15d6da9c343f15c38cb (diff) | |
download | genenetwork2-5933321ff4077900a8d4ee7fa1588d8a4e52d0e5.tar.gz |
init fix for querying for datasets
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/trait.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 1514bca2..dcd81085 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -24,13 +24,23 @@ def create_trait(**kw): assert bool(kw.get('name')), "Needs trait name" + if bool(kw.get('dataset')): dataset = kw.get('dataset') + + else: if kw.get('dataset_name') != "Temp": + + dataset = create_dataset(kw.get('dataset_name')) else: - dataset = create_dataset("Temp", group_name=kw.get('group_name')) + + dataset = create_dataset( + dataset_name="Temp", + dataset_type="Temp", + group_name= kw.get('name').split("_")[2]) + if dataset.type == 'Publish': permissions = check_resource_availability( @@ -38,8 +48,10 @@ def create_trait(**kw): else: permissions = check_resource_availability(dataset) + if permissions['data'] != "no-access": - the_trait = GeneralTrait(**kw) + + the_trait = GeneralTrait(**dict(kw,dataset=dataset)) if the_trait.dataset.type != "Temp": the_trait = retrieve_trait_info( the_trait, @@ -59,21 +71,11 @@ class GeneralTrait: def __init__(self, get_qtl_info=False, get_sample_info=True, **kw): # xor assertion - assert bool(kw.get('dataset')) != bool( - kw.get('dataset_name')), "Needs dataset ob. or name" + assert kw.get("dataset"), "Dataset obj is needed as a kwarg" + # Trait ID, ProbeSet ID, Published ID, etc. self.name = kw.get('name') - if kw.get('dataset_name'): - if kw.get('dataset_name') == "Temp": - temp_group = self.name.split("_")[2] - self.dataset = create_dataset( - dataset_name="Temp", - dataset_type="Temp", - group_name=temp_group) - else: - self.dataset = create_dataset(kw.get('dataset_name')) - else: - self.dataset = kw.get('dataset') + self.dataset = kw.get("dataset") self.cellid = kw.get('cellid') self.identification = kw.get('identification', 'un-named trait') self.haveinfo = kw.get('haveinfo', False) |