diff options
author | zsloan | 2021-07-09 16:49:42 -0500 |
---|---|---|
committer | GitHub | 2021-07-09 16:49:42 -0500 |
commit | bce7aaab7d65309dc0e755a74bf8339a721f2cd9 (patch) | |
tree | 9819308f9ae2a56b2810001720c0c44aa49d8558 /wqflask/base | |
parent | bc2869179f2483d9ad5995d3abb0c9dbc1024acd (diff) | |
parent | 9f823f4e07be834d5c9e918902f7cf626b85dcba (diff) | |
download | genenetwork2-bce7aaab7d65309dc0e755a74bf8339a721f2cd9.tar.gz |
Merge pull request #587 from zsloan/feature/use_gn3_for_correlations
Feature/use gn3 for correlations
Diffstat (limited to 'wqflask/base')
-rw-r--r-- | wqflask/base/data_set.py | 12 | ||||
-rw-r--r-- | wqflask/base/trait.py | 17 |
2 files changed, 25 insertions, 4 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 6dc44829..4cb82665 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -557,6 +557,7 @@ class DataSet: self.fullname = None self.type = None self.data_scale = None # ZS: For example log2 + self.accession_id = None self.setup() @@ -573,6 +574,17 @@ class DataSet: self.group.get_samplelist() self.species = species.TheSpecies(self) + def as_dict(self): + return { + 'name': self.name, + 'shortname': self.shortname, + 'fullname': self.fullname, + 'type': self.type, + 'data_scale': self.data_scale, + 'group': self.group.name, + 'accession_id': self.accession_id + } + def get_accession_id(self): if self.type == "Publish": results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index d09cfd40..10851e00 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -284,17 +284,19 @@ def get_sample_data(): return None -def jsonable(trait): +def jsonable(trait, dataset=None): """Return a dict suitable for using as json Actual turning into json doesn't happen here though""" - dataset = create_dataset(dataset_name=trait.dataset.name, - dataset_type=trait.dataset.type, - group_name=trait.dataset.group.name) + if not dataset: + dataset = create_dataset(dataset_name=trait.dataset.name, + dataset_type=trait.dataset.type, + group_name=trait.dataset.group.name) if dataset.type == "ProbeSet": return dict(name=trait.name, + view=trait.view, symbol=trait.symbol, dataset=dataset.name, dataset_name=dataset.shortname, @@ -308,37 +310,44 @@ def jsonable(trait): elif dataset.type == "Publish": if trait.pubmed_id: return dict(name=trait.name, + view=trait.view, dataset=dataset.name, dataset_name=dataset.shortname, description=trait.description_display, abbreviation=trait.abbreviation, authors=trait.authors, + pubmed_id=trait.pubmed_id, pubmed_text=trait.pubmed_text, pubmed_link=trait.pubmed_link, + mean=trait.mean, lrs_score=trait.LRS_score_repr, lrs_location=trait.LRS_location_repr, additive=trait.additive ) else: return dict(name=trait.name, + view=trait.view, dataset=dataset.name, dataset_name=dataset.shortname, description=trait.description_display, abbreviation=trait.abbreviation, authors=trait.authors, pubmed_text=trait.pubmed_text, + mean=trait.mean, lrs_score=trait.LRS_score_repr, lrs_location=trait.LRS_location_repr, additive=trait.additive ) elif dataset.type == "Geno": return dict(name=trait.name, + view=trait.view, dataset=dataset.name, dataset_name=dataset.shortname, location=trait.location_repr ) elif dataset.name == "Temp": return dict(name=trait.name, + view=trait.view, dataset="Temp", dataset_name="Temp") else: |