about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorzsloan2018-10-11 15:43:41 +0000
committerzsloan2018-10-11 15:43:41 +0000
commit261ba5e41408d212cc3c33df658b6be2431f68ad (patch)
tree0ebcdab6a10a1d112dd5a36512352314219fcc56 /wqflask/base
parent65eff561d9527d10a32bea36b660135422e8cce9 (diff)
downloadgenenetwork2-261ba5e41408d212cc3c33df658b6be2431f68ad.tar.gz
- Added fix for GEMMA LOCO
- Added all current SNP browser code (not complete yet)

- Added change to convert_geno_to_bimbam that makes it ignore .geno files marked as "filler" (so ones where the .geno file is fake and we sometimes directly receive the genotypes as BIMBAM)

- Changes TheSpecies object in species.py to accept species name as well as dataset name
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/species.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/wqflask/base/species.py b/wqflask/base/species.py
index 4ac2213c..6d99af65 100644
--- a/wqflask/base/species.py
+++ b/wqflask/base/species.py
@@ -14,10 +14,13 @@ from utility.logger import getLogger
 logger = getLogger(__name__ )
 
 class TheSpecies(object):
-    def __init__(self, dataset):
-        self.dataset = dataset
-        #print("self.dataset is:", pf(self.dataset.__dict__))
-        self.chromosomes = Chromosomes(self.dataset)
+    def __init__(self, dataset=None, species_name=None):
+        if species_name != None:
+            self.name = species_name
+            self.chromosomes = Chromosomes(species=self.name)
+        else:
+            self.dataset = dataset
+            self.chromosomes = Chromosomes(dataset=self.dataset)
 
 class IndChromosome(object):
     def __init__(self, name, length):
@@ -30,11 +33,21 @@ class IndChromosome(object):
         return self.length / 1000000
 
 class Chromosomes(object):
-    def __init__(self, dataset):
-        self.dataset = dataset
+    def __init__(self, dataset=None, species=None):
         self.chromosomes = collections.OrderedDict()
+        if species != None:
+            query = """
+                Select
+                        Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, Species
+                where
+                        Chr_Length.SpeciesId = Species.SpeciesId AND
+                        Species.Name = '%s'
+                Order by OrderId
+                """ % species.capitalize()
+        else:
+            self.dataset = dataset
 
-        query = """
+            query = """
                 Select
                         Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, InbredSet
                 where