diff options
author | zsloan | 2016-06-20 16:01:12 +0000 |
---|---|---|
committer | zsloan | 2016-06-20 16:01:12 +0000 |
commit | 30a37c6f1f9a9f759a92fd61876af9e9e3d078b9 (patch) | |
tree | e4f5b49aa21c32aa2b770b1a65c8fef7782b625f /wqflask/base/species.py | |
parent | 4fec0e6fc0772785a30451d417082bc189f2f6dd (diff) | |
parent | 10df36b60273d81678f6630c07a2d8e5a6409282 (diff) | |
download | genenetwork2-30a37c6f1f9a9f759a92fd61876af9e9e3d078b9.tar.gz |
Merge branch 'staging' of github.com:genenetwork/genenetwork2 into development
Diffstat (limited to 'wqflask/base/species.py')
-rwxr-xr-x | wqflask/base/species.py | 38 |
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 |