aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/species.py
diff options
context:
space:
mode:
authorPjotr Prins2016-06-17 06:48:01 +0000
committerPjotr Prins2016-06-17 06:48:01 +0000
commit93e3878c8b97ecbf28630e4bb3733a29f4cf45aa (patch)
treeef92de7c75b7899b406e99c97006a7e2b20bd86b /wqflask/base/species.py
parenteb84f7c0e384e08b810e052fd3935f6d977b7ea2 (diff)
parent10df36b60273d81678f6630c07a2d8e5a6409282 (diff)
downloadgenenetwork2-93e3878c8b97ecbf28630e4bb3733a29f4cf45aa.tar.gz
Conflict
Diffstat (limited to 'wqflask/base/species.py')
-rwxr-xr-xwqflask/base/species.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/wqflask/base/species.py b/wqflask/base/species.py
index 52bd8297..79d867c8 100755
--- a/wqflask/base/species.py
+++ b/wqflask/base/species.py
@@ -24,21 +24,21 @@ class TheSpecies(object):
# for counter, genotype in enumerate(self.dataset.group.genotype):
# if len(genotype) > 1:
# chromosomes.append((genotype.name, counter))
- #
- # print("chromosomes is: ", pf(chromosomes))
- #
+ #
+ # print("chromosomes is: ", pf(chromosomes))
+ #
# return chromosomes
class IndChromosome(object):
def __init__(self, name, length):
self.name = name
self.length = length
-
+
@property
def mb_length(self):
"""Chromosome length in megabases"""
return self.length / 1000000
-
+
def set_cm_length(self, genofile_chr):
self.cm_length = genofile_chr[-1].cM - genofile_chr[0].cM
@@ -61,19 +61,19 @@ class Chromosomes(object):
for item in results:
self.chromosomes[item.OrderId] = IndChromosome(item.Name, item.Length)
-
+
self.set_mb_graph_interval()
#self.get_cm_length_list()
def set_mb_graph_interval(self):
"""Empirical megabase interval"""
-
+
if self.chromosomes:
self.mb_graph_interval = self.get_genome_mb_length()/(len(self.chromosomes)*12)
else:
self.mb_graph_interval = 1
-
+
#if self.chromosomes:
#assert self.chromosomes, "Have to add some code back in apparently to set it to 1"
#self.mb_graph_interval = self.get_genome_mb_length()/(len(self.chromosomes)*12)
@@ -94,30 +94,30 @@ class Chromosomes(object):
def get_cm_length_list(self):
"""Chromosome length in centimorgans
-
+
Calculates the length in centimorgans by subtracting the centimorgan position
of the last marker in a chromosome by the position of the first marker
-
+
"""
-
+
self.dataset.group.read_genotype_file()
-
+
self.cm_length_list = []
-
+
for chromosome in self.dataset.group.genotype:
self.cm_length_list.append(chromosome[-1].cM - chromosome[0].cM)
-
+
print("self.cm_length_list:", pf(self.cm_length_list))
-
+
assert len(self.cm_length_list) == len(self.chromosomes), "Uh-oh lengths should be equal!"
for counter, chromosome in enumerate(self.chromosomes.values()):
chromosome.cm_length = self.cm_length_list[counter]
#self.chromosomes[counter].cm_length = item
-
+
for key, value in self.chromosomes.items():
print("bread - %s: %s" % (key, pf(vars(value))))
-
-# Testing
-#if __name__ == '__main__':
+
+# Testing
+#if __name__ == '__main__':
# foo = dict(bar=dict(length)) \ No newline at end of file