about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--wqflask/maintenance/geno_to_json.py12
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py26
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py64
-rw-r--r--wqflask/utility/Plot.py98
-rw-r--r--wqflask/utility/__init__.py2
-rw-r--r--wqflask/utility/genofile_parser.py150
-rw-r--r--wqflask/utility/tools.py2
-rw-r--r--wqflask/wqflask/collect.py12
-rw-r--r--wqflask/wqflask/correlation_matrix/show_corr_matrix.py4
-rw-r--r--wqflask/wqflask/ctl/ctl_analysis.py88
-rw-r--r--wqflask/wqflask/group_manager.py238
-rw-r--r--wqflask/wqflask/gsearch.py14
-rw-r--r--wqflask/wqflask/interval_analyst/GeneUtil.py130
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py44
-rw-r--r--wqflask/wqflask/marker_regression/rqtl_mapping.py14
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py352
-rw-r--r--wqflask/wqflask/model.py2
-rw-r--r--wqflask/wqflask/search_results.py2
-rw-r--r--wqflask/wqflask/user_login.py70
19 files changed, 662 insertions, 662 deletions
diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py
index 27eb6553..c74489a8 100644
--- a/wqflask/maintenance/geno_to_json.py
+++ b/wqflask/maintenance/geno_to_json.py
@@ -113,13 +113,13 @@ class ConvertGenoFile:
         with open(self.output_file, 'w') as fh:
             json.dump(self.markers, fh, indent="   ", sort_keys=True)
 
-                # print('configurations:', str(configurations))
-                #self.latest_col_pos = item_count + self.skipped_cols
-                #self.latest_col_value = item
+            # print('configurations:', str(configurations))
+            #self.latest_col_pos = item_count + self.skipped_cols
+            #self.latest_col_value = item
 
-                # if item_count != 0:
-                #    self.output_fh.write(" ")
-                # self.output_fh.write(self.configurations[item.upper()])
+            # if item_count != 0:
+            #    self.output_fh.write(" ")
+            # self.output_fh.write(self.configurations[item.upper()])
 
             # self.output_fh.write("\n")
 
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
index 1198740d..47377873 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
@@ -7,17 +7,17 @@ from wqflask.marker_regression.qtlreaper_mapping import gen_pheno_txt_file
 
 
 class TestQtlReaperMapping(unittest.TestCase):
-	@mock.patch("wqflask.marker_regression.qtlreaper_mapping.TEMPDIR", "/home/user/data")
-	def test_gen_pheno_txt_file(self):
-		vals = ["V1", "x", "V4", "V3","x"]
-		samples = ["S1", "S2", "S3", "S4","S5"]
-		trait_filename = "trait_file"
-		with mock.patch("builtins.open", mock.mock_open())as mock_open:
-			gen_pheno_txt_file(samples=samples, vals=vals,
-			                   trait_filename=trait_filename)
-			mock_open.assert_called_once_with("/home/user/data/gn2/trait_file.txt", "w")
-			filehandler = mock_open()
-			write_calls = [mock.call('Trait\t'), mock.call(
-				'S1\tS3\tS4\n'), mock.call('T1\t'), mock.call('V1\tV4\tV3')]
+    @mock.patch("wqflask.marker_regression.qtlreaper_mapping.TEMPDIR", "/home/user/data")
+    def test_gen_pheno_txt_file(self):
+        vals = ["V1", "x", "V4", "V3","x"]
+        samples = ["S1", "S2", "S3", "S4","S5"]
+        trait_filename = "trait_file"
+        with mock.patch("builtins.open", mock.mock_open())as mock_open:
+            gen_pheno_txt_file(samples=samples, vals=vals,
+                               trait_filename=trait_filename)
+            mock_open.assert_called_once_with("/home/user/data/gn2/trait_file.txt", "w")
+            filehandler = mock_open()
+            write_calls = [mock.call('Trait\t'), mock.call(
+                    'S1\tS3\tS4\n'), mock.call('T1\t'), mock.call('V1\tV4\tV3')]
 
-			filehandler.write.assert_has_calls(write_calls)
+            filehandler.write.assert_has_calls(write_calls)
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
index d69a20d3..e518ec22 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
@@ -8,35 +8,35 @@ from wqflask.marker_regression.rqtl_mapping import sanitize_rqtl_names
 
 class TestRqtlMapping(unittest.TestCase):
 
-	def setUp(self):
-		self.app_context = app.app_context()
-		self.app_context.push()
-
-	def tearDown(self):
-		self.app_context.pop()
-
-	@mock.patch("wqflask.marker_regression.rqtl_mapping.g")
-	@mock.patch("wqflask.marker_regression.rqtl_mapping.logger")
-	def test_get_trait_data(self, mock_logger, mock_db):
-		"""test for getting trait data_type return True"""
-		query_value = """SELECT value FROM TraitMetadata WHERE type='trait_data_type'"""
-		mock_db.db.execute.return_value.fetchone.return_value = [
-			"""{"type":"trait_data_type","name":"T1","traid_id":"fer434f"}"""]
-		results = get_trait_data_type("traid_id")
-		mock_db.db.execute.assert_called_with(query_value)
-		self.assertEqual(results, "fer434f")
-
-	def test_sanitize_rqtl_phenotype(self):
-		"""test for sanitizing rqtl phenotype"""
-		vals = ['f', "x", "r", "x","x"]
-		results = sanitize_rqtl_phenotype(vals)
-		expected_phenotype_string = 'c(f,NA,r,NA,NA)'
-
-		self.assertEqual(results, expected_phenotype_string)
-
-	def test_sanitize_rqtl_names(self):
-		"""test for sanitzing rqtl names"""
-		vals = ['f', "x", "r", "x","x"]
-		expected_sanitized_name = "c('f',NA,'r',NA,NA)"
-		results = sanitize_rqtl_names(vals)
-		self.assertEqual(expected_sanitized_name, results)
+    def setUp(self):
+        self.app_context = app.app_context()
+        self.app_context.push()
+
+    def tearDown(self):
+        self.app_context.pop()
+
+    @mock.patch("wqflask.marker_regression.rqtl_mapping.g")
+    @mock.patch("wqflask.marker_regression.rqtl_mapping.logger")
+    def test_get_trait_data(self, mock_logger, mock_db):
+        """test for getting trait data_type return True"""
+        query_value = """SELECT value FROM TraitMetadata WHERE type='trait_data_type'"""
+        mock_db.db.execute.return_value.fetchone.return_value = [
+                """{"type":"trait_data_type","name":"T1","traid_id":"fer434f"}"""]
+        results = get_trait_data_type("traid_id")
+        mock_db.db.execute.assert_called_with(query_value)
+        self.assertEqual(results, "fer434f")
+
+    def test_sanitize_rqtl_phenotype(self):
+        """test for sanitizing rqtl phenotype"""
+        vals = ['f', "x", "r", "x","x"]
+        results = sanitize_rqtl_phenotype(vals)
+        expected_phenotype_string = 'c(f,NA,r,NA,NA)'
+
+        self.assertEqual(results, expected_phenotype_string)
+
+    def test_sanitize_rqtl_names(self):
+        """test for sanitzing rqtl names"""
+        vals = ['f', "x", "r", "x","x"]
+        expected_sanitized_name = "c('f',NA,'r',NA,NA)"
+        results = sanitize_rqtl_names(vals)
+        self.assertEqual(expected_sanitized_name, results)
diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py
index 00658d10..f61e3b88 100644
--- a/wqflask/utility/Plot.py
+++ b/wqflask/utility/Plot.py
@@ -79,7 +79,7 @@ def frange(start, end=None, inc=1.0):
         start += 0.0  # force it to be a float
     count = int((end - start) / inc)
     if start + count * inc != end:
-    # Need to adjust the count. AFAICT, it always comes up one short.
+        # Need to adjust the count. AFAICT, it always comes up one short.
         count += 1
     L = [start] * count
     for i in range(1, count):
@@ -131,16 +131,16 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
     plotWidth = canvas.size[0] - xLeftOffset - xRightOffset
     plotHeight = canvas.size[1] - yTopOffset - yBottomOffset
     if plotHeight <= 0 or plotWidth <= 0:
-       return
+        return
 
     if len(data) < 2:
-       return
+        return
 
     max_D = max(data)
     min_D = min(data)
     # add by NL 06-20-2011: fix the error: when max_D is infinite, log function in detScale will go wrong
     if max_D == float('inf') or max_D > webqtlConfig.MAXLRS:
-       max_D = webqtlConfig.MAXLRS  # maximum LRS value
+        max_D = webqtlConfig.MAXLRS  # maximum LRS value
 
     xLow, xTop, stepX = detScale(min_D, max_D)
 
@@ -151,15 +151,15 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
     dataXY = []
     Count = []
     while j <= xTop:
-       dataXY.append(j)
-       Count.append(0)
-       j += step
+        dataXY.append(j)
+        Count.append(0)
+        j += step
 
     for i, item in enumerate(data):
-       if item == float('inf') or item > webqtlConfig.MAXLRS:
-           item = webqtlConfig.MAXLRS  # maximum LRS value
-       j = int((item - xLow) / step)
-       Count[j] += 1
+        if item == float('inf') or item > webqtlConfig.MAXLRS:
+            item = webqtlConfig.MAXLRS  # maximum LRS value
+        j = int((item - xLow) / step)
+        Count[j] += 1
 
     yLow, yTop, stepY = detScale(0, max(Count))
 
@@ -169,12 +169,12 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
     barWidth = xScale * step
 
     for i, count in enumerate(Count):
-       if count:
-           xc = (dataXY[i] - xLow) * xScale + xLeftOffset
-           yc = -(count - yLow) * yScale + yTopOffset + plotHeight
-           im_drawer.rectangle(
-               xy=((xc + 2, yc), (xc + barWidth - 2, yTopOffset + plotHeight)),
-               outline=barColor, fill=barColor)
+        if count:
+            xc = (dataXY[i] - xLow) * xScale + xLeftOffset
+            yc = -(count - yLow) * yScale + yTopOffset + plotHeight
+            im_drawer.rectangle(
+                xy=((xc + 2, yc), (xc + barWidth - 2, yTopOffset + plotHeight)),
+                outline=barColor, fill=barColor)
 
     # draw drawing region
     im_drawer.rectangle(
@@ -186,39 +186,39 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
     scaleFont = ImageFont.truetype(font=COUR_FILE, size=11)
     x = xLow
     for i in range(int(stepX) + 1):
-       xc = xLeftOffset + (x - xLow) * xScale
-       im_drawer.line(
-           xy=((xc, yTopOffset + plotHeight), (xc, yTopOffset + plotHeight + 5)),
-           fill=axesColor)
-       strX = cformat(d=x, rank=0)
-       im_drawer.text(
-           text=strX,
-           xy=(xc - im_drawer.textsize(strX, font=scaleFont)[0] / 2,
-               yTopOffset + plotHeight + 14), font=scaleFont)
-       x += (xTop - xLow) / stepX
+        xc = xLeftOffset + (x - xLow) * xScale
+        im_drawer.line(
+            xy=((xc, yTopOffset + plotHeight), (xc, yTopOffset + plotHeight + 5)),
+            fill=axesColor)
+        strX = cformat(d=x, rank=0)
+        im_drawer.text(
+            text=strX,
+            xy=(xc - im_drawer.textsize(strX, font=scaleFont)[0] / 2,
+                yTopOffset + plotHeight + 14), font=scaleFont)
+        x += (xTop - xLow) / stepX
 
     y = yLow
     for i in range(int(stepY) + 1):
-       yc = yTopOffset + plotHeight - (y - yLow) * yScale
-       im_drawer.line(
-           xy=((xLeftOffset, yc), (xLeftOffset - 5, yc)), fill=axesColor)
-       strY = "%d" % y
-       im_drawer.text(
-           text=strY,
-           xy=(xLeftOffset - im_drawer.textsize(strY,
-               font=scaleFont)[0] - 6, yc + 5),
-           font=scaleFont)
-       y += (yTop - yLow) / stepY
+        yc = yTopOffset + plotHeight - (y - yLow) * yScale
+        im_drawer.line(
+            xy=((xLeftOffset, yc), (xLeftOffset - 5, yc)), fill=axesColor)
+        strY = "%d" % y
+        im_drawer.text(
+            text=strY,
+            xy=(xLeftOffset - im_drawer.textsize(strY,
+                font=scaleFont)[0] - 6, yc + 5),
+            font=scaleFont)
+        y += (yTop - yLow) / stepY
 
     # draw label
     labelFont = ImageFont.truetype(font=TAHOMA_FILE, size=17)
     if XLabel:
-       im_drawer.text(
-           text=XLabel,
-           xy=(xLeftOffset + (
-               plotWidth - im_drawer.textsize(XLabel, font=labelFont)[0]) / 2.0,
-               yTopOffset + plotHeight + yBottomOffset-10),
-           font=labelFont, fill=labelColor)
+        im_drawer.text(
+            text=XLabel,
+            xy=(xLeftOffset + (
+                plotWidth - im_drawer.textsize(XLabel, font=labelFont)[0]) / 2.0,
+                yTopOffset + plotHeight + yBottomOffset-10),
+            font=labelFont, fill=labelColor)
 
     if YLabel:
         draw_rotated_text(canvas, text=YLabel,
@@ -230,12 +230,12 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
 
     labelFont = ImageFont.truetype(font=VERDANA_FILE, size=16)
     if title:
-       im_drawer.text(
-           text=title,
-           xy=(xLeftOffset + (plotWidth - im_drawer.textsize(
-               title, font=labelFont)[0]) / 2.0,
-               20),
-           font=labelFont, fill=labelColor)
+        im_drawer.text(
+            text=title,
+            xy=(xLeftOffset + (plotWidth - im_drawer.textsize(
+                title, font=labelFont)[0]) / 2.0,
+                20),
+            font=labelFont, fill=labelColor)
 
 # This function determines the scale of the plot
 
diff --git a/wqflask/utility/__init__.py b/wqflask/utility/__init__.py
index 816bc4df..6c8cd546 100644
--- a/wqflask/utility/__init__.py
+++ b/wqflask/utility/__init__.py
@@ -7,7 +7,7 @@ class Bunch:
     """Like a dictionary but using object notation"""
 
     def __init__(self, **kw):
-            self.__dict__ = kw
+        self.__dict__ = kw
 
     def __repr__(self):
         return pf(self.__dict__)
diff --git a/wqflask/utility/genofile_parser.py b/wqflask/utility/genofile_parser.py
index c0629b5d..eb545478 100644
--- a/wqflask/utility/genofile_parser.py
+++ b/wqflask/utility/genofile_parser.py
@@ -14,87 +14,87 @@ from pprint import pformat as pf
 
 
 class Marker:
-  def __init__(self):
-    self.name = None
-    self.chr = None
-    self.cM = None
-    self.Mb = None
-    self.genotypes = []
+    def __init__(self):
+        self.name = None
+        self.chr = None
+        self.cM = None
+        self.Mb = None
+        self.genotypes = []
 
 
 class ConvertGenoFile:
 
-  def __init__(self, input_file):
-    self.mb_exists = False
-    self.cm_exists = False
-    self.markers = []
+    def __init__(self, input_file):
+        self.mb_exists = False
+        self.cm_exists = False
+        self.markers = []
 
-    self.latest_row_pos = None
-    self.latest_col_pos = None
+        self.latest_row_pos = None
+        self.latest_col_pos = None
 
-    self.latest_row_value = None
-    self.latest_col_value = None
-    self.input_fh = open(input_file)
-    print("!!!!!!!!!!!!!!!!PARSER!!!!!!!!!!!!!!!!!!")
-    self.haplotype_notation = {
-      '@mat': "1",
-      '@pat': "2",
-      '@het': "-999",
-      '@unk': "-999"
-    }
-    self.configurations = {}
+        self.latest_row_value = None
+        self.latest_col_value = None
+        self.input_fh = open(input_file)
+        print("!!!!!!!!!!!!!!!!PARSER!!!!!!!!!!!!!!!!!!")
+        self.haplotype_notation = {
+          '@mat': "1",
+          '@pat': "2",
+          '@het': "-999",
+          '@unk': "-999"
+        }
+        self.configurations = {}
 
-  def process_rows(self):
-    for self.latest_row_pos, row in enumerate(self.input_fh):
-        self.latest_row_value = row
-        # Take care of headers
-        if not row.strip():
-            continue
-        if row.startswith('#'):
-            continue
-        if row.startswith('Chr'):
-            if 'Mb' in row.split():
-                self.mb_exists = True
-            if 'cM' in row.split():
-                self.cm_exists = True
-            skip = 2 + self.cm_exists + self.mb_exists
-            self.individuals = row.split()[skip:]
-            continue
-        if row.startswith('@'):
-            key, _separater, value = row.partition(':')
-            key = key.strip()
-            value = value.strip()
-            if key in self.haplotype_notation:
-                self.configurations[value] = self.haplotype_notation[key]
-            continue
-        if not len(self.configurations):
-            raise EmptyConfigurations
-        yield row
+    def process_rows(self):
+        for self.latest_row_pos, row in enumerate(self.input_fh):
+            self.latest_row_value = row
+            # Take care of headers
+            if not row.strip():
+                continue
+            if row.startswith('#'):
+                continue
+            if row.startswith('Chr'):
+                if 'Mb' in row.split():
+                    self.mb_exists = True
+                if 'cM' in row.split():
+                    self.cm_exists = True
+                skip = 2 + self.cm_exists + self.mb_exists
+                self.individuals = row.split()[skip:]
+                continue
+            if row.startswith('@'):
+                key, _separater, value = row.partition(':')
+                key = key.strip()
+                value = value.strip()
+                if key in self.haplotype_notation:
+                    self.configurations[value] = self.haplotype_notation[key]
+                continue
+            if not len(self.configurations):
+                raise EmptyConfigurations
+            yield row
 
-  def process_csv(self):
-    for row in self.process_rows():
-      row_items = row.split("\t")
+    def process_csv(self):
+        for row in self.process_rows():
+            row_items = row.split("\t")
 
-      this_marker = Marker()
-      this_marker.name = row_items[1]
-      this_marker.chr = row_items[0]
-      if self.cm_exists and self.mb_exists:
-        this_marker.cM = row_items[2]
-        this_marker.Mb = row_items[3]
-        genotypes = row_items[4:]
-      elif self.cm_exists:
-          this_marker.cM = row_items[2]
-          genotypes = row_items[3:]
-      elif self.mb_exists:
-          this_marker.Mb = row_items[2]
-          genotypes = row_items[3:]
-      else:
-        genotypes = row_items[2:]
-      for item_count, genotype in enumerate(genotypes):
-        if genotype.upper().strip() in self.configurations:
-          this_marker.genotypes.append(
-            self.configurations[genotype.upper().strip()])
-        else:
-          print("WARNING:", genotype.upper())
-          this_marker.genotypes.append("NA")
-      self.markers.append(this_marker.__dict__)
+            this_marker = Marker()
+            this_marker.name = row_items[1]
+            this_marker.chr = row_items[0]
+            if self.cm_exists and self.mb_exists:
+                this_marker.cM = row_items[2]
+                this_marker.Mb = row_items[3]
+                genotypes = row_items[4:]
+            elif self.cm_exists:
+                this_marker.cM = row_items[2]
+                genotypes = row_items[3:]
+            elif self.mb_exists:
+                this_marker.Mb = row_items[2]
+                genotypes = row_items[3:]
+            else:
+                genotypes = row_items[2:]
+            for item_count, genotype in enumerate(genotypes):
+                if genotype.upper().strip() in self.configurations:
+                    this_marker.genotypes.append(
+                      self.configurations[genotype.upper().strip()])
+                else:
+                    print("WARNING:", genotype.upper())
+                    this_marker.genotypes.append("NA")
+            self.markers.append(this_marker.__dict__)
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index d82e478d..4f09176a 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -73,7 +73,7 @@ def get_setting(command_id, guess=None):
 def get_setting_bool(id):
     v = get_setting(id)
     if v not in [0, False, 'False', 'FALSE', None]:
-      return True
+        return True
     return False
 
 
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py
index 9fd89524..b06d84ff 100644
--- a/wqflask/wqflask/collect.py
+++ b/wqflask/wqflask/collect.py
@@ -35,7 +35,7 @@ def process_traits(unprocessed_traits):
         data, _separator, the_hmac = trait.rpartition(':')
         data = data.strip()
         if g.user_session.logged_in:
-          assert the_hmac == hmac.hmac_creation(data), "Data tampering?"
+            assert the_hmac == hmac.hmac_creation(data), "Data tampering?"
         traits.add(str(data))
 
     return traits
@@ -52,14 +52,14 @@ def report_change(len_before, len_now):
 
 @app.route("/collections/store_trait_list", methods=('POST',))
 def store_traits_list():
-   params = request.form
+    params = request.form
 
-   traits = params['traits']
-   hash = params['hash']
+    traits = params['traits']
+    hash = params['hash']
 
-   Redis.set(hash, traits)
+    Redis.set(hash, traits)
 
-   return hash
+    return hash
 
 
 @app.route("/collections/add")
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index 59469428..c04b17be 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -238,9 +238,9 @@ class CorrelationMatrix:
         for i in range(len(self.trait_list)):
             loadings_row = []
             if len(self.trait_list) > 2:
-               the_range = 3
+                the_range = 3
             else:
-               the_range = 2
+                the_range = 2
             for j in range(the_range):
                 position = i + len(self.trait_list) * j
                 loadings_row.append(self.loadings[0][position])
diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py
index f4eafbe7..820e81bc 100644
--- a/wqflask/wqflask/ctl/ctl_analysis.py
+++ b/wqflask/wqflask/ctl/ctl_analysis.py
@@ -115,8 +115,8 @@ class CTL:
         markers = []
         markernames = []
         for marker in parser.markers:
-          markernames.append(marker["name"])
-          markers.append(marker["genotypes"])
+            markernames.append(marker["name"])
+            markers.append(marker["genotypes"])
 
         genotypes = list(itertools.chain(*markers))
         logger.debug(len(genotypes) / len(individuals),
@@ -128,16 +128,16 @@ class CTL:
         # Create a phenotype matrix
         traits = []
         for trait in self.trait_db_list:
-          logger.debug("retrieving data for", trait)
-          if trait != "":
-            ts = trait.split(':')
-            gt = create_trait(name=ts[0], dataset_name=ts[1])
-            gt = retrieve_sample_data(gt, dataset, individuals)
-            for ind in individuals:
-              if ind in list(gt.data.keys()):
-                traits.append(gt.data[ind].value)
-              else:
-                traits.append("-999")
+            logger.debug("retrieving data for", trait)
+            if trait != "":
+                ts = trait.split(':')
+                gt = create_trait(name=ts[0], dataset_name=ts[1])
+                gt = retrieve_sample_data(gt, dataset, individuals)
+                for ind in individuals:
+                    if ind in list(gt.data.keys()):
+                        traits.append(gt.data[ind].value)
+                    else:
+                        traits.append("-999")
 
         rPheno = r_t(ro.r.matrix(r_as_numeric(r_unlist(traits)), nrow=len(self.trait_db_list), ncol=len(
             individuals), dimnames=r_list(self.trait_db_list, individuals), byrow=True))
@@ -177,42 +177,42 @@ class CTL:
         # We start from 2, since R starts from 1 :)
         n = 2
         for trait in self.trait_db_list:
-          # Create the QTL like CTL plots
-          self.results['imgurl' + \
-              str(n)] = webqtlUtil.genRandStr("CTL_") + ".png"
-          self.results['imgloc' + str(n)] = GENERATED_IMAGE_DIR + \
-                                      self.results['imgurl' + str(n)]
-          r_png(self.results['imgloc' + str(n)],
-                width=1000, height=600, type='cairo-png')
-          self.r_plotCTLobject(
-              res, (n - 1), significance=significance, main='Phenotype ' + trait)
-          r_dev_off()
-          n = n + 1
+            # Create the QTL like CTL plots
+            self.results['imgurl' + \
+                str(n)] = webqtlUtil.genRandStr("CTL_") + ".png"
+            self.results['imgloc' + str(n)] = GENERATED_IMAGE_DIR + \
+                                        self.results['imgurl' + str(n)]
+            r_png(self.results['imgloc' + str(n)],
+                  width=1000, height=600, type='cairo-png')
+            self.r_plotCTLobject(
+                res, (n - 1), significance=significance, main='Phenotype ' + trait)
+            r_dev_off()
+            n = n + 1
 
         # Flush any output from R
         sys.stdout.flush()
 
         # Create the interactive graph for cytoscape visualization (Nodes and Edges)
         if not isinstance(significant, ri.RNULLType):
-          for x in range(len(significant[0])):
-            logger.debug(significant[0][x], significant[1]
-                         [x], significant[2][x])     # Debug to console
-            # Source
-            tsS = significant[0][x].split(':')
-            # Target
-            tsT = significant[2][x].split(':')
-            # Retrieve Source info from the DB
-            gtS = create_trait(name=tsS[0], dataset_name=tsS[1])
-            # Retrieve Target info from the DB
-            gtT = create_trait(name=tsT[0], dataset_name=tsT[1])
-            self.addNode(gtS)
-            self.addNode(gtT)
-            self.addEdge(gtS, gtT, significant, x)
-
-            # Update the trait name for the displayed table
-            significant[0][x] = "{} ({})".format(gtS.symbol, gtS.name)
-            # Update the trait name for the displayed table
-            significant[2][x] = "{} ({})".format(gtT.symbol, gtT.name)
+            for x in range(len(significant[0])):
+                logger.debug(significant[0][x], significant[1]
+                             [x], significant[2][x])     # Debug to console
+                # Source
+                tsS = significant[0][x].split(':')
+                # Target
+                tsT = significant[2][x].split(':')
+                # Retrieve Source info from the DB
+                gtS = create_trait(name=tsS[0], dataset_name=tsS[1])
+                # Retrieve Target info from the DB
+                gtT = create_trait(name=tsT[0], dataset_name=tsT[1])
+                self.addNode(gtS)
+                self.addNode(gtT)
+                self.addEdge(gtS, gtT, significant, x)
+
+                # Update the trait name for the displayed table
+                significant[0][x] = "{} ({})".format(gtS.symbol, gtS.name)
+                # Update the trait name for the displayed table
+                significant[2][x] = "{} ({})".format(gtT.symbol, gtT.name)
 
         self.elements = json.dumps(self.nodes_list + self.edges_list)
 
@@ -227,8 +227,8 @@ class CTL:
         self.loadImage("imgloc1", "imgdata1")
         n = 2
         for trait in self.trait_db_list:
-          self.loadImage("imgloc" + str(n), "imgdata" + str(n))
-          n = n + 1
+            self.loadImage("imgloc" + str(n), "imgdata" + str(n))
+            n = n + 1
 
     def process_results(self, results):
         logger.info("Processing CTL output")
diff --git a/wqflask/wqflask/group_manager.py b/wqflask/wqflask/group_manager.py
index 55a7da0e..995915a9 100644
--- a/wqflask/wqflask/group_manager.py
+++ b/wqflask/wqflask/group_manager.py
@@ -16,158 +16,158 @@ logger = getLogger(__name__)
 
 @app.route("/groups/manage", methods=('GET', 'POST'))
 def manage_groups():
-   params = request.form if request.form else request.args
-   if "add_new_group" in params:
-      return redirect(url_for('add_group'))
-   else:
-      admin_groups, member_groups = get_user_groups(g.user_session.user_id)
-      return render_template("admin/group_manager.html", admin_groups=admin_groups, member_groups=member_groups)
+    params = request.form if request.form else request.args
+    if "add_new_group" in params:
+        return redirect(url_for('add_group'))
+    else:
+        admin_groups, member_groups = get_user_groups(g.user_session.user_id)
+        return render_template("admin/group_manager.html", admin_groups=admin_groups, member_groups=member_groups)
 
 
 @app.route("/groups/view", methods=('GET', 'POST'))
 def view_group():
-   params = request.form if request.form else request.args
-   group_id = params['id']
-   group_info = get_group_info(group_id)
-   admins_info = []
-   user_is_admin = False
-   if g.user_session.user_id in group_info['admins']:
-      user_is_admin = True
-   for user_id in group_info['admins']:
-      if user_id:
-         user_info = get_user_by_unique_column("user_id", user_id)
-         admins_info.append(user_info)
-   members_info = []
-   for user_id in group_info['members']:
-      if user_id:
-         user_info = get_user_by_unique_column("user_id", user_id)
-         members_info.append(user_info)
-
-   # ZS: This whole part might not scale well with many resources
-   resources_info = []
-   all_resources = get_resources()
-   for resource_id in all_resources:
-      resource_info = get_resource_info(resource_id)
-      group_masks = resource_info['group_masks']
-      if group_id in group_masks:
-         this_resource = {}
-         privileges = group_masks[group_id]
-         this_resource['id'] = resource_id
-         this_resource['name'] = resource_info['name']
-         this_resource['data'] = privileges['data']
-         this_resource['metadata'] = privileges['metadata']
-         this_resource['admin'] = privileges['admin']
-         resources_info.append(this_resource)
-
-   return render_template("admin/view_group.html", group_info=group_info, admins=admins_info, members=members_info, user_is_admin=user_is_admin, resources=resources_info)
+    params = request.form if request.form else request.args
+    group_id = params['id']
+    group_info = get_group_info(group_id)
+    admins_info = []
+    user_is_admin = False
+    if g.user_session.user_id in group_info['admins']:
+        user_is_admin = True
+    for user_id in group_info['admins']:
+        if user_id:
+            user_info = get_user_by_unique_column("user_id", user_id)
+            admins_info.append(user_info)
+    members_info = []
+    for user_id in group_info['members']:
+        if user_id:
+            user_info = get_user_by_unique_column("user_id", user_id)
+            members_info.append(user_info)
+
+    # ZS: This whole part might not scale well with many resources
+    resources_info = []
+    all_resources = get_resources()
+    for resource_id in all_resources:
+        resource_info = get_resource_info(resource_id)
+        group_masks = resource_info['group_masks']
+        if group_id in group_masks:
+            this_resource = {}
+            privileges = group_masks[group_id]
+            this_resource['id'] = resource_id
+            this_resource['name'] = resource_info['name']
+            this_resource['data'] = privileges['data']
+            this_resource['metadata'] = privileges['metadata']
+            this_resource['admin'] = privileges['admin']
+            resources_info.append(this_resource)
+
+    return render_template("admin/view_group.html", group_info=group_info, admins=admins_info, members=members_info, user_is_admin=user_is_admin, resources=resources_info)
 
 
 @app.route("/groups/remove", methods=('POST',))
 def remove_groups():
-   group_ids_to_remove = request.form['selected_group_ids']
-   for group_id in group_ids_to_remove.split(":"):
-      delete_group(g.user_session.user_id, group_id)
+    group_ids_to_remove = request.form['selected_group_ids']
+    for group_id in group_ids_to_remove.split(":"):
+        delete_group(g.user_session.user_id, group_id)
 
-   return redirect(url_for('manage_groups'))
+    return redirect(url_for('manage_groups'))
 
 
 @app.route("/groups/remove_users", methods=('POST',))
 def remove_users():
-   group_id = request.form['group_id']
-   admin_ids_to_remove = request.form['selected_admin_ids']
-   member_ids_to_remove = request.form['selected_member_ids']
+    group_id = request.form['group_id']
+    admin_ids_to_remove = request.form['selected_admin_ids']
+    member_ids_to_remove = request.form['selected_member_ids']
 
-   remove_users_from_group(g.user_session.user_id, admin_ids_to_remove.split(
-      ":"), group_id, user_type="admins")
-   remove_users_from_group(g.user_session.user_id, member_ids_to_remove.split(
-      ":"), group_id, user_type="members")
+    remove_users_from_group(g.user_session.user_id, admin_ids_to_remove.split(
+       ":"), group_id, user_type="admins")
+    remove_users_from_group(g.user_session.user_id, member_ids_to_remove.split(
+       ":"), group_id, user_type="members")
 
-   return redirect(url_for('view_group', id=group_id))
+    return redirect(url_for('view_group', id=group_id))
 
 
 @app.route("/groups/add_<path:user_type>", methods=('POST',))
 def add_users(user_type='members'):
-   group_id = request.form['group_id']
-   if user_type == "admins":
-      user_emails = request.form['admin_emails_to_add'].split(",")
-      add_users_to_group(g.user_session.user_id, group_id,
-                         user_emails, admins=True)
-   elif user_type == "members":
-      user_emails = request.form['member_emails_to_add'].split(",")
-      add_users_to_group(g.user_session.user_id, group_id,
-                         user_emails, admins=False)
+    group_id = request.form['group_id']
+    if user_type == "admins":
+        user_emails = request.form['admin_emails_to_add'].split(",")
+        add_users_to_group(g.user_session.user_id, group_id,
+                           user_emails, admins=True)
+    elif user_type == "members":
+        user_emails = request.form['member_emails_to_add'].split(",")
+        add_users_to_group(g.user_session.user_id, group_id,
+                           user_emails, admins=False)
 
-   return redirect(url_for('view_group', id=group_id))
+    return redirect(url_for('view_group', id=group_id))
 
 
 @app.route("/groups/change_name", methods=('POST',))
 def change_name():
-   group_id = request.form['group_id']
-   new_name = request.form['new_name']
-   group_info = change_group_name(g.user_session.user_id, group_id, new_name)
+    group_id = request.form['group_id']
+    new_name = request.form['new_name']
+    group_info = change_group_name(g.user_session.user_id, group_id, new_name)
 
-   return new_name
+    return new_name
 
 
 @app.route("/groups/create", methods=('GET', 'POST'))
 def add_or_edit_group():
-   params = request.form if request.form else request.args
-   if "group_name" in params:
-      member_user_ids = set()
-      admin_user_ids = set()
-      # ZS: Always add the user creating the group as an admin
-      admin_user_ids.add(g.user_session.user_id)
-      if "admin_emails_to_add" in params:
-         admin_emails = params['admin_emails_to_add'].split(",")
-         for email in admin_emails:
-            user_details = get_user_by_unique_column("email_address", email)
-            if user_details:
-               admin_user_ids.add(user_details['user_id'])
-         #send_group_invites(params['group_id'], user_email_list = admin_emails, user_type="admins")
-      if "member_emails_to_add" in params:
-         member_emails = params['member_emails_to_add'].split(",")
-         for email in member_emails:
-            user_details = get_user_by_unique_column("email_address", email)
-            if user_details:
-               member_user_ids.add(user_details['user_id'])
-         #send_group_invites(params['group_id'], user_email_list = user_emails, user_type="members")
-
-      create_group(list(admin_user_ids), list(
-         member_user_ids), params['group_name'])
-      return redirect(url_for('manage_groups'))
-   else:
-      return render_template("admin/create_group.html")
+    params = request.form if request.form else request.args
+    if "group_name" in params:
+        member_user_ids = set()
+        admin_user_ids = set()
+        # ZS: Always add the user creating the group as an admin
+        admin_user_ids.add(g.user_session.user_id)
+        if "admin_emails_to_add" in params:
+            admin_emails = params['admin_emails_to_add'].split(",")
+            for email in admin_emails:
+                user_details = get_user_by_unique_column("email_address", email)
+                if user_details:
+                    admin_user_ids.add(user_details['user_id'])
+            #send_group_invites(params['group_id'], user_email_list = admin_emails, user_type="admins")
+        if "member_emails_to_add" in params:
+            member_emails = params['member_emails_to_add'].split(",")
+            for email in member_emails:
+                user_details = get_user_by_unique_column("email_address", email)
+                if user_details:
+                    member_user_ids.add(user_details['user_id'])
+            #send_group_invites(params['group_id'], user_email_list = user_emails, user_type="members")
+
+        create_group(list(admin_user_ids), list(
+           member_user_ids), params['group_name'])
+        return redirect(url_for('manage_groups'))
+    else:
+        return render_template("admin/create_group.html")
 
 # ZS: Will integrate this later, for now just letting users be added directly
 
 
 def send_group_invites(group_id, user_email_list=[], user_type="members"):
-   for user_email in user_email_list:
-      user_details = get_user_by_unique_column("email_address", user_email)
-      if user_details:
-         group_info = get_group_info(group_id)
-         # ZS: Probably not necessary since the group should normally always exist if group_id is being passed here,
-         #    but it's technically possible to hit it if Redis is cleared out before submitting the new users or something
-         if group_info:
-            # ZS: Don't add user if they're already an admin or if they're being added a regular user and are already a regular user,
-            #    but do add them if they're a regular user and are added as an admin
-            if (user_details['user_id'] in group_info['admins']) or \
-               ((user_type == "members") and (user_details['user_id'] in group_info['members'])):
-               continue
-            else:
-               send_verification_email(user_details, template_name="email/group_verification.txt",
-                                       key_prefix="verification_code", subject = "You've been invited to join a GeneNetwork user group")
-      else:
-         temp_password = ''.join(random.choice(
-            string.ascii_uppercase + string.digits) for _ in range(6))
-         user_details = {
-            'user_id': str(uuid.uuid4()),
-            'email_address': user_email,
-            'registration_info': basic_info(),
-            'password': set_password(temp_password),
-            'confirmed': 0
-         }
-         save_user(user_details, user_details['user_id'])
-         send_invitation_email(user_email, temp_password)
+    for user_email in user_email_list:
+        user_details = get_user_by_unique_column("email_address", user_email)
+        if user_details:
+            group_info = get_group_info(group_id)
+            # ZS: Probably not necessary since the group should normally always exist if group_id is being passed here,
+            #    but it's technically possible to hit it if Redis is cleared out before submitting the new users or something
+            if group_info:
+                # ZS: Don't add user if they're already an admin or if they're being added a regular user and are already a regular user,
+                #    but do add them if they're a regular user and are added as an admin
+                if (user_details['user_id'] in group_info['admins']) or \
+                   ((user_type == "members") and (user_details['user_id'] in group_info['members'])):
+                    continue
+                else:
+                    send_verification_email(user_details, template_name="email/group_verification.txt",
+                                            key_prefix="verification_code", subject = "You've been invited to join a GeneNetwork user group")
+        else:
+            temp_password = ''.join(random.choice(
+               string.ascii_uppercase + string.digits) for _ in range(6))
+            user_details = {
+               'user_id': str(uuid.uuid4()),
+               'email_address': user_email,
+               'registration_info': basic_info(),
+               'password': set_password(temp_password),
+               'confirmed': 0
+            }
+            save_user(user_details, user_details['user_id'])
+            send_invitation_email(user_email, temp_password)
 
 # @app.route()
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 9548d130..f02da27c 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -247,13 +247,13 @@ class GSearch:
                     if not trait_ob:
                         continue
                     if this_trait['dataset'] == this_trait['group'] + "Publish":
-                      try:
-                        if trait_ob.locus_chr != "" and trait_ob.locus_mb != "":
-                            this_trait['max_lrs_text'] = "Chr" + \
-                                str(trait_ob.locus_chr) + \
-                                    ": " + str(trait_ob.locus_mb)
-                      except:
-                          this_trait['max_lrs_text'] = "N/A"
+                        try:
+                            if trait_ob.locus_chr != "" and trait_ob.locus_mb != "":
+                                this_trait['max_lrs_text'] = "Chr" + \
+                                    str(trait_ob.locus_chr) + \
+                                        ": " + str(trait_ob.locus_mb)
+                        except:
+                            this_trait['max_lrs_text'] = "N/A"
 
                     trait_list.append(this_trait)
 
diff --git a/wqflask/wqflask/interval_analyst/GeneUtil.py b/wqflask/wqflask/interval_analyst/GeneUtil.py
index e624a146..2f1c142c 100644
--- a/wqflask/wqflask/interval_analyst/GeneUtil.py
+++ b/wqflask/wqflask/interval_analyst/GeneUtil.py
@@ -7,79 +7,79 @@ from flask import Flask, g
 
 
 def loadGenes(chrName, diffCol, startMb, endMb, species='mouse'):
-	fetchFields = ['SpeciesId', 'Id', 'GeneSymbol', 'GeneDescription', 'Chromosome', 'TxStart', 'TxEnd',
-	'Strand', 'GeneID', 'NM_ID', 'kgID', 'GenBankID', 'UnigenID', 'ProteinID', 'AlignID',
-	'exonCount', 'exonStarts', 'exonEnds', 'cdsStart', 'cdsEnd']
+    fetchFields = ['SpeciesId', 'Id', 'GeneSymbol', 'GeneDescription', 'Chromosome', 'TxStart', 'TxEnd',
+    'Strand', 'GeneID', 'NM_ID', 'kgID', 'GenBankID', 'UnigenID', 'ProteinID', 'AlignID',
+    'exonCount', 'exonStarts', 'exonEnds', 'cdsStart', 'cdsEnd']
 
-	# List All Species in the Gene Table
-	speciesDict = {}
-	results = g.db.execute("""
+    # List All Species in the Gene Table
+    speciesDict = {}
+    results = g.db.execute("""
                 SELECT Species.Name, GeneList.SpeciesId
                 FROM Species, GeneList
                 WHERE GeneList.SpeciesId = Species.Id
                 GROUP BY GeneList.SpeciesId""").fetchall()
 
-	for item in results:
-		speciesDict[item[0]] = item[1]
+    for item in results:
+        speciesDict[item[0]] = item[1]
 
-	# List current Species and other Species
-	speciesId = speciesDict[species]
-	otherSpecies = [[X, speciesDict[X]] for X in list(speciesDict.keys())]
-	otherSpecies.remove([species, speciesId])
+    # List current Species and other Species
+    speciesId = speciesDict[species]
+    otherSpecies = [[X, speciesDict[X]] for X in list(speciesDict.keys())]
+    otherSpecies.remove([species, speciesId])
 
-	results = g.db.execute("""
+    results = g.db.execute("""
                 SELECT %s FROM GeneList
 				WHERE SpeciesId = %d AND
                       Chromosome = '%s' AND
 					  ((TxStart > %f and TxStart <= %f) OR (TxEnd > %f and TxEnd <= %f))
 				ORDER BY txStart
                 """ % (", ".join(fetchFields),
-                       speciesId, chrName,
-                       startMb, endMb,
-                       startMb, endMb)).fetchall()
-
-	GeneList = []
-
-	if results:
-		for result in results:
-			newdict = {}
-			for j, item in enumerate(fetchFields):
-				newdict[item] = result[j]
-			# count SNPs if possible
-			if diffCol and species == 'mouse':
-				newdict["snpCount"] = g.db.execute("""
+                   speciesId, chrName,
+                   startMb, endMb,
+                   startMb, endMb)).fetchall()
+
+    GeneList = []
+
+    if results:
+        for result in results:
+            newdict = {}
+            for j, item in enumerate(fetchFields):
+                newdict[item] = result[j]
+            # count SNPs if possible
+            if diffCol and species == 'mouse':
+                newdict["snpCount"] = g.db.execute("""
                                         SELECT count(*)
                                         FROM BXDSnpPosition
                                         WHERE Chr = '%s' AND
                                               Mb >= %2.6f AND Mb < %2.6f AND
                                               StrainId1 = %d AND StrainId2 = %d
                                         """ % (chrName, newdict["TxStart"], newdict["TxEnd"], diffCol[0], diffCol[1])).fetchone()[0]
-				newdict["snpDensity"] = newdict["snpCount"] / \
-					(newdict["TxEnd"] - newdict["TxStart"]) / 1000.0
-			else:
-				newdict["snpDensity"] = newdict["snpCount"] = 0
-
-			try:
-				newdict['GeneLength'] = 1000.0 * (newdict['TxEnd'] - newdict['TxStart'])
-			except:
-				pass
-
-			# load gene from other Species by the same name
-			for item in otherSpecies:
-				othSpec, othSpecId = item
-				newdict2 = {}
-
-				resultsOther = g.db.execute("SELECT %s FROM GeneList WHERE SpeciesId = %d AND geneSymbol= '%s' LIMIT 1" % (", ".join(fetchFields),
-                                                                                                                           othSpecId,
-                                                                                                                           newdict["GeneSymbol"])).fetchone()
-
-				if resultsOther:
-					for j, item in enumerate(fetchFields):
-						newdict2[item] = resultsOther[j]
-
-					# count SNPs if possible, could be a separate function
-					if diffCol and othSpec == 'mouse':
-						newdict2["snpCount"] = g.db.execute("""
+                newdict["snpDensity"] = newdict["snpCount"] / \
+                        (newdict["TxEnd"] - newdict["TxStart"]) / 1000.0
+            else:
+                newdict["snpDensity"] = newdict["snpCount"] = 0
+
+            try:
+                newdict['GeneLength'] = 1000.0 * (newdict['TxEnd'] - newdict['TxStart'])
+            except:
+                pass
+
+            # load gene from other Species by the same name
+            for item in otherSpecies:
+                othSpec, othSpecId = item
+                newdict2 = {}
+
+                resultsOther = g.db.execute("SELECT %s FROM GeneList WHERE SpeciesId = %d AND geneSymbol= '%s' LIMIT 1" % (", ".join(fetchFields),
+                                                                                                           othSpecId,
+                                                                                                           newdict["GeneSymbol"])).fetchone()
+
+                if resultsOther:
+                    for j, item in enumerate(fetchFields):
+                        newdict2[item] = resultsOther[j]
+
+                    # count SNPs if possible, could be a separate function
+                    if diffCol and othSpec == 'mouse':
+                        newdict2["snpCount"] = g.db.execute("""
                                                     SELECT count(*)
                                                     FROM BXDSnpPosition
                                                     WHERE Chr = '%s' AND
@@ -87,19 +87,19 @@ def loadGenes(chrName, diffCol, startMb, endMb, species='mouse'):
                                                           StrainId1 = %d AND StrainId2 = %d
                                                     """ % (chrName, newdict["TxStart"], newdict["TxEnd"], diffCol[0], diffCol[1])).fetchone()[0]
 
-						newdict2["snpDensity"] = newdict2["snpCount"] / \
-							(newdict2["TxEnd"] - newdict2["TxStart"]) / 1000.0
-					else:
-						newdict2["snpDensity"] = newdict2["snpCount"] = 0
+                        newdict2["snpDensity"] = newdict2["snpCount"] / \
+                                (newdict2["TxEnd"] - newdict2["TxStart"]) / 1000.0
+                    else:
+                        newdict2["snpDensity"] = newdict2["snpCount"] = 0
 
-					try:
-						newdict2['GeneLength'] = 1000.0 * \
-							(newdict2['TxEnd'] - newdict2['TxStart'])
-					except:
-						pass
+                    try:
+                        newdict2['GeneLength'] = 1000.0 * \
+                                (newdict2['TxEnd'] - newdict2['TxStart'])
+                    except:
+                        pass
 
-				newdict['%sGene' % othSpec] = newdict2
+                newdict['%sGene' % othSpec] = newdict2
 
-			GeneList.append(newdict)
+            GeneList.append(newdict)
 
-	return GeneList
+    return GeneList
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 8d0134d8..c68e0fde 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -395,17 +395,17 @@ class DisplayMappingResults:
 
         # Darwing Options
         try:
-           if self.selectedChr > -1:
-               self.graphWidth = min(self.GRAPH_MAX_WIDTH, max(
-                   self.GRAPH_MIN_WIDTH, int(start_vars['graphWidth'])))
-           else:
-               self.graphWidth = min(self.GRAPH_MAX_WIDTH, max(
-                   self.MULT_GRAPH_MIN_WIDTH, int(start_vars['graphWidth'])))
+            if self.selectedChr > -1:
+                self.graphWidth = min(self.GRAPH_MAX_WIDTH, max(
+                    self.GRAPH_MIN_WIDTH, int(start_vars['graphWidth'])))
+            else:
+                self.graphWidth = min(self.GRAPH_MAX_WIDTH, max(
+                    self.MULT_GRAPH_MIN_WIDTH, int(start_vars['graphWidth'])))
         except:
-           if self.selectedChr > -1:
-               self.graphWidth = self.GRAPH_DEFAULT_WIDTH
-           else:
-               self.graphWidth = self.MULT_GRAPH_DEFAULT_WIDTH
+            if self.selectedChr > -1:
+                self.graphWidth = self.GRAPH_DEFAULT_WIDTH
+            else:
+                self.graphWidth = self.MULT_GRAPH_DEFAULT_WIDTH
 
 # BEGIN HaplotypeAnalyst
         if 'haplotypeAnalystCheck' in list(start_vars.keys()):
@@ -574,15 +574,15 @@ class DisplayMappingResults:
                     chrName, self.diffCol, self.startMb, self.endMb, "rat")
 
             if self.geneCol and self.intervalAnalystChecked:
-               #######################################################################
-               #Nick use GENEID as RefGene to get Literature Correlation Informations#
-               #For Interval Mapping, Literature Correlation isn't useful, so skip it#
-               #through set GENEID is None                                           #
-               #######################################################################
+                #######################################################################
+                #Nick use GENEID as RefGene to get Literature Correlation Informations#
+                #For Interval Mapping, Literature Correlation isn't useful, so skip it#
+                #through set GENEID is None                                           #
+                #######################################################################
 
-               GENEID = None
+                GENEID = None
 
-               self.geneTable(self.geneCol, GENEID)
+                self.geneTable(self.geneCol, GENEID)
 
         ################################################################
         # Plots goes here
@@ -2636,11 +2636,11 @@ class DisplayMappingResults:
                     LRSCoordXY.append((Xc, Yc))
 
                 if not self.multipleInterval and self.additiveChecked:
-                   if additiveMax == 0.0:
-                       additiveMax = 0.000001
-                   Yc = yZero - qtlresult['additive'] * \
-                       AdditiveHeightThresh / additiveMax
-                   AdditiveCoordXY.append((Xc, Yc))
+                    if additiveMax == 0.0:
+                        additiveMax = 0.000001
+                    Yc = yZero - qtlresult['additive'] * \
+                        AdditiveHeightThresh / additiveMax
+                    AdditiveCoordXY.append((Xc, Yc))
 
                 m += 1
 
diff --git a/wqflask/wqflask/marker_regression/rqtl_mapping.py b/wqflask/wqflask/marker_regression/rqtl_mapping.py
index b3c9fddf..32dbad1f 100644
--- a/wqflask/wqflask/marker_regression/rqtl_mapping.py
+++ b/wqflask/wqflask/marker_regression/rqtl_mapping.py
@@ -294,13 +294,13 @@ def add_categorical_covar(cross, covar_as_string, i):
     col_names = []
     # logger.info("loop")
     for x in range(1, (nCol + 1)):
-      #logger.info("loop" + str(x));
-      col_name = "covar_" + str(i) + "_" + str(x)
-      #logger.info("col_name" + col_name);
-      ro.r('the_cross$pheno <- cbind(pheno, ' + \
-           col_name + ' = newcovar[,' + str(x) + '])')
-      col_names.append(col_name)
-      #logger.info("loop" + str(x) + "done");
+        #logger.info("loop" + str(x));
+        col_name = "covar_" + str(i) + "_" + str(x)
+        #logger.info("col_name" + col_name);
+        ro.r('the_cross$pheno <- cbind(pheno, ' + \
+             col_name + ' = newcovar[,' + str(x) + '])')
+        col_names.append(col_name)
+        #logger.info("loop" + str(x) + "done");
 
     logger.info("returning from add_categorical_covar")
     return ro.r["the_cross"], col_names
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py
index d9b28fba..041f4348 100644
--- a/wqflask/wqflask/marker_regression/run_mapping.py
+++ b/wqflask/wqflask/marker_regression/run_mapping.py
@@ -65,10 +65,10 @@ class RunMapping:
         # ZS: Sometimes a group may have a genofile that only includes a subset of samples
         genofile_samplelist = []
         if 'genofile' in start_vars:
-          if start_vars['genofile'] != "":
-            self.genofile_string = start_vars['genofile']
-            self.dataset.group.genofile = self.genofile_string.split(":")[0]
-            genofile_samplelist = get_genofile_samplelist(self.dataset)
+            if start_vars['genofile'] != "":
+                self.genofile_string = start_vars['genofile']
+                self.dataset.group.genofile = self.genofile_string.split(":")[0]
+                genofile_samplelist = get_genofile_samplelist(self.dataset)
 
         all_samples_ordered = self.dataset.group.all_samples_ordered()
 
@@ -324,182 +324,182 @@ class RunMapping:
 
         self.no_results = False
         if len(results) == 0:
-          self.no_results = True
+            self.no_results = True
         else:
-          if self.pair_scan == True:
-              self.qtl_results = []
-              highest_chr = 1  # This is needed in order to convert the highest chr to X/Y
-              for marker in results:
-                  if marker['chr1'] > 0 or marker['chr1'] == "X" or marker['chr1'] == "X/Y":
-                      if marker['chr1'] > highest_chr or marker['chr1'] == "X" or marker['chr1'] == "X/Y":
-                          highest_chr = marker['chr1']
-                      if 'lod_score' in list(marker.keys()):
-                          self.qtl_results.append(marker)
-
-              self.trimmed_markers = results
-
-              for qtl in enumerate(self.qtl_results):
-                  self.json_data['chr1'].append(str(qtl['chr1']))
-                  self.json_data['chr2'].append(str(qtl['chr2']))
-                  self.json_data['Mb'].append(qtl['Mb'])
-                  self.json_data['markernames'].append(qtl['name'])
-
-              self.js_data = dict(
-                  json_data=self.json_data,
-                  this_trait=self.this_trait.name,
-                  data_set=self.dataset.name,
-                  maf=self.maf,
-                  manhattan_plot=self.manhattan_plot,
-                  mapping_scale=self.mapping_scale,
-                  qtl_results=self.qtl_results
-              )
-
-          else:
-              self.qtl_results = []
-              self.results_for_browser = []
-              self.annotations_for_browser = []
-              highest_chr = 1  # This is needed in order to convert the highest chr to X/Y
-              for marker in results:
-                  if 'Mb' in marker:
-                      this_ps = marker['Mb'] * 1000000
-                  else:
-                      this_ps = marker['cM'] * 1000000
-
-                  browser_marker = dict(
-                      chr=str(marker['chr']),
-                      rs=marker['name'],
-                      ps=this_ps,
-                      url="/show_trait?trait_id=" + \
-                          marker['name'] + "&dataset=" + \
-                              self.dataset.group.name + "Geno"
-                  )
-
-                  if self.geno_db_exists == "True":
-                      annot_marker = dict(
-                          name=str(marker['name']),
-                          chr=str(marker['chr']),
-                          rs=marker['name'],
-                          pos=this_ps,
-                          url="/show_trait?trait_id=" + \
-                              marker['name'] + "&dataset=" + \
-                                  self.dataset.group.name + "Geno"
-                      )
-                  else:
-                      annot_marker = dict(
-                          name=str(marker['name']),
-                          chr=str(marker['chr']),
-                          rs=marker['name'],
-                          pos=this_ps
-                      )
-
-                  if 'lrs_value' in marker and marker['lrs_value'] > 0:
-                      browser_marker['p_wald'] = 10**- \
-                          (marker['lrs_value'] / 4.61)
-                  elif 'lod_score' in marker and marker['lod_score'] > 0:
-                      browser_marker['p_wald'] = 10**-(marker['lod_score'])
-                  else:
-                      browser_marker['p_wald'] = 0
-
-                  self.results_for_browser.append(browser_marker)
-                  self.annotations_for_browser.append(annot_marker)
-                  if str(marker['chr']) > '0' or str(marker['chr']) == "X" or str(marker['chr']) == "X/Y":
-                      if str(marker['chr']) > str(highest_chr) or str(marker['chr']) == "X" or str(marker['chr']) == "X/Y":
-                          highest_chr = marker['chr']
-                      if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()):
-                          if 'Mb' in marker.keys():
-                              marker['display_pos'] = "Chr" + \
-                                  str(marker['chr']) + ": " + \
-                                      "{:.6f}".format(marker['Mb'])
-                          elif 'cM' in marker.keys():
-                              marker['display_pos'] = "Chr" + \
-                                  str(marker['chr']) + ": " + \
-                                      "{:.3f}".format(marker['cM'])
-                          else:
-                              marker['display_pos'] = "N/A"
-                          self.qtl_results.append(marker)
-
-              total_markers = len(self.qtl_results)
-
-              with Bench("Exporting Results"):
-                  export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path,
-                                         self.mapping_scale, self.score_type, self.transform, self.covariates, self.n_samples)
-
-              with Bench("Trimming Markers for Figure"):
-                  if len(self.qtl_results) > 30000:
-                      self.qtl_results = trim_markers_for_figure(
-                          self.qtl_results)
-                      self.results_for_browser = trim_markers_for_figure(
-                          self.results_for_browser)
-                      filtered_annotations = []
-                      for marker in self.results_for_browser:
-                          for annot_marker in self.annotations_for_browser:
-                              if annot_marker['rs'] == marker['rs']:
-                                  filtered_annotations.append(annot_marker)
-                                  break
-                      self.annotations_for_browser = filtered_annotations
-                      browser_files = write_input_for_browser(
-                          self.dataset, self.results_for_browser, self.annotations_for_browser)
-                  else:
-                      browser_files = write_input_for_browser(
-                          self.dataset, self.results_for_browser, self.annotations_for_browser)
-
-              with Bench("Trimming Markers for Table"):
-                  self.trimmed_markers = trim_markers_for_table(results)
-
-              chr_lengths = get_chr_lengths(
-                  self.mapping_scale, self.mapping_method, self.dataset, self.qtl_results)
-
-              # ZS: For zooming into genome browser, need to pass chromosome name instead of number
-              if self.dataset.group.species == "mouse":
-                  if self.selected_chr == 20:
-                      this_chr = "X"
-                  else:
-                      this_chr = str(self.selected_chr)
-              elif self.dataset.group.species == "rat":
-                  if self.selected_chr == 21:
-                      this_chr = "X"
-                  else:
-                      this_chr = str(self.selected_chr)
-              else:
-                  if self.selected_chr == 22:
-                      this_chr = "X"
-                  elif self.selected_chr == 23:
-                      this_chr = "Y"
-                  else:
-                      this_chr = str(self.selected_chr)
-
-              if self.mapping_method != "gemma":
-                  if self.score_type == "LRS":
-                      significant_for_browser = self.significant / 4.61
-                  else:
-                      significant_for_browser = self.significant
-
-                  self.js_data = dict(
-                      #result_score_type = self.score_type,
-                      #this_trait = self.this_trait.name,
-                      #data_set = self.dataset.name,
-                      #maf = self.maf,
-                      #manhattan_plot = self.manhattan_plot,
-                      #mapping_scale = self.mapping_scale,
-                      #chromosomes = chromosome_mb_lengths,
-                      #qtl_results = self.qtl_results,
-                      categorical_vars=self.categorical_vars,
-                      chr_lengths=chr_lengths,
-                      num_perm=self.num_perm,
-                      perm_results=self.perm_output,
-                      significant=significant_for_browser,
-                      browser_files=browser_files,
-                      selected_chr=this_chr,
-                      total_markers=total_markers
-                  )
-              else:
+            if self.pair_scan == True:
+                self.qtl_results = []
+                highest_chr = 1  # This is needed in order to convert the highest chr to X/Y
+                for marker in results:
+                    if marker['chr1'] > 0 or marker['chr1'] == "X" or marker['chr1'] == "X/Y":
+                        if marker['chr1'] > highest_chr or marker['chr1'] == "X" or marker['chr1'] == "X/Y":
+                            highest_chr = marker['chr1']
+                        if 'lod_score' in list(marker.keys()):
+                            self.qtl_results.append(marker)
+
+                self.trimmed_markers = results
+
+                for qtl in enumerate(self.qtl_results):
+                    self.json_data['chr1'].append(str(qtl['chr1']))
+                    self.json_data['chr2'].append(str(qtl['chr2']))
+                    self.json_data['Mb'].append(qtl['Mb'])
+                    self.json_data['markernames'].append(qtl['name'])
+
                 self.js_data = dict(
-                    chr_lengths=chr_lengths,
-                    browser_files=browser_files,
-                    selected_chr=this_chr,
-                    total_markers=total_markers
+                    json_data=self.json_data,
+                    this_trait=self.this_trait.name,
+                    data_set=self.dataset.name,
+                    maf=self.maf,
+                    manhattan_plot=self.manhattan_plot,
+                    mapping_scale=self.mapping_scale,
+                    qtl_results=self.qtl_results
                 )
 
+            else:
+                self.qtl_results = []
+                self.results_for_browser = []
+                self.annotations_for_browser = []
+                highest_chr = 1  # This is needed in order to convert the highest chr to X/Y
+                for marker in results:
+                    if 'Mb' in marker:
+                        this_ps = marker['Mb'] * 1000000
+                    else:
+                        this_ps = marker['cM'] * 1000000
+
+                    browser_marker = dict(
+                        chr=str(marker['chr']),
+                        rs=marker['name'],
+                        ps=this_ps,
+                        url="/show_trait?trait_id=" + \
+                            marker['name'] + "&dataset=" + \
+                                self.dataset.group.name + "Geno"
+                    )
+
+                    if self.geno_db_exists == "True":
+                        annot_marker = dict(
+                            name=str(marker['name']),
+                            chr=str(marker['chr']),
+                            rs=marker['name'],
+                            pos=this_ps,
+                            url="/show_trait?trait_id=" + \
+                                marker['name'] + "&dataset=" + \
+                                    self.dataset.group.name + "Geno"
+                        )
+                    else:
+                        annot_marker = dict(
+                            name=str(marker['name']),
+                            chr=str(marker['chr']),
+                            rs=marker['name'],
+                            pos=this_ps
+                        )
+
+                    if 'lrs_value' in marker and marker['lrs_value'] > 0:
+                        browser_marker['p_wald'] = 10**- \
+                            (marker['lrs_value'] / 4.61)
+                    elif 'lod_score' in marker and marker['lod_score'] > 0:
+                        browser_marker['p_wald'] = 10**-(marker['lod_score'])
+                    else:
+                        browser_marker['p_wald'] = 0
+
+                    self.results_for_browser.append(browser_marker)
+                    self.annotations_for_browser.append(annot_marker)
+                    if str(marker['chr']) > '0' or str(marker['chr']) == "X" or str(marker['chr']) == "X/Y":
+                        if str(marker['chr']) > str(highest_chr) or str(marker['chr']) == "X" or str(marker['chr']) == "X/Y":
+                            highest_chr = marker['chr']
+                        if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()):
+                            if 'Mb' in marker.keys():
+                                marker['display_pos'] = "Chr" + \
+                                    str(marker['chr']) + ": " + \
+                                        "{:.6f}".format(marker['Mb'])
+                            elif 'cM' in marker.keys():
+                                marker['display_pos'] = "Chr" + \
+                                    str(marker['chr']) + ": " + \
+                                        "{:.3f}".format(marker['cM'])
+                            else:
+                                marker['display_pos'] = "N/A"
+                            self.qtl_results.append(marker)
+
+                total_markers = len(self.qtl_results)
+
+                with Bench("Exporting Results"):
+                    export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path,
+                                           self.mapping_scale, self.score_type, self.transform, self.covariates, self.n_samples)
+
+                with Bench("Trimming Markers for Figure"):
+                    if len(self.qtl_results) > 30000:
+                        self.qtl_results = trim_markers_for_figure(
+                            self.qtl_results)
+                        self.results_for_browser = trim_markers_for_figure(
+                            self.results_for_browser)
+                        filtered_annotations = []
+                        for marker in self.results_for_browser:
+                            for annot_marker in self.annotations_for_browser:
+                                if annot_marker['rs'] == marker['rs']:
+                                    filtered_annotations.append(annot_marker)
+                                    break
+                        self.annotations_for_browser = filtered_annotations
+                        browser_files = write_input_for_browser(
+                            self.dataset, self.results_for_browser, self.annotations_for_browser)
+                    else:
+                        browser_files = write_input_for_browser(
+                            self.dataset, self.results_for_browser, self.annotations_for_browser)
+
+                with Bench("Trimming Markers for Table"):
+                    self.trimmed_markers = trim_markers_for_table(results)
+
+                chr_lengths = get_chr_lengths(
+                    self.mapping_scale, self.mapping_method, self.dataset, self.qtl_results)
+
+                # ZS: For zooming into genome browser, need to pass chromosome name instead of number
+                if self.dataset.group.species == "mouse":
+                    if self.selected_chr == 20:
+                        this_chr = "X"
+                    else:
+                        this_chr = str(self.selected_chr)
+                elif self.dataset.group.species == "rat":
+                    if self.selected_chr == 21:
+                        this_chr = "X"
+                    else:
+                        this_chr = str(self.selected_chr)
+                else:
+                    if self.selected_chr == 22:
+                        this_chr = "X"
+                    elif self.selected_chr == 23:
+                        this_chr = "Y"
+                    else:
+                        this_chr = str(self.selected_chr)
+
+                if self.mapping_method != "gemma":
+                    if self.score_type == "LRS":
+                        significant_for_browser = self.significant / 4.61
+                    else:
+                        significant_for_browser = self.significant
+
+                    self.js_data = dict(
+                        #result_score_type = self.score_type,
+                        #this_trait = self.this_trait.name,
+                        #data_set = self.dataset.name,
+                        #maf = self.maf,
+                        #manhattan_plot = self.manhattan_plot,
+                        #mapping_scale = self.mapping_scale,
+                        #chromosomes = chromosome_mb_lengths,
+                        #qtl_results = self.qtl_results,
+                        categorical_vars=self.categorical_vars,
+                        chr_lengths=chr_lengths,
+                        num_perm=self.num_perm,
+                        perm_results=self.perm_output,
+                        significant=significant_for_browser,
+                        browser_files=browser_files,
+                        selected_chr=this_chr,
+                        total_markers=total_markers
+                    )
+                else:
+                    self.js_data = dict(
+                        chr_lengths=chr_lengths,
+                        browser_files=browser_files,
+                        selected_chr=this_chr,
+                        total_markers=total_markers
+                    )
+
     def run_rqtl_plink(self):
         # os.chdir("") never do this inside a webserver!!
 
diff --git a/wqflask/wqflask/model.py b/wqflask/wqflask/model.py
index 7b9ff8fe..55b0278a 100644
--- a/wqflask/wqflask/model.py
+++ b/wqflask/wqflask/model.py
@@ -36,7 +36,7 @@ class User(Base):
 
     # json detailing when they became a superuser, otherwise empty
     superuser = Column(Text)
-                             # if not superuser
+                       # if not superuser
 
     logins = relationship("Login",
                           order_by="desc(Login.timestamp)",
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 0d2fb2f8..2e1cb992 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -78,7 +78,7 @@ class SearchResultPage:
         try:
             self.search()
         except:
-           self.search_term_exists = False
+            self.search_term_exists = False
 
         self.too_many_results = False
         if self.search_term_exists:
diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py
index bfaed9c2..725e7c9e 100644
--- a/wqflask/wqflask/user_login.py
+++ b/wqflask/wqflask/user_login.py
@@ -464,49 +464,49 @@ def password_reset_step2():
 
 
 def register_user(params):
-        thank_you_mode = False
-        errors = []
-        user_details = {}
-
-        user_details['email_address'] = params.get(
-            'email_address', '').encode("utf-8").strip()
-        if not (5 <= len(user_details['email_address']) <= 50):
-            errors.append(
-                'Email Address needs to be between 5 and 50 characters.')
-        else:
-            email_exists = get_user_by_unique_column(
-                "email_address", user_details['email_address'])
-            if email_exists:
-                errors.append('User already exists with that email')
+    thank_you_mode = False
+    errors = []
+    user_details = {}
 
-        user_details['full_name'] = params.get(
-            'full_name', '').encode("utf-8").strip()
-        if not (5 <= len(user_details['full_name']) <= 50):
-            errors.append('Full Name needs to be between 5 and 50 characters.')
+    user_details['email_address'] = params.get(
+        'email_address', '').encode("utf-8").strip()
+    if not (5 <= len(user_details['email_address']) <= 50):
+        errors.append(
+            'Email Address needs to be between 5 and 50 characters.')
+    else:
+        email_exists = get_user_by_unique_column(
+            "email_address", user_details['email_address'])
+        if email_exists:
+            errors.append('User already exists with that email')
 
-        user_details['organization'] = params.get(
-            'organization', '').encode("utf-8").strip()
-        if user_details['organization'] and not (5 <= len(user_details['organization']) <= 50):
-            errors.append(
-                'Organization needs to be empty or between 5 and 50 characters.')
+    user_details['full_name'] = params.get(
+        'full_name', '').encode("utf-8").strip()
+    if not (5 <= len(user_details['full_name']) <= 50):
+        errors.append('Full Name needs to be between 5 and 50 characters.')
 
-        password = str(params.get('password', ''))
-        if not (6 <= len(password)):
-            errors.append('Password needs to be at least 6 characters.')
+    user_details['organization'] = params.get(
+        'organization', '').encode("utf-8").strip()
+    if user_details['organization'] and not (5 <= len(user_details['organization']) <= 50):
+        errors.append(
+            'Organization needs to be empty or between 5 and 50 characters.')
 
-        if params.get('password_confirm') != password:
-            errors.append("Passwords don't match.")
+    password = str(params.get('password', ''))
+    if not (6 <= len(password)):
+        errors.append('Password needs to be at least 6 characters.')
 
-        user_details['password'] = set_password(password)
-        user_details['user_id'] = str(uuid.uuid4())
-        user_details['confirmed'] = 1
+    if params.get('password_confirm') != password:
+        errors.append("Passwords don't match.")
 
-        user_details['registration_info'] = basic_info()
+    user_details['password'] = set_password(password)
+    user_details['user_id'] = str(uuid.uuid4())
+    user_details['confirmed'] = 1
 
-        if len(errors) == 0:
-            save_user(user_details, user_details['user_id'])
+    user_details['registration_info'] = basic_info()
+
+    if len(errors) == 0:
+        save_user(user_details, user_details['user_id'])
 
-        return errors
+    return errors
 
 
 @app.route("/n/register", methods=('GET', 'POST'))