diff options
Diffstat (limited to 'wqflask/base')
-rw-r--r-- | wqflask/base/species.py | 27 | ||||
-rw-r--r-- | wqflask/base/trait.py | 3 | ||||
-rw-r--r-- | wqflask/base/webqtlCaseData.py | 7 |
3 files changed, 29 insertions, 8 deletions
diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 4ac2213c..6d99af65 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -14,10 +14,13 @@ from utility.logger import getLogger logger = getLogger(__name__ ) class TheSpecies(object): - def __init__(self, dataset): - self.dataset = dataset - #print("self.dataset is:", pf(self.dataset.__dict__)) - self.chromosomes = Chromosomes(self.dataset) + def __init__(self, dataset=None, species_name=None): + if species_name != None: + self.name = species_name + self.chromosomes = Chromosomes(species=self.name) + else: + self.dataset = dataset + self.chromosomes = Chromosomes(dataset=self.dataset) class IndChromosome(object): def __init__(self, name, length): @@ -30,11 +33,21 @@ class IndChromosome(object): return self.length / 1000000 class Chromosomes(object): - def __init__(self, dataset): - self.dataset = dataset + def __init__(self, dataset=None, species=None): self.chromosomes = collections.OrderedDict() + if species != None: + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, Species + where + Chr_Length.SpeciesId = Species.SpeciesId AND + Species.Name = '%s' + Order by OrderId + """ % species.capitalize() + else: + self.dataset = dataset - query = """ + query = """ Select Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, InbredSet where diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 3daf9ea9..e57d4176 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -189,7 +189,8 @@ def get_sample_data(): trait_dict['symbol'] = trait_ob.symbol trait_dict['location'] = trait_ob.location_repr elif trait_ob.dataset.type == "Publish": - trait_dict['pubmed_link'] = trait_ob.pubmed_link + if trait_ob.pubmed_id: + trait_dict['pubmed_link'] = trait_ob.pubmed_link trait_dict['pubmed_text'] = trait_ob.pubmed_text return json.dumps([trait_dict, {key: value.value for key, value in trait_ob.data.iteritems() }]) diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index 24de8dcb..76f06cc6 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -77,3 +77,10 @@ class webqtlCaseData(object): return "%2.3f" % self.variance else: return "x" + + @property + def display_num_cases(self): + if self.num_cases != None: + return "%d" % self.num_cases + else: + return "x" |