aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/species.py
diff options
context:
space:
mode:
authorZachary Sloan2013-01-08 14:46:07 -0600
committerZachary Sloan2013-01-08 14:46:07 -0600
commitc8a4719a83e3ee65a8c03b0b600a3cfea9ff17bf (patch)
tree40e1c27050964d4339ce631cea7553fd5dae52ab /wqflask/base/species.py
parentf15e39f5251ff3689e4a065d11c1edd36f5e4811 (diff)
downloadgenenetwork2-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.py22
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