diff options
author | Munyoki Kilyungi | 2022-08-29 12:11:41 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-08-31 23:14:30 +0300 |
commit | 8c06a9534d3340ff0287b5c70f63b2000b6eb612 (patch) | |
tree | 799c07875ea3fee05b444b3375cfb69c5c277092 /wqflask | |
parent | 404d750ca24b3bb5c6284af354776b9bdb7fcef8 (diff) | |
download | genenetwork2-8c06a9534d3340ff0287b5c70f63b2000b6eb612.tar.gz |
Remove usage of "logger" and un-necessary comments wrt the same
Logging is used to introspect variables or notify the commencement of
a given operation. Logging should only be used to log errors. Also,
most of the logging is either "logger.debug" or "logger.info"; and
this won't show up in production/testing since we need a logging level
above "WARNING" for them to show up.
* wqflask/base/data_set.py (create_datasets_list): Remove logger.
(Markers.add_pvalues): Ditto.
(DataSet.retrieve_other_names): Ditto.
* wqflask/base/mrna_assay_tissue_data.py: Ditto.
* wqflask/base/webqtlCaseData.py: Ditto.
* wqflask/db/call.py (fetch1): Ditto.
(gn_server): Ditto.
* wqflask/db/gn_server.py: Ditto.
* wqflask/maintenance/set_resource_defaults.py: Ditto.
* wqflask/utility/Plot.py (find_outliers): Ditto.
* wqflask/utility/gen_geno_ob.py: Ditto.
* wqflask/utility/helper_functions.py: Ditto.
* wqflask/utility/pillow_utils.py: Ditto.
* wqflask/utility/redis_tools.py: Ditto.
* wqflask/wqflask/api/gen_menu.py (get_groups): Ditto.
* wqflask/wqflask/api/mapping.py: Ditto.
* wqflask/wqflask/api/router.py (get_dataset_info): Ditto.
* wqflask/wqflask/collect.py (report_change): Ditto.
* wqflask/wqflask/correlation/corr_scatter_plot.py: Ditto.
* wqflask/wqflask/ctl/ctl_analysis.py (CTL): Ditto.
(CTL.__init__): Ditto.
(CTL.run_analysis): Ditto.
(CTL.process_results): Ditto.
* wqflask/wqflask/db_info.py: Ditto.
* wqflask/wqflask/do_search.py (DoSearch.execute): Ditto.
(DoSearch.mescape): Ditto.
(DoSearch.get_search): Ditto.
(MrnaAssaySearch.run_combined): Ditto.
(MrnaAssaySearch.run): Ditto.
(PhenotypeSearch.run_combined): Ditto.
(GenotypeSearch.get_where_clause): Ditto.
(LrsSearch.get_where_clause): Ditto.
(MeanSearch.run): Ditto.
(RangeSearch.get_where_clause): Ditto.
(PvalueSearch.run): Ditto.
* wqflask/wqflask/docs.py: Ditto.
* wqflask/wqflask/export_traits.py: Ditto.
* wqflask/wqflask/external_tools/send_to_bnw.py: Ditto.
* wqflask/wqflask/external_tools/send_to_geneweaver.py: Ditto.
* wqflask/wqflask/external_tools/send_to_webgestalt.py: Ditto.
* wqflask/wqflask/gsearch.py (GSearch.__init__): Ditto.
* wqflask/wqflask/heatmap/heatmap.py: Ditto.
* wqflask/wqflask/marker_regression/display_mapping_results.py (DisplayMappingResults): Ditto.
* wqflask/wqflask/marker_regression/gemma_mapping.py: Ditto.
* wqflask/wqflask/marker_regression/plink_mapping.py (run_plink): Ditto.
* wqflask/wqflask/marker_regression/qtlreaper_mapping.py (run_reaper): Ditto.
* wqflask/wqflask/marker_regression/rqtl_mapping.py: Ditto.
* wqflask/wqflask/marker_regression/run_mapping.py (RunMapping.__init__): Ditto.
* wqflask/wqflask/parser.py (parse): Ditto.
* wqflask/wqflask/search_results.py (SearchResultPage.__init__): Ditto.
* wqflask/wqflask/update_search_results.py (GSearch.__init__): Ditto.
* wqflask/wqflask/user_login.py (send_email): Ditto.
(logout): Ditto.
(forgot_password_submit): Ditto.
(password_reset): Ditto.
(password_reset_step2): Ditto.
(register): Ditto.
* wqflask/wqflask/user_session.py (create_signed_cookie): Ditto.
Diffstat (limited to 'wqflask')
36 files changed, 2 insertions, 189 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 211c6752..8206b67c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -22,7 +22,6 @@ from dataclasses import field from dataclasses import InitVar from typing import Optional, Dict, List from db.call import fetchall, fetchone, fetch1 -from utility.logger import getLogger from utility.tools import USE_GN_SERVER, USE_REDIS, flat_files, flat_file_exists, GN2_BASE_URL from db.gn_server import menu_main from pprint import pformat as pf @@ -60,8 +59,6 @@ from redis import Redis r = Redis() -logger = getLogger(__name__) - # Used by create_database to instantiate objects # Each subclass will add to this DS_NAME_MAP = {} @@ -200,7 +197,6 @@ def create_datasets_list(): result = r.get(key) if result: - logger.debug("Redis cache hit") datasets = pickle.loads(result) if result is None: @@ -213,10 +209,6 @@ def create_datasets_list(): for dataset_type in type_dict: query = "SELECT Name FROM {}".format(type_dict[dataset_type]) for result in fetchall(query): - # The query at the beginning of this function isn't - # necessary here, but still would rather just reuse - # it logger.debug("type: {}\tname: - # {}".format(dataset_type, result.Name)) dataset = create_dataset(result.Name, dataset_type) datasets.append(dataset) @@ -259,9 +251,6 @@ class Markers: self.markers = markers def add_pvalues(self, p_values): - logger.debug("length of self.markers:", len(self.markers)) - logger.debug("length of p_values:", len(p_values)) - if isinstance(p_values, list): # THIS IS only needed for the case when we are limiting the number of p-values calculated # if len(self.markers) > len(p_values): @@ -664,8 +653,6 @@ class DataSet: """ % (query_args)) except TypeError: - logger.debug( - "Dataset {} is not yet available in GeneNetwork.".format(self.name)) pass def chunk_dataset(self, dataset, n): diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py index 8f8e2b0a..d7e747aa 100644 --- a/wqflask/base/mrna_assay_tissue_data.py +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -9,10 +9,6 @@ from utility.db_tools import escape from gn3.db_utils import database_connector -from utility.logger import getLogger -logger = getLogger(__name__) - - class MrnaAssayTissueData: def __init__(self, gene_symbols=None): diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index 25b6cb8a..dd6fad04 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -21,9 +21,6 @@ # Created by GeneNetwork Core Team 2010/08/10 -from utility.logger import getLogger -logger = getLogger(__name__) - import utility.tools utility.tools.show_settings() diff --git a/wqflask/db/call.py b/wqflask/db/call.py index 1fe0772b..a6bbda54 100644 --- a/wqflask/db/call.py +++ b/wqflask/db/call.py @@ -31,9 +31,6 @@ GN_SERVER result when set (which should return a Tuple) res2 = func(result) else: res2 = result, - if LOG_SQL: - logger.debug("Replaced SQL call", query) - logger.debug(path, res2) return res2 else: return fetchone(query) @@ -75,5 +72,4 @@ def gn_server(path): res = urllib2.urlopen(GN_SERVER_URL + path) rest = res.read() res2 = json.loads(rest) - logger.debug(res2) return res2 diff --git a/wqflask/db/gn_server.py b/wqflask/db/gn_server.py index f9b01658..af6682ba 100644 --- a/wqflask/db/gn_server.py +++ b/wqflask/db/gn_server.py @@ -2,9 +2,6 @@ from db.call import gn_server -from utility.logger import getLogger -logger = getLogger(__name__) - def menu_main(): return gn_server("/int/menu/main.json") diff --git a/wqflask/maintenance/set_resource_defaults.py b/wqflask/maintenance/set_resource_defaults.py index 22d73ba3..0d9372ff 100644 --- a/wqflask/maintenance/set_resource_defaults.py +++ b/wqflask/maintenance/set_resource_defaults.py @@ -33,8 +33,6 @@ Redis = get_redis_conn() import urllib.parse from wqflask.database import database_connection -from utility.logger import getLogger -logger = getLogger(__name__) def parse_db_uri(): diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py index d4256a46..df7156b4 100644 --- a/wqflask/utility/Plot.py +++ b/wqflask/utility/Plot.py @@ -33,8 +33,7 @@ from math import * import utility.corestats as corestats from base import webqtlConfig from utility.pillow_utils import draw_rotated_text -import utility.logger -logger = utility.logger.getLogger(__name__) + # ---- Define common colours ---- # BLUE = ImageColor.getrgb("blue") @@ -105,7 +104,6 @@ def find_outliers(vals): """ if vals: - #logger.debug("vals is:", pf(vals)) stats = corestats.Stats(vals) low_hinge = stats.percentile(25) up_hinge = stats.percentile(75) diff --git a/wqflask/utility/gen_geno_ob.py b/wqflask/utility/gen_geno_ob.py index e619b7b6..c7a1ea59 100644 --- a/wqflask/utility/gen_geno_ob.py +++ b/wqflask/utility/gen_geno_ob.py @@ -1,7 +1,3 @@ -import utility.logger -logger = utility.logger.getLogger(__name__) - - class genotype: """ Replacement for reaper.Dataset so we can remove qtlreaper use while still generating mapping output figure diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index 27dd0729..4229a91f 100644 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -6,9 +6,6 @@ from utility import hmac from flask import g -import logging -logger = logging.getLogger(__name__) - def get_species_dataset_trait(self, start_vars): if "temp_trait" in list(start_vars.keys()): diff --git a/wqflask/utility/pillow_utils.py b/wqflask/utility/pillow_utils.py index 5713e155..e302df18 100644 --- a/wqflask/utility/pillow_utils.py +++ b/wqflask/utility/pillow_utils.py @@ -2,9 +2,6 @@ from PIL import Image, ImageColor, ImageDraw, ImageFont from utility.tools import TEMPDIR -import utility.logger -logger = utility.logger.getLogger(__name__) - BLACK = ImageColor.getrgb("black") WHITE = ImageColor.getrgb("white") diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index 641d973e..945efbbd 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -5,8 +5,6 @@ import datetime import redis # used for collections from utility.hmac import hmac_creation -from utility.logger import getLogger -logger = getLogger(__name__) def get_redis_conn(): diff --git a/wqflask/wqflask/api/gen_menu.py b/wqflask/wqflask/api/gen_menu.py index 5d239343..45d5739e 100644 --- a/wqflask/wqflask/api/gen_menu.py +++ b/wqflask/wqflask/api/gen_menu.py @@ -1,8 +1,5 @@ from gn3.db.species import get_all_species -import utility.logger -logger = utility.logger.getLogger(__name__) - def gen_dropdown_json(conn): """Generates and outputs (as json file) the data for the main dropdown menus on the home page @@ -31,7 +28,6 @@ def get_groups(species, conn): "InbredSet.FullName) ASC, IFNULL(InbredSet.Family, " "InbredSet.FullName) ASC, InbredSet.FullName ASC, " "InbredSet.MenuOrderId ASC").format(species_name) - # logger.debug(query) cursor.execute(query) results = cursor.fetchall() for result in results: diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py index 3d33cc87..95cd2953 100644 --- a/wqflask/wqflask/api/router.py +++ b/wqflask/wqflask/api/router.py @@ -25,8 +25,6 @@ from utility.tools import flat_files from wqflask.database import database_connection -import utility.logger -logger = utility.logger.getLogger(__name__) version = "pre1" @@ -275,8 +273,6 @@ def get_dataset_info(dataset_name, group_name=None, file_format="json"): InbredSet.Name = "{0}" AND PublishXRef.Id = "{1}" """.format(group_name, dataset_name) - logger.debug("QUERY:", pheno_query) - pheno_results = g.db.execute(pheno_query) dataset = pheno_results.fetchone() diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 891da437..bb0973d5 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -21,9 +21,7 @@ from base.trait import retrieve_trait_info from base.trait import jsonable from base.data_set import create_dataset -from utility.logger import getLogger -logger = getLogger(__name__) Redis = get_redis_conn() @@ -48,8 +46,6 @@ def report_change(len_before, len_now): if new_length: flash("We've added {} to your collection.".format( numify(new_length, 'new trait', 'new traits'))) - else: - logger.debug("No new traits were added.") @app.route("/collections/store_trait_list", methods=('POST',)) diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index cafb9265..5df28c45 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -8,9 +8,6 @@ from utility import corr_result_helpers from scipy import stats import numpy as np -import utility.logger -logger = utility.logger.getLogger(__name__) - class CorrScatterPlot: """Page that displays a correlation scatterplot with a line fitted to it""" diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index bb928ec5..96a47eb8 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -24,8 +24,6 @@ from utility.tools import locate, GN2_BRANCH_URL from rpy2.robjects.packages import importr -import utility.logger -logger = utility.logger.getLogger(__name__) # Get pointers to some common R functions r_library = ro.r["library"] # Map the library function @@ -42,14 +40,9 @@ r_as_numeric = ro.r["as.numeric"] # Map the write.table function class CTL: def __init__(self): - logger.info("Initialization of CTL") - #log = r_file("/tmp/genenetwork_ctl.log", open = "wt") - # r_sink(log) # Uncomment the r_sink() commands to log output from stdout/stderr to a file - #r_sink(log, type = "message") # Load CTL - Should only be done once, since it is quite expensive r_library("ctl") r_options(stringsAsFactors=False) - logger.info("Initialization of CTL done, package loaded in R session") # Map the CTLscan function self.r_CTLscan = ro.r["CTLscan"] # Map the CTLsignificant function @@ -60,7 +53,6 @@ class CTL: self.r_plotCTLobject = ro.r["plot.CTLobject"] self.nodes_list = [] self.edges_list = [] - logger.info("Obtained pointers to CTL functions") self.gn2_url = GN2_BRANCH_URL @@ -85,21 +77,12 @@ class CTL: self.edges_list.append(edge_dict) def run_analysis(self, requestform): - logger.info("Starting CTL analysis on dataset") self.trait_db_list = [trait.strip() for trait in requestform['trait_list'].split(',')] self.trait_db_list = [x for x in self.trait_db_list if x] - - logger.debug("strategy:", requestform.get("strategy")) strategy = requestform.get("strategy") - - logger.debug("nperm:", requestform.get("nperm")) nperm = int(requestform.get("nperm")) - - logger.debug("parametric:", requestform.get("parametric")) parametric = bool(requestform.get("parametric")) - - logger.debug("significance:", requestform.get("significance")) significance = float(requestform.get("significance")) # Get the name of the .geno file belonging to the first phenotype @@ -109,7 +92,6 @@ class CTL: genofilelocation = locate(dataset.group.name + ".geno", "genotype") parser = genofile_parser.ConvertGenoFile(genofilelocation) parser.process_csv() - logger.debug("dataset group: ", dataset.group) # Create a genotype matrix individuals = parser.individuals markers = [] @@ -119,8 +101,6 @@ class CTL: markers.append(marker["genotypes"]) genotypes = list(itertools.chain(*markers)) - logger.debug(len(genotypes) / len(individuals), - "==", len(parser.markers)) rGeno = r_t(ro.r.matrix(r_unlist(genotypes), nrow=len(markernames), ncol=len( individuals), dimnames=r_list(markernames, individuals), byrow=True)) @@ -128,7 +108,6 @@ 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]) @@ -142,8 +121,6 @@ class CTL: 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)) - logger.debug(rPheno) - # Use a data frame to store the objects rPheno = r_data_frame(rPheno, check_names=False) rGeno = r_data_frame(rGeno, check_names=False) @@ -195,8 +172,6 @@ class CTL: # 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 @@ -231,7 +206,6 @@ class CTL: n = n + 1 def process_results(self, results): - logger.info("Processing CTL output") template_vars = {} template_vars["results"] = self.results template_vars["elements"] = self.elements diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py index 938c453e..f52c30e4 100644 --- a/wqflask/wqflask/db_info.py +++ b/wqflask/wqflask/db_info.py @@ -6,9 +6,6 @@ import re from flask import Flask, g -from utility.logger import getLogger -logger = getLogger(__name__) - class InfoPage: def __init__(self, start_vars): diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index b0756361..97143486 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -13,10 +13,6 @@ import sys from db import webqtlDatabaseFunction from utility.tools import GN2_BASE_URL -import logging -from utility.logger import getLogger -logger = getLogger(__name__) - class DoSearch: """Parent class containing parameters/functions used for all searches""" @@ -41,7 +37,6 @@ class DoSearch: def execute(self, query): """Executes query and returns results""" query = self.normalize_spaces(query) - logger.sql(query) results = g.db.execute(query, no_parameters=True).fetchall() return results @@ -55,7 +50,6 @@ class DoSearch: def mescape(self, *items): """Multiple escape""" escaped = [escape(str(item)) for item in items] - logger.debug("escaped is:", escaped) return tuple(escaped) def normalize_spaces(self, stringy): @@ -69,8 +63,6 @@ class DoSearch: if 'key' in search_type and search_type['key'] != None: search_type_string += '_' + search_type['key'] - logger.debug("search_type_string is:", search_type_string) - if search_type_string in cls.search_types: return cls.search_types[search_type_string] else: @@ -177,8 +169,6 @@ class MrnaAssaySearch(DoSearch): def run_combined(self, from_clause='', where_clause=''): """Generates and runs a combined search of an mRNA expression dataset""" - - logger.debug("Running ProbeSetSearch") #query = self.base_query + from_clause + " WHERE " + where_clause from_clause = self.normalize_spaces(from_clause) @@ -197,11 +187,8 @@ class MrnaAssaySearch(DoSearch): def run(self): """Generates and runs a simple search of an mRNA expression dataset""" - - logger.debug("Running ProbeSetSearch") where_clause = self.get_where_clause() query = self.base_query + "WHERE " + where_clause + "ORDER BY ProbeSet.symbol ASC" - return self.execute(query) @@ -310,9 +297,6 @@ class PhenotypeSearch(DoSearch): def run_combined(self, from_clause, where_clause): """Generates and runs a combined search of an phenotype dataset""" - - logger.debug("Running PhenotypeSearch") - from_clause = self.normalize_spaces(from_clause) query = (self.base_query + @@ -370,7 +354,6 @@ class GenotypeSearch(DoSearch): where_clause.append('''%s REGEXP "%s"''' % ("%s.%s" % self.mescape(self.dataset.type, field), self.search_term)) - logger.debug("hello ;where_clause is:", pf(where_clause)) where_clause = "(%s) " % ' OR '.join(where_clause) return where_clause @@ -559,7 +542,6 @@ class LrsSearch(DoSearch): self.species_id) else: # Deal with >, <, >=, and <= - logger.debug("self.search_term is:", self.search_term) lrs_val = self.search_term[0] if self.search_type == "LOD": lrs_val = lrs_val * 4.61 @@ -794,7 +776,6 @@ class MeanSearch(MrnaAssaySearch): def run(self): self.where_clause = self.get_where_clause() - logger.debug("where_clause is:", pf(self.where_clause)) self.query = self.compile_final_query(where_clause=self.where_clause) @@ -824,9 +805,6 @@ class RangeSearch(MrnaAssaySearch): FROM ProbeSetData WHERE ProbeSetData.Id = ProbeSetXRef.dataId) > %s """ % (escape(self.search_term[0])) - - logger.debug("where_clause is:", pf(where_clause)) - return where_clause def run(self): @@ -932,11 +910,7 @@ class PvalueSearch(MrnaAssaySearch): self.search_operator, self.search_term[0]) - logger.debug("where_clause is:", pf(self.where_clause)) - self.query = self.compile_final_query(where_clause=self.where_clause) - - logger.sql(self.query) return self.execute(self.query) diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 0a1a597d..9d58162e 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -2,9 +2,6 @@ import codecs from flask import g -from utility.logger import getLogger -logger = getLogger(__name__) - class Docs: diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 0c80e9a4..4b37c7f7 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -14,8 +14,6 @@ from gn3.computations.gemma import generate_hash_of_string from base.trait import create_trait, retrieve_trait_info -from utility.logger import getLogger -logger = getLogger(__name__) def export_traits(targs, export_type): if export_type == "collection": diff --git a/wqflask/wqflask/external_tools/send_to_bnw.py b/wqflask/wqflask/external_tools/send_to_bnw.py index c1b14ede..dfb59c63 100644 --- a/wqflask/wqflask/external_tools/send_to_bnw.py +++ b/wqflask/wqflask/external_tools/send_to_bnw.py @@ -21,9 +21,6 @@ from base.trait import GeneralTrait from utility import helper_functions, corr_result_helpers -import utility.logger -logger = utility.logger.getLogger(__name__) - class SendToBNW: def __init__(self, start_vars): diff --git a/wqflask/wqflask/external_tools/send_to_geneweaver.py b/wqflask/wqflask/external_tools/send_to_geneweaver.py index 9a4f7150..a8066b43 100644 --- a/wqflask/wqflask/external_tools/send_to_geneweaver.py +++ b/wqflask/wqflask/external_tools/send_to_geneweaver.py @@ -26,9 +26,6 @@ from base.trait import GeneralTrait, retrieve_trait_info from base.species import TheSpecies from utility import helper_functions, corr_result_helpers -import utility.logger -logger = utility.logger.getLogger(__name__) - class SendToGeneWeaver: def __init__(self, start_vars): diff --git a/wqflask/wqflask/external_tools/send_to_webgestalt.py b/wqflask/wqflask/external_tools/send_to_webgestalt.py index 6e74f4fe..4de684b0 100644 --- a/wqflask/wqflask/external_tools/send_to_webgestalt.py +++ b/wqflask/wqflask/external_tools/send_to_webgestalt.py @@ -26,9 +26,6 @@ from base.trait import GeneralTrait, retrieve_trait_info from base.species import TheSpecies from utility import helper_functions, corr_result_helpers -import utility.logger -logger = utility.logger.getLogger(__name__) - class SendToWebGestalt: def __init__(self, start_vars): diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 53a124d0..74964297 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -15,9 +15,6 @@ 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 -from utility.logger import getLogger -logger = getLogger(__name__) - class GSearch: @@ -65,7 +62,6 @@ class GSearch: LIMIT 6000 """ % (self.terms) with Bench("Running query"): - logger.sql(sql) re = g.db.execute(sql).fetchall() trait_list = [] @@ -210,7 +206,6 @@ class GSearch: ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id` LIMIT 6000 """.format(group_clause, search_term) - logger.sql(sql) re = g.db.execute(sql).fetchall() trait_list = [] with Bench("Creating trait objects"): diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py index 001bab3b..1c8a4ff6 100644 --- a/wqflask/wqflask/heatmap/heatmap.py +++ b/wqflask/wqflask/heatmap/heatmap.py @@ -8,12 +8,9 @@ from utility import helper_functions from utility.tools import flat_files, REAPER_COMMAND, TEMPDIR from redis import Redis from flask import Flask, g -from utility.logger import getLogger Redis = Redis() -logger = getLogger(__name__) - class Heatmap: diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 6a62b45c..278d8a6b 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -47,12 +47,11 @@ from wqflask.interval_analyst import GeneUtil from base.webqtlConfig import GENERATED_IMAGE_DIR from utility.pillow_utils import draw_rotated_text, draw_open_polygon -import utility.logger + try: # Only import this for Python3 from functools import reduce except: pass -logger = utility.logger.getLogger(__name__) RED = ImageColor.getrgb("red") BLUE = ImageColor.getrgb("blue") @@ -247,8 +246,6 @@ class DisplayMappingResults: HELP_PAGE_REF = '/glossary.html' def __init__(self, start_vars): - logger.info("Running qtlreaper") - self.temp_uuid = start_vars['temp_uuid'] self.dataset = start_vars['dataset'] diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 6b525733..646728ba 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -13,8 +13,6 @@ from utility.tools import TEMPDIR from utility.tools import WEBSERVER_MODE from gn3.computations.gemma import generate_hash_of_string -import utility.logger -logger = utility.logger.getLogger(__name__) GEMMAOPTS = "-debug" if WEBSERVER_MODE == 'PROD': diff --git a/wqflask/wqflask/marker_regression/plink_mapping.py b/wqflask/wqflask/marker_regression/plink_mapping.py index 2fa80841..75ee189e 100644 --- a/wqflask/wqflask/marker_regression/plink_mapping.py +++ b/wqflask/wqflask/marker_regression/plink_mapping.py @@ -5,9 +5,6 @@ from base.webqtlConfig import TMPDIR from utility import webqtlUtil from utility.tools import flat_files, PLINK_COMMAND -import utility.logger -logger = utility.logger.getLogger(__name__) - def run_plink(this_trait, dataset, species, vals, maf): plink_output_filename = webqtlUtil.genRandStr( @@ -15,13 +12,11 @@ def run_plink(this_trait, dataset, species, vals, maf): gen_pheno_txt_file(dataset, vals) plink_command = f"{PLINK_COMMAND} --noweb --bfile {flat_files('mapping')}/{dataset.group.name} --no-pheno --no-fid --no-parents --no-sex --maf {maf} --out { TMPDIR}{plink_output_filename} --assoc " - logger.debug("plink_command:", plink_command) os.system(plink_command) count, p_values = parse_plink_output(plink_output_filename, species) - logger.debug("p_values:", p_values) dataset.group.markers.add_pvalues(p_values) return dataset.group.markers.markers diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index c4b495d7..4d5db2ee 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -10,9 +10,6 @@ from base.trait import GeneralTrait from base.data_set import create_dataset from utility.tools import flat_files, REAPER_COMMAND, TEMPDIR -import utility.logger -logger = utility.logger.getLogger(__name__) - def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boot_check, num_bootstrap, do_control, control_marker, manhattan_plot, first_run=True, output_files=None): """Generates p-values for each marker using qtlreaper""" @@ -67,8 +64,6 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo opt_list), webqtlConfig.GENERATED_IMAGE_DIR, output_filename)) - - logger.debug("reaper_command:" + reaper_command) os.system(reaper_command) else: output_filename, permu_filename, bootstrap_filename = output_files diff --git a/wqflask/wqflask/marker_regression/rqtl_mapping.py b/wqflask/wqflask/marker_regression/rqtl_mapping.py index 3bf06ea6..7d112c68 100644 --- a/wqflask/wqflask/marker_regression/rqtl_mapping.py +++ b/wqflask/wqflask/marker_regression/rqtl_mapping.py @@ -17,9 +17,6 @@ from base.webqtlConfig import TMPDIR from base.trait import create_trait from utility.tools import locate, GN3_LOCAL_URL -import utility.logger -logger = utility.logger.getLogger(__name__) - def run_rqtl(trait_name, vals, samples, dataset, pair_scan, mapping_scale, model, method, num_perm, perm_strata_list, do_control, control_marker, manhattan_plot, cofactors): """Run R/qtl by making a request to the GN3 endpoint and reading in the output file(s)""" diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 35678df9..7a424b17 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -41,9 +41,6 @@ from utility.tools import locate, locate_ignore_error, GEMMA_COMMAND, PLINK_COMM from utility.external import shell from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR -import utility.logger -logger = utility.logger.getLogger(__name__) - class RunMapping: @@ -273,7 +270,6 @@ class RunMapping: self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] - logger.info("Running qtlreaper") self.first_run = True self.output_files = None @@ -303,8 +299,6 @@ class RunMapping: results = plink_mapping.run_plink( self.this_trait, self.dataset, self.species, self.vals, self.maf) #results = self.run_plink() - else: - logger.debug("RUNNING NOTHING") self.no_results = False if len(results) == 0: diff --git a/wqflask/wqflask/parser.py b/wqflask/wqflask/parser.py index 7a808ac9..ddf48d90 100644 --- a/wqflask/wqflask/parser.py +++ b/wqflask/wqflask/parser.py @@ -21,9 +21,6 @@ import re from pprint import pformat as pf -from utility.logger import getLogger -logger = getLogger(__name__) - def parse(pstring): """ @@ -45,7 +42,6 @@ def parse(pstring): for item in pstring: splat = re.split(separators, item) - logger.debug("splat is:", splat) # splat is an array of 1 if no match, otherwise more than 1 if len(splat) > 1: @@ -73,7 +69,6 @@ def parse(pstring): search_term=[item]) items.append(term) - logger.debug("* items are:", pf(items) + "\n") return(items) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 7134cc24..bf7e3c93 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -25,8 +25,6 @@ from utility.authentication_tools import check_resource_availability from utility.tools import GN2_BASE_URL from utility.type_checking import is_str -from utility.logger import getLogger -logger = getLogger(__name__) class SearchResultPage: #maxReturn = 3000 @@ -56,7 +54,6 @@ class SearchResultPage: rx = re.compile( r'.*\W(href|http|sql|select|update)\W.*', re.IGNORECASE) if rx.match(search): - logger.debug("Regex failed search") self.search_term_exists = False return else: diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py index 2e467dc8..6b1b4e97 100644 --- a/wqflask/wqflask/update_search_results.py +++ b/wqflask/wqflask/update_search_results.py @@ -7,9 +7,6 @@ from db import webqtlDatabaseFunction from utility.benchmark import Bench -from utility.logger import getLogger -logger = getLogger(__name__) - class GSearch: @@ -47,7 +44,6 @@ class GSearch: LIMIT 6000 """ % (self.terms) with Bench("Running query"): - logger.sql(sql) re = g.db.execute(sql).fetchall() self.trait_list = [] with Bench("Creating trait objects"): @@ -92,7 +88,6 @@ class GSearch: ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id` LIMIT 6000 """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms) - logger.sql(sql) re = g.db.execute(sql).fetchall() self.trait_list = [] with Bench("Creating trait objects"): diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py index 45a12f77..ae61edb0 100644 --- a/wqflask/wqflask/user_login.py +++ b/wqflask/wqflask/user_login.py @@ -2,7 +2,6 @@ import os import hashlib import datetime import time -import logging import uuid import hmac import base64 @@ -21,9 +20,6 @@ from utility import hmac from utility.redis_tools import is_redis_available, get_redis_conn, get_user_id, get_user_by_unique_column, set_user_attribute, save_user, save_verification_code, check_verification_code, get_user_collections, save_collections Redis = get_redis_conn() -from utility.logger import getLogger -logger = getLogger(__name__) - from smtplib import SMTP from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD, LOG_SQL_ALCHEMY, GN2_BRANCH_URL @@ -129,7 +125,6 @@ def send_email(toaddr, msg, fromaddr="no-reply@genenetwork.org"): server.login(SMTP_USERNAME, SMTP_PASSWORD) server.sendmail(fromaddr, toaddr, msg) server.quit() - logger.info("Successfully sent email to " + toaddr) def send_verification_email(user_details, template_name="email/user_verification.txt", key_prefix="verification_code", subject="GeneNetwork e-mail verification"): @@ -346,7 +341,6 @@ def get_github_user_details(access_token): @app.route("/n/logout") def logout(): - logger.debug("Logging out...") UserSession().delete_session() flash("You are now logged out. We hope you come back soon!") response = make_response(redirect(url_for('index_page'))) @@ -404,7 +398,6 @@ def forgot_password_submit(): email_address = params['email_address'] next_page = None if email_address != "": - logger.debug("Wants to send password E-mail to ", email_address) user_details = get_user_by_unique_column( "email_address", email_address) if user_details: @@ -425,8 +418,6 @@ def forgot_password_submit(): @app.route("/n/password_reset", methods=['GET']) def password_reset(): """Entry point after user clicks link in E-mail""" - logger.debug("in password_reset request.url is:", request.url) - verification_code = request.args.get('code') hmac = request.args.get('hm') @@ -446,8 +437,6 @@ def password_reset(): @app.route("/n/password_reset_step2", methods=('POST',)) def password_reset_step2(): """Handle confirmation E-mail for password reset""" - logger.debug("in password_reset request.url is:", request.url) - errors = [] user_email = request.form['user_encode'] user_id = get_user_id("email_address", user_email) @@ -515,7 +504,6 @@ def register(): params = params.to_dict(flat=True) if params: - logger.debug("Attempting to register the user...") errors = register_user(params) if len(errors) == 0: diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index 00b268a7..1ed5b802 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -13,8 +13,6 @@ from utility import hmac from utility.redis_tools import get_redis_conn, get_user_id, get_user_by_unique_column, set_user_attribute, get_user_collections, save_collections Redis = get_redis_conn() -from utility.logger import getLogger -logger = getLogger(__name__) THREE_DAYS = 60 * 60 * 24 * 3 THIRTY_DAYS = 60 * 60 * 24 * 30 @@ -54,7 +52,6 @@ def create_signed_cookie(): the_uuid = str(uuid.uuid4()) signature = hmac.hmac_creation(the_uuid) uuid_signed = the_uuid + ":" + signature - logger.debug("uuid_signed:", uuid_signed) return the_uuid, uuid_signed |