aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/species.py
diff options
context:
space:
mode:
authorzsloan2016-06-20 11:03:20 -0500
committerGitHub2016-06-20 11:03:20 -0500
commit8222ef16d443dc41db9d7e09b1af400d8d866854 (patch)
treee4f5b49aa21c32aa2b770b1a65c8fef7782b625f /wqflask/base/species.py
parentd90dc3748557d1d6fbaa59f71fe676b8a7c393ca (diff)
parent10df36b60273d81678f6630c07a2d8e5a6409282 (diff)
downloadgenenetwork2-8222ef16d443dc41db9d7e09b1af400d8d866854.tar.gz
Merge pull request #168 from genenetwork/staging
Staging
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