aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/species.py
diff options
context:
space:
mode:
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