diff options
author | Zachary Sloan | 2013-01-08 14:46:07 -0600 |
---|---|---|
committer | Zachary Sloan | 2013-01-08 14:46:07 -0600 |
commit | c8a4719a83e3ee65a8c03b0b600a3cfea9ff17bf (patch) | |
tree | 40e1c27050964d4339ce631cea7553fd5dae52ab /wqflask/base/species.py | |
parent | f15e39f5251ff3689e4a065d11c1edd36f5e4811 (diff) | |
download | genenetwork2-c8a4719a83e3ee65a8c03b0b600a3cfea9ff17bf.tar.gz |
Deleted some unnecessary code in marker_regression.py and fixed some bugs
Added a couple utility functions to the Chromosomes class in species.py
Diffstat (limited to 'wqflask/base/species.py')
-rw-r--r-- | wqflask/base/species.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 1fd76772..85f076ca 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -13,7 +13,8 @@ class TheSpecies(object): self.dataset = dataset print("self.dataset is:", pf(self.dataset.__dict__)) self.chromosomes = Chromosomes(self.dataset.group.name) - + self.genome_length = self.chromosomes.get_genome_length() + #@property #def chromosomes(self): # chromosomes = [("All", -1)] @@ -31,7 +32,7 @@ class TheSpecies(object): class Chromosomes(object): def __init__(self, group_name): self.chromosomes = collections.OrderedDict() - + results = g.db.execute(""" Select Chr_Length.Name, Length from Chr_Length, InbredSet @@ -46,3 +47,20 @@ class Chromosomes(object): self.chromosomes[item.Name] = item.Length print("self.chromosomes:", self.chromosomes) + + + def get_mb_length(self): + """Gets the chromosome length in megabases""" + + mb_lengths = chr_length/1000000.0 for name, chr_length in self.chromosomes + + return mb_lengths + + def get_genome_length(self): + """Gets the sum of each chromosome's length""" + + genome_length = 0 + for name, value in self.chromosomes.items(): + genome_length += value + + return genome_length
\ No newline at end of file |