about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/data_set.py20
-rw-r--r--wqflask/db/call.py38
-rw-r--r--wqflask/wqflask/gsearch.py240
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py6
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py62
-rw-r--r--wqflask/wqflask/update_search_results.py34
-rw-r--r--wqflask/wqflask/views.py68
7 files changed, 216 insertions, 252 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 8206b67c..33e6f353 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -32,7 +32,6 @@ from maintenance import get_group_samplelists
 from utility.tools import locate, locate_ignore_error, flat_files
 from utility import gen_geno_ob
 from utility import chunks
-from utility.benchmark import Bench
 from utility import webqtlUtil
 from db import webqtlDatabaseFunction
 from base import species
@@ -201,16 +200,15 @@ def create_datasets_list():
 
     if result is None:
         datasets = list()
-        with Bench("Creating DataSets object"):
-            type_dict = {'Publish': 'PublishFreeze',
-                         'ProbeSet': 'ProbeSetFreeze',
-                         'Geno': 'GenoFreeze'}
-
-            for dataset_type in type_dict:
-                query = "SELECT Name FROM {}".format(type_dict[dataset_type])
-                for result in fetchall(query):
-                    dataset = create_dataset(result.Name, dataset_type)
-                    datasets.append(dataset)
+        type_dict = {'Publish': 'PublishFreeze',
+                     'ProbeSet': 'ProbeSetFreeze',
+                     'Geno': 'GenoFreeze'}
+
+        for dataset_type in type_dict:
+            query = "SELECT Name FROM {}".format(type_dict[dataset_type])
+            for result in fetchall(query):
+                dataset = create_dataset(result.Name, dataset_type)
+                datasets.append(dataset)
 
         if USE_REDIS:
             r.set(key, pickle.dumps(datasets, pickle.HIGHEST_PROTOCOL))
diff --git a/wqflask/db/call.py b/wqflask/db/call.py
index a6bbda54..c27e0326 100644
--- a/wqflask/db/call.py
+++ b/wqflask/db/call.py
@@ -11,13 +11,10 @@ except:
     import urllib2
 import json
 from utility.tools import USE_GN_SERVER, LOG_SQL, GN_SERVER_URL
-from utility.benchmark import Bench
 
 from utility.logger import getLogger
 logger = getLogger(__name__)
 
-# from inspect import stack
-
 
 def fetch1(query, path=None, func=None):
     """Fetch one result as a Tuple using either a SQL query or the URI
@@ -41,11 +38,10 @@ def fetchone(query):
 original fetchone, but with logging)
 
     """
-    with Bench("SQL", LOG_SQL):
-        def helper(query):
-            res = g.db.execute(query)
-            return res.fetchone()
-        return logger.sql(query, helper)
+    def helper(query):
+        res = g.db.execute(query)
+        return res.fetchone()
+    return logger.sql(query, helper)
 
 
 def fetchall(query):
@@ -53,23 +49,21 @@ def fetchall(query):
 original fetchall, but with logging)
 
     """
-    with Bench("SQL", LOG_SQL):
-        def helper(query):
-            res = g.db.execute(query)
-            return res.fetchall()
-        return logger.sql(query, helper)
+    def helper(query):
+        res = g.db.execute(query)
+        return res.fetchall()
+    return logger.sql(query, helper)
 
 
 def gn_server(path):
     """Return JSON record by calling GN_SERVER
 
     """
-    with Bench("GN_SERVER", LOG_SQL):
-        res = ()
-        try:
-            res = urllib.request.urlopen(GN_SERVER_URL + path)
-        except:
-            res = urllib2.urlopen(GN_SERVER_URL + path)
-        rest = res.read()
-        res2 = json.loads(rest)
-        return res2
+    res = ()
+    try:
+        res = urllib.request.urlopen(GN_SERVER_URL + path)
+    except:
+        res = urllib2.urlopen(GN_SERVER_URL + path)
+    rest = res.read()
+    res2 = json.loads(rest)
+    return res2
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 74964297..6d49bc79 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -11,7 +11,6 @@ from base import webqtlConfig
 
 from utility import hmac
 
-from utility.benchmark import Bench
 from utility.authentication_tools import check_resource_availability
 from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string
 
@@ -61,74 +60,72 @@ class GSearch:
                 ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
                 LIMIT 6000
                 """ % (self.terms)
-            with Bench("Running query"):
-                re = g.db.execute(sql).fetchall()
+            re = g.db.execute(sql).fetchall()
 
             trait_list = []
             dataset_to_permissions = {}
-            with Bench("Creating trait objects"):
-                for i, line in enumerate(re):
-                    this_trait = {}
-                    this_trait['index'] = i + 1
-                    this_trait['name'] = line[5]
-                    this_trait['dataset'] = line[3]
-                    this_trait['dataset_fullname'] = line[4]
-                    this_trait['hmac'] = hmac.data_hmac(
-                        '{}:{}'.format(line[5], line[3]))
-                    this_trait['species'] = line[0]
-                    this_trait['group'] = line[1]
-                    this_trait['tissue'] = line[2]
-                    this_trait['symbol'] = "N/A"
-                    if line[6]:
-                        this_trait['symbol'] = line[6]
-                    this_trait['description'] = "N/A"
-                    if line[7]:
-                        this_trait['description'] = line[7].decode(
-                            'utf-8', 'replace')
-                    this_trait['location_repr'] = "N/A"
-                    if (line[8] != "NULL" and line[8] != "") and (line[9] != 0):
-                        this_trait['location_repr'] = 'Chr%s: %.6f' % (
-                            line[8], float(line[9]))
+            for i, line in enumerate(re):
+                this_trait = {}
+                this_trait['index'] = i + 1
+                this_trait['name'] = line[5]
+                this_trait['dataset'] = line[3]
+                this_trait['dataset_fullname'] = line[4]
+                this_trait['hmac'] = hmac.data_hmac(
+                    '{}:{}'.format(line[5], line[3]))
+                this_trait['species'] = line[0]
+                this_trait['group'] = line[1]
+                this_trait['tissue'] = line[2]
+                this_trait['symbol'] = "N/A"
+                if line[6]:
+                    this_trait['symbol'] = line[6]
+                this_trait['description'] = "N/A"
+                if line[7]:
+                    this_trait['description'] = line[7].decode(
+                        'utf-8', 'replace')
+                this_trait['location_repr'] = "N/A"
+                if (line[8] != "NULL" and line[8] != "") and (line[9] != 0):
+                    this_trait['location_repr'] = 'Chr%s: %.6f' % (
+                        line[8], float(line[9]))
 
-                    this_trait['LRS_score_repr'] = "N/A"
-                    this_trait['additive'] = "N/A"
-                    this_trait['mean'] = "N/A"
+                this_trait['LRS_score_repr'] = "N/A"
+                this_trait['additive'] = "N/A"
+                this_trait['mean'] = "N/A"
 
-                    if line[11] != "" and line[11] != None:
-                        this_trait['LRS_score_repr'] = f"{line[11]:.3f}"
-                    if line[14] != "" and line[14] != None:
-                        this_trait['additive'] = f"{line[14]:.3f}"
-                    if line[10] != "" and line[10] != None:
-                        this_trait['mean'] = f"{line[10]:.3f}"
+                if line[11] != "" and line[11] != None:
+                    this_trait['LRS_score_repr'] = f"{line[11]:.3f}"
+                if line[14] != "" and line[14] != None:
+                    this_trait['additive'] = f"{line[14]:.3f}"
+                if line[10] != "" and line[10] != None:
+                    this_trait['mean'] = f"{line[10]:.3f}"
 
-                    locus_chr = line[16]
-                    locus_mb = line[17]
+                locus_chr = line[16]
+                locus_mb = line[17]
 
-                    max_lrs_text = "N/A"
-                    if locus_chr and locus_mb:
-                        max_lrs_text = f"Chr{locus_chr}: {locus_mb}"
-                    this_trait['max_lrs_text'] = max_lrs_text
+                max_lrs_text = "N/A"
+                if locus_chr and locus_mb:
+                    max_lrs_text = f"Chr{locus_chr}: {locus_mb}"
+                this_trait['max_lrs_text'] = max_lrs_text
 
-                    this_trait['additive'] = "N/A"
-                    if line[14] != "" and line[14] != None:
-                        this_trait['additive'] = '%.3f' % line[14]
-                    this_trait['dataset_id'] = line[15]
+                this_trait['additive'] = "N/A"
+                if line[14] != "" and line[14] != None:
+                    this_trait['additive'] = '%.3f' % line[14]
+                this_trait['dataset_id'] = line[15]
 
-                    dataset_ob = SimpleNamespace(
-                        id=this_trait["dataset_id"], type="ProbeSet", name=this_trait["dataset"], species=this_trait["species"])
-                    if dataset_ob.id not in dataset_to_permissions:
-                        permissions = check_resource_availability(dataset_ob)
-                        dataset_to_permissions[dataset_ob.id] = permissions
-                    else:
-                        pemissions = dataset_to_permissions[dataset_ob.id]
-                    if type(permissions['data']) is list:
-                        if "view" not in permissions['data']:
-                            continue
-                    else:
-                        if permissions['data'] == 'no-access':
-                            continue
+                dataset_ob = SimpleNamespace(
+                    id=this_trait["dataset_id"], type="ProbeSet", name=this_trait["dataset"], species=this_trait["species"])
+                if dataset_ob.id not in dataset_to_permissions:
+                    permissions = check_resource_availability(dataset_ob)
+                    dataset_to_permissions[dataset_ob.id] = permissions
+                else:
+                    pemissions = dataset_to_permissions[dataset_ob.id]
+                if type(permissions['data']) is list:
+                    if "view" not in permissions['data']:
+                        continue
+                else:
+                    if permissions['data'] == 'no-access':
+                        continue
 
-                    trait_list.append(this_trait)
+                trait_list.append(this_trait)
 
             self.trait_count = len(trait_list)
             self.trait_list = trait_list
@@ -208,76 +205,75 @@ class GSearch:
                 """.format(group_clause, search_term)
             re = g.db.execute(sql).fetchall()
             trait_list = []
-            with Bench("Creating trait objects"):
-                for i, line in enumerate(re):
-                    this_trait = {}
-                    this_trait['index'] = i + 1
-                    this_trait['name'] = str(line[4])
-                    if len(str(line[12])) == 3:
-                        this_trait['display_name'] = str(
-                            line[12]) + "_" + this_trait['name']
-                    else:
-                        this_trait['display_name'] = this_trait['name']
-                    this_trait['dataset'] = line[2]
-                    this_trait['dataset_fullname'] = line[3]
-                    this_trait['hmac'] = hmac.data_hmac(
-                        '{}:{}'.format(line[4], line[2]))
-                    this_trait['species'] = line[0]
-                    this_trait['group'] = line[1]
-                    if line[9] != None and line[6] != None:
-                        this_trait['description'] = line[6].decode(
-                            'utf-8', 'replace')
-                    elif line[5] != None:
-                        this_trait['description'] = line[5].decode(
-                            'utf-8', 'replace')
-                    else:
-                        this_trait['description'] = "N/A"
-                    this_trait['dataset_id'] = line[14]
+            for i, line in enumerate(re):
+                this_trait = {}
+                this_trait['index'] = i + 1
+                this_trait['name'] = str(line[4])
+                if len(str(line[12])) == 3:
+                    this_trait['display_name'] = str(
+                        line[12]) + "_" + this_trait['name']
+                else:
+                    this_trait['display_name'] = this_trait['name']
+                this_trait['dataset'] = line[2]
+                this_trait['dataset_fullname'] = line[3]
+                this_trait['hmac'] = hmac.data_hmac(
+                    '{}:{}'.format(line[4], line[2]))
+                this_trait['species'] = line[0]
+                this_trait['group'] = line[1]
+                if line[9] != None and line[6] != None:
+                    this_trait['description'] = line[6].decode(
+                        'utf-8', 'replace')
+                elif line[5] != None:
+                    this_trait['description'] = line[5].decode(
+                        'utf-8', 'replace')
+                else:
+                    this_trait['description'] = "N/A"
+                this_trait['dataset_id'] = line[14]
 
-                    this_trait['LRS_score_repr'] = "N/A"
-                    this_trait['additive'] = "N/A"
-                    this_trait['mean'] = "N/A"
+                this_trait['LRS_score_repr'] = "N/A"
+                this_trait['additive'] = "N/A"
+                this_trait['mean'] = "N/A"
 
-                    if line[10] != "" and line[10] != None:
-                        this_trait['LRS_score_repr'] = f"{line[10]:.3f}"
-                        # Some Max LRS values in the DB are wrongly listed as 0.000, but shouldn't be displayed
-                        if this_trait['LRS_score_repr'] == "0.000":
-                            this_trait['LRS_score_repr'] = "N/A"
-                    if line[11] != "" and line[11] != None:
-                        this_trait['additive'] = f"{line[11]:.3f}"
-                    if line[13] != "" and line[13] != None:
-                        this_trait['mean'] = f"{line[13]:.3f}"
+                if line[10] != "" and line[10] != None:
+                    this_trait['LRS_score_repr'] = f"{line[10]:.3f}"
+                    # Some Max LRS values in the DB are wrongly listed as 0.000, but shouldn't be displayed
+                    if this_trait['LRS_score_repr'] == "0.000":
+                        this_trait['LRS_score_repr'] = "N/A"
+                if line[11] != "" and line[11] != None:
+                    this_trait['additive'] = f"{line[11]:.3f}"
+                if line[13] != "" and line[13] != None:
+                    this_trait['mean'] = f"{line[13]:.3f}"
 
-                    locus_chr = line[15]
-                    locus_mb = line[16]
+                locus_chr = line[15]
+                locus_mb = line[16]
 
-                    max_lrs_text = "N/A"
-                    if locus_chr and locus_mb:
-                        max_lrs_text = f"Chr{locus_chr}: {locus_mb}"
-                    this_trait['max_lrs_text'] = max_lrs_text
+                max_lrs_text = "N/A"
+                if locus_chr and locus_mb:
+                    max_lrs_text = f"Chr{locus_chr}: {locus_mb}"
+                this_trait['max_lrs_text'] = max_lrs_text
 
-                    this_trait['authors'] = line[7]
-                    this_trait['year'] = line[8]
-                    this_trait['pubmed_text'] = "N/A"
-                    this_trait['pubmed_link'] = "N/A"
-                    if this_trait['year'].isdigit():
-                        this_trait['pubmed_text'] = this_trait['year']
-                    if line[9] != "" and line[9] != None:
-                        this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8]
-                        if line[12]:
-                            this_trait['display_name'] = line[12] + \
-                                "_" + str(this_trait['name'])
+                this_trait['authors'] = line[7]
+                this_trait['year'] = line[8]
+                this_trait['pubmed_text'] = "N/A"
+                this_trait['pubmed_link'] = "N/A"
+                if this_trait['year'].isdigit():
+                    this_trait['pubmed_text'] = this_trait['year']
+                if line[9] != "" and line[9] != None:
+                    this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8]
+                    if line[12]:
+                        this_trait['display_name'] = line[12] + \
+                            "_" + str(this_trait['name'])
 
-                    dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="Publish", species=this_trait["species"])
-                    permissions = check_resource_availability(dataset_ob, this_trait['name'])
-                    if type(permissions['data']) is list:
-                        if "view" not in permissions['data']:
-                            continue
-                    else:
-                        if permissions['data'] == 'no-access':
-                            continue
+                dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="Publish", species=this_trait["species"])
+                permissions = check_resource_availability(dataset_ob, this_trait['name'])
+                if type(permissions['data']) is list:
+                    if "view" not in permissions['data']:
+                        continue
+                else:
+                    if permissions['data'] == 'no-access':
+                        continue
 
-                    trait_list.append(this_trait)
+                trait_list.append(this_trait)
 
             self.trait_count = len(trait_list)
             self.trait_list = trait_list
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 278d8a6b..ef0c357e 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -42,7 +42,6 @@ from base import webqtlConfig
 from base.GeneralObject import GeneralObject
 from utility import webqtlUtil
 from utility import Plot
-from utility.benchmark import Bench
 from wqflask.interval_analyst import GeneUtil
 from base.webqtlConfig import GENERATED_IMAGE_DIR
 from utility.pillow_utils import draw_rotated_text, draw_open_polygon
@@ -587,9 +586,8 @@ class DisplayMappingResults:
         ################################################################
         showLocusForm = ""
         intCanvas = Image.new("RGBA", size=(self.graphWidth, self.graphHeight))
-        with Bench("Drawing Plot"):
-            gifmap = self.plotIntMapping(
-                intCanvas, startMb=self.startMb, endMb=self.endMb, showLocusForm=showLocusForm)
+        gifmap = self.plotIntMapping(
+            intCanvas, startMb=self.startMb, endMb=self.endMb, showLocusForm=showLocusForm)
 
         self.gifmap = gifmap.__str__()
 
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py
index 7a424b17..c57596e9 100644
--- a/wqflask/wqflask/marker_regression/run_mapping.py
+++ b/wqflask/wqflask/marker_regression/run_mapping.py
@@ -33,7 +33,6 @@ from utility import webqtlUtil
 from utility import helper_functions
 from utility import Plot, Bunch
 from utility import temp_data
-from utility.benchmark import Bench
 from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping
 from wqflask.show_trait.SampleList import SampleList
 
@@ -204,13 +203,12 @@ class RunMapping:
                 self.first_run = False
             self.score_type = "-logP"
             self.manhattan_plot = True
-            with Bench("Running GEMMA"):
-                if self.use_loco == "True":
-                    marker_obs, self.output_files = gemma_mapping.run_gemma(
-                        self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files)
-                else:
-                    marker_obs, self.output_files = gemma_mapping.run_gemma(
-                        self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files)
+            if self.use_loco == "True":
+                marker_obs, self.output_files = gemma_mapping.run_gemma(
+                    self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files)
+            else:
+                marker_obs, self.output_files = gemma_mapping.run_gemma(
+                    self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files)
             results = marker_obs
         elif self.mapping_method == "rqtl_plink":
             results = self.run_rqtl_plink()
@@ -372,33 +370,29 @@ class RunMapping:
                             self.qtl_results.append(marker)
 
                 total_markers = len(self.qtl_results)
+                export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path,
+                                       self.mapping_method, self.mapping_scale, self.score_type,
+                                       self.transform, self.covariates, self.n_samples, self.vals_hash)
+
+                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("Exporting Results"):
-                    export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path,
-                                           self.mapping_method, self.mapping_scale, self.score_type,
-                                           self.transform, self.covariates, self.n_samples, self.vals_hash)
-
-                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)
+                self.trimmed_markers = trim_markers_for_table(results)
 
                 chr_lengths = get_chr_lengths(
                     self.mapping_scale, self.mapping_method, self.dataset, self.qtl_results)
diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py
index 6b1b4e97..f132e2c6 100644
--- a/wqflask/wqflask/update_search_results.py
+++ b/wqflask/wqflask/update_search_results.py
@@ -5,8 +5,6 @@ from base.data_set import create_dataset
 from base.trait import GeneralTrait
 from db import webqtlDatabaseFunction
 
-from utility.benchmark import Bench
-
 
 class GSearch:
 
@@ -43,18 +41,15 @@ class GSearch:
                 ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
                 LIMIT 6000
                 """ % (self.terms)
-            with Bench("Running query"):
-                re = g.db.execute(sql).fetchall()
+            re = g.db.execute(sql).fetchall()
             self.trait_list = []
-            with Bench("Creating trait objects"):
-                for line in re:
-                    dataset = create_dataset(
-                        line[3], "ProbeSet", get_samplelist=False)
-                    trait_id = line[4]
-                    # with Bench("Building trait object"):
-                    this_trait = GeneralTrait(
-                        dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
-                    self.trait_list.append(this_trait)
+            for line in re:
+                dataset = create_dataset(
+                    line[3], "ProbeSet", get_samplelist=False)
+                trait_id = line[4]
+                this_trait = GeneralTrait(
+                    dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+                self.trait_list.append(this_trait)
 
         elif self.type == "phenotype":
             sql = """
@@ -90,13 +85,12 @@ class GSearch:
                 """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
             re = g.db.execute(sql).fetchall()
             self.trait_list = []
-            with Bench("Creating trait objects"):
-                for line in re:
-                    dataset = create_dataset(line[2], "Publish")
-                    trait_id = line[3]
-                    this_trait = GeneralTrait(
-                        dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
-                    self.trait_list.append(this_trait)
+            for line in re:
+                dataset = create_dataset(line[2], "Publish")
+                trait_id = line[3]
+                this_trait = GeneralTrait(
+                    dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+                self.trait_list.append(this_trait)
 
         self.results = self.convert_to_json()
 
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index d80d557b..acd65587 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -95,7 +95,6 @@ from utility.redis_tools import get_redis_conn
 
 
 from base.webqtlConfig import GENERATED_IMAGE_DIR, DEFAULT_PRIVILEGES
-from utility.benchmark import Bench
 
 from pprint import pformat as pf
 
@@ -217,12 +216,11 @@ def twitter(filename):
 def search_page():
     result = None
     if USE_REDIS:
-        with Bench("Trying Redis cache"):
-            key = "search_results:v1:" + \
-                json.dumps(request.args, sort_keys=True)
-            result = Redis.get(key)
-            if result:
-                result = pickle.loads(result)
+        key = "search_results:v1:" + \
+            json.dumps(request.args, sort_keys=True)
+        result = Redis.get(key)
+        if result:
+            result = pickle.loads(result)
     the_search = SearchResultPage(request.args)
     result = the_search.__dict__
     valid_search = result['search_term_exists']
@@ -529,12 +527,10 @@ def heatmap_page():
         version = "v5"
         key = "heatmap:{}:".format(
             version) + json.dumps(start_vars, sort_keys=True)
-        with Bench("Loading cache"):
-            result = Redis.get(key)
+        result = Redis.get(key)
 
         if result:
-            with Bench("Loading results"):
-                result = pickle.loads(result)
+            result = pickle.loads(result)
 
         else:
             template_vars = heatmap.Heatmap(request.form, temp_uuid)
@@ -547,9 +543,7 @@ def heatmap_page():
             pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL)
             Redis.set(key, pickled_result)
             Redis.expire(key, 60 * 60)
-
-        with Bench("Rendering template"):
-            rendered_template = render_template("heatmap.html", **result)
+        rendered_template = render_template("heatmap.html", **result)
 
     else:
         rendered_template = render_template(
@@ -762,40 +756,36 @@ def mapping_results_page():
     version = "v3"
     key = "mapping_results:{}:".format(
         version) + json.dumps(start_vars, sort_keys=True)
-    with Bench("Loading cache"):
-        result = None  # Just for testing
+    result = None  # Just for testing
 
     if result:
-        with Bench("Loading results"):
-            result = pickle.loads(result)
+        result = pickle.loads(result)
     else:
-        with Bench("Total time in RunMapping"):
-            try:
-                template_vars = run_mapping.RunMapping(start_vars, temp_uuid)
-                if template_vars.no_results:
-                    rendered_template = render_template("mapping_error.html")
-                    return rendered_template
-            except:
+        try:
+            template_vars = run_mapping.RunMapping(start_vars, temp_uuid)
+            if template_vars.no_results:
                 rendered_template = render_template("mapping_error.html")
                 return rendered_template
+        except:
+            rendered_template = render_template("mapping_error.html")
+            return rendered_template
 
-            if not template_vars.pair_scan:
-                template_vars.js_data = json.dumps(template_vars.js_data,
-                                                   default=json_default_handler,
-                                                   indent="   ")
+        if not template_vars.pair_scan:
+            template_vars.js_data = json.dumps(template_vars.js_data,
+                                               default=json_default_handler,
+                                               indent="   ")
 
-            result = template_vars.__dict__
+        result = template_vars.__dict__
 
-            if result['pair_scan']:
-                with Bench("Rendering template"):
-                    rendered_template = render_template(
-                        "pair_scan_results.html", **result)
-            else:
-                gn1_template_vars = display_mapping_results.DisplayMappingResults(
-                    result).__dict__
+        if result['pair_scan']:
+            rendered_template = render_template(
+                "pair_scan_results.html", **result)
+        else:
+            gn1_template_vars = display_mapping_results.DisplayMappingResults(
+                result).__dict__
 
-                rendered_template = render_template(
-                    "mapping_results.html", **gn1_template_vars)
+            rendered_template = render_template(
+                "mapping_results.html", **gn1_template_vars)
 
     return rendered_template