From b0ccb12682fed83bf72d22ff42f1f442a8e6176e Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 19 Apr 2021 14:43:16 +0300 Subject: Remove stale comments --- wqflask/base/data_set.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 178234fe..cc5a428c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -262,8 +262,6 @@ class Markers(object): elif isinstance(p_values, dict): filtered_markers = [] for marker in self.markers: - #logger.debug("marker[name]", marker['name']) - #logger.debug("p_values:", p_values) if marker['name'] in p_values: #logger.debug("marker {} IS in p_values".format(i)) marker['p_value'] = p_values[marker['name']] @@ -276,10 +274,6 @@ class Markers(object): marker['lrs_value'] = - \ math.log10(marker['p_value']) * 4.61 filtered_markers.append(marker) - # else: - #logger.debug("marker {} NOT in p_values".format(i)) - # self.markers.remove(marker) - #del self.markers[i] self.markers = filtered_markers @@ -306,7 +300,6 @@ class HumanMarkers(Markers): marker['Mb'] = float(splat[3]) / 1000000 self.markers.append(marker) - #logger.debug("markers is: ", pf(self.markers)) def add_pvalues(self, p_values): super(HumanMarkers, self).add_pvalues(p_values) @@ -520,7 +513,6 @@ def datasets(group_name, this_group=None): break if tissue_already_exists: - #logger.debug("dataset_menu:", dataset_menu[i]['datasets']) dataset_menu[i]['datasets'].append((dataset, dataset_short)) else: dataset_menu.append(dict(tissue=tissue_name, @@ -735,9 +727,6 @@ class PhenotypeDataSet(DataSet): DS_NAME_MAP['Publish'] = 'PhenotypeDataSet' def setup(self): - - #logger.debug("IS A PHENOTYPEDATASET") - # Fields in the database table self.search_fields = ['Phenotype.Post_publication_description', 'Phenotype.Pre_publication_description', -- cgit v1.2.3 From 10da4248b29b92e18c61323640acea59dd7244dc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 20:31:26 +0300 Subject: base: data_set: Rewrite data_set using @dataclass @dataclasses should be used to hold only data. Since dataset only encapsulates data, re-writing it using a dataclass makes it more readable and easier to follow. --- wqflask/base/data_set.py | 86 +++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 38 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index cc5a428c..e3a85ff6 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -17,7 +17,10 @@ # at rwilliams@uthsc.edu and xzhou15@uthsc.edu # # This module is used by GeneNetwork project (www.genenetwork.org) - +from dataclasses import dataclass +from dataclasses import field +from dataclasses import InitVar +from typing import Optional, Dict 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 @@ -74,11 +77,10 @@ def create_dataset(dataset_name, dataset_type=None, get_samplelist=True, group_n return dataset_class(dataset_name, get_samplelist) +@dataclass class DatasetType: - - def __init__(self, redis_instance): - """Create a dictionary of samples where the value is set to Geno, -Publish or ProbeSet. E.g. + """Create a dictionary of samples where the value is set to Geno, + Publish or ProbeSet. E.g. {'AD-cases-controls-MyersGeno': 'Geno', 'AD-cases-controls-MyersPublish': 'Publish', @@ -89,21 +91,28 @@ Publish or ProbeSet. E.g. 'All Phenotypes': 'Publish', 'B139_K_1206_M': 'ProbeSet', 'B139_K_1206_R': 'ProbeSet' ... - + } """ + redis_instance: InitVar[Redis] + datasets: Optional[Dict] = field(init=False, default_factory=dict) + data: Optional[Dict] = field(init=False) + + def __post_init__(self, redis_instance): self.redis_instance = redis_instance - self.datasets = {} - data = self.redis_instance.get("dataset_structure") + data = redis_instance.get("dataset_structure") if data: self.datasets = json.loads(data) - else: # ZS: I don't think this should ever run unless Redis is emptied + else: + # ZS: I don't think this should ever run unless Redis is + # emptied try: data = json.loads(requests.get( - GN2_BASE_URL + "/api/v_pre1/gen_dropdown", timeout=5).content) - for species in data['datasets']: - for group in data['datasets'][species]: - for dataset_type in data['datasets'][species][group]: - for dataset in data['datasets'][species][group][dataset_type]: + GN2_BASE_URL + "/api/v_pre1/gen_dropdown", + timeout=5).content) + for _species in data['datasets']: + for group in data['datasets'][_species]: + for dataset_type in data['datasets'][_species][group]: + for dataset in data['datasets'][_species][group][dataset_type]: short_dataset_name = dataset[1] if dataset_type == "Phenotypes": new_type = "Publish" @@ -112,15 +121,15 @@ Publish or ProbeSet. E.g. else: new_type = "ProbeSet" self.datasets[short_dataset_name] = new_type - except: + except Exception: # Do nothing pass - - self.redis_instance.set("dataset_structure", json.dumps(self.datasets)) + self.redis_instance.set("dataset_structure", + json.dumps(self.datasets)) + self.data = data def set_dataset_key(self, t, name): - """If name is not in the object's dataset dictionary, set it, and update - dataset_structure in Redis - + """If name is not in the object's dataset dictionary, set it, and + update dataset_structure in Redis args: t: Type of dataset structure which can be: 'mrna_expr', 'pheno', 'other_pheno', 'geno' @@ -128,19 +137,20 @@ Publish or ProbeSet. E.g. """ sql_query_mapping = { - 'mrna_expr': ("""SELECT ProbeSetFreeze.Id FROM """ + - """ProbeSetFreeze WHERE ProbeSetFreeze.Name = "{}" """), - 'pheno': ("""SELECT InfoFiles.GN_AccesionId """ + - """FROM InfoFiles, PublishFreeze, InbredSet """ + - """WHERE InbredSet.Name = '{}' AND """ + - """PublishFreeze.InbredSetId = InbredSet.Id AND """ + - """InfoFiles.InfoPageName = PublishFreeze.Name"""), - 'other_pheno': ("""SELECT PublishFreeze.Name """ + - """FROM PublishFreeze, InbredSet """ + - """WHERE InbredSet.Name = '{}' AND """ + - """PublishFreeze.InbredSetId = InbredSet.Id"""), - 'geno': ("""SELECT GenoFreeze.Id FROM GenoFreeze WHERE """ + - """GenoFreeze.Name = "{}" """) + 'mrna_expr': ("SELECT ProbeSetFreeze.Id FROM " + "ProbeSetFreeze WHERE " + "ProbeSetFreeze.Name = \"%s\" "), + 'pheno': ("SELECT InfoFiles.GN_AccesionId " + "FROM InfoFiles, PublishFreeze, InbredSet " + "WHERE InbredSet.Name = '%s' AND " + "PublishFreeze.InbredSetId = InbredSet.Id AND " + "InfoFiles.InfoPageName = PublishFreeze.Name"), + 'other_pheno': ("SELECT PublishFreeze.Name " + "FROM PublishFreeze, InbredSet " + "WHERE InbredSet.Name = '%s' AND " + "PublishFreeze.InbredSetId = InbredSet.Id"), + 'geno': ("SELECT GenoFreeze.Id FROM GenoFreeze WHERE " + "GenoFreeze.Name = \"%s\" ") } dataset_name_mapping = { @@ -154,22 +164,22 @@ Publish or ProbeSet. E.g. if t in ['pheno', 'other_pheno']: group_name = name.replace("Publish", "") - results = g.db.execute(sql_query_mapping[t].format(group_name)).fetchone() + results = g.db.execute(sql_query_mapping[t] % group_name).fetchone() if results: self.datasets[name] = dataset_name_mapping[t] self.redis_instance.set("dataset_structure", json.dumps(self.datasets)) return True - return None def __call__(self, name): - if name not in self.datasets: for t in ["mrna_expr", "pheno", "other_pheno", "geno"]: - # This has side-effects, with the end result being a truth-y value + # This has side-effects, with the end result being a + # truth-y value if(self.set_dataset_key(t, name)): break - return self.datasets.get(name, None) # Return None if name has not been set + # Return None if name has not been set + return self.datasets.get(name, None) # Do the intensive work at startup one time only -- cgit v1.2.3 From 61972109b36c752264b89ae98bcb40cc3657fa1d Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 20:52:11 +0300 Subject: base: data_set: Remove unused method * wqflask/base/data_set.py (riset): Delete class method. --- wqflask/base/data_set.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index e3a85ff6..5bd3e40c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -575,11 +575,6 @@ class DataSet(object): """Gets overridden later, at least for Temp...used by trait's get_given_name""" return None - # Delete this eventually - @property - def riset(): - Weve_Renamed_This_As_Group - def get_accession_id(self): if self.type == "Publish": results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where -- cgit v1.2.3 From c10f4670c103f8d3d65aaedb7f297b539b08c2f8 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 20:52:45 +0300 Subject: base: data_set: Apply pep-8 --- wqflask/base/data_set.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask/base') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 5bd3e40c..2ab3204d 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -62,7 +62,8 @@ logger = getLogger(__name__) DS_NAME_MAP = {} -def create_dataset(dataset_name, dataset_type=None, get_samplelist=True, group_name=None): +def create_dataset(dataset_name, dataset_type=None, + get_samplelist=True, group_name=None): if dataset_name == "Temp": dataset_type = "Temp" -- cgit v1.2.3 From dd0116f7cc3bed84777d625b6a22d716a3ba4fe2 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 20:53:56 +0300 Subject: base: data_set: Remove unused method * wqflask/base/data_set.py (Dataset.get_accession_id): Delete it. --- wqflask/base/data_set.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 2ab3204d..1ae138d2 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -572,10 +572,6 @@ class DataSet(object): self.group.get_samplelist() self.species = species.TheSpecies(self) - def get_desc(self): - """Gets overridden later, at least for Temp...used by trait's get_given_name""" - return None - def get_accession_id(self): if self.type == "Publish": results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where -- cgit v1.2.3 From 67703a57db19c9a1ebcc6991087479979cbbca18 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 21:33:11 +0300 Subject: base: trait: Remove unused function * wqflask/base/trait.py (jsonable_table_row): Delete it. --- wqflask/base/trait.py | 68 --------------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index df96d46e..a9223a32 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -341,74 +341,6 @@ def jsonable(trait): return dict() -def jsonable_table_row(trait, dataset_name, index): - """Return a list suitable for json and intended to be displayed in a table - - Actual turning into json doesn't happen here though""" - - dataset = create_dataset(dataset_name) - - if dataset.type == "ProbeSet": - if trait.mean == "": - mean = "N/A" - else: - mean = "%.3f" % round(float(trait.mean), 2) - if trait.additive == "": - additive = "N/A" - else: - additive = "%.3f" % round(float(trait.additive), 2) - return ['', - index, - ''+str(trait.name)+'', - trait.symbol, - trait.description_display, - trait.location_repr, - mean, - trait.LRS_score_repr, - trait.LRS_location_repr, - additive] - elif dataset.type == "Publish": - if trait.additive == "": - additive = "N/A" - else: - additive = "%.2f" % round(float(trait.additive), 2) - if trait.pubmed_id: - return ['', - index, - ''+str(trait.name)+'', - trait.description_display, - trait.authors, - '' + trait.pubmed_text + '', - trait.LRS_score_repr, - trait.LRS_location_repr, - additive] - else: - return ['', - index, - ''+str(trait.name)+'', - trait.description_display, - trait.authors, - trait.pubmed_text, - trait.LRS_score_repr, - trait.LRS_location_repr, - additive] - elif dataset.type == "Geno": - return ['', - index, - ''+str(trait.name)+'', - trait.location_repr] - else: - return dict() - - def retrieve_trait_info(trait, dataset, get_qtl_info=False): assert dataset, "Dataset doesn't exist" -- cgit v1.2.3 From 23e8e222e8016ea8335d4850070f884ab9b043fe Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 21:45:51 +0300 Subject: Run `sed -i 's/(object)//g'` See: https://is.gd/pL7IJF Ran: find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/(object)//g' --- webtests/browser_run.py | 2 +- wqflask/base/data_set.py | 6 +++--- wqflask/base/mrna_assay_tissue_data.py | 2 +- wqflask/base/species.py | 6 +++--- wqflask/base/trait.py | 2 +- wqflask/maintenance/convert_geno_to_bimbam.py | 4 ++-- .../maintenance/generate_kinship_from_bimbam.py | 2 +- wqflask/maintenance/geno_to_json.py | 4 ++-- wqflask/maintenance/print_benchmark.py | 2 +- wqflask/utility/__init__.py | 4 ++-- wqflask/utility/benchmark.py | 2 +- wqflask/utility/gen_geno_ob.py | 6 +++--- wqflask/utility/genofile_parser.py | 4 ++-- wqflask/utility/temp_data.py | 2 +- .../comparison_bar_chart/comparison_bar_chart.py | 2 +- wqflask/wqflask/correlation/corr_scatter_plot.py | 2 +- wqflask/wqflask/correlation/show_corr_results.py | 2 +- .../wqflask/correlation_matrix/show_corr_matrix.py | 2 +- wqflask/wqflask/ctl/ctl_analysis.py | 2 +- wqflask/wqflask/db_info.py | 2 +- wqflask/wqflask/do_search.py | 2 +- wqflask/wqflask/docs.py | 2 +- wqflask/wqflask/external_tools/send_to_bnw.py | 2 +- .../wqflask/external_tools/send_to_geneweaver.py | 2 +- .../wqflask/external_tools/send_to_webgestalt.py | 2 +- wqflask/wqflask/gsearch.py | 2 +- wqflask/wqflask/heatmap/heatmap.py | 2 +- .../marker_regression/display_mapping_results.py | 2 +- wqflask/wqflask/marker_regression/run_mapping.py | 2 +- wqflask/wqflask/network_graph/network_graph.py | 2 +- wqflask/wqflask/news.py | 2 +- wqflask/wqflask/search_results.py | 2 +- wqflask/wqflask/server_side.py | 2 +- wqflask/wqflask/show_trait/SampleList.py | 2 +- wqflask/wqflask/show_trait/show_trait.py | 6 +++--- wqflask/wqflask/snp_browser/snp_browser.py | 2 +- wqflask/wqflask/update_search_results.py | 2 +- wqflask/wqflask/user_manager.py | 22 +++++++++++----------- wqflask/wqflask/user_session.py | 2 +- wqflask/wqflask/wgcna/wgcna_analysis.py | 2 +- 40 files changed, 62 insertions(+), 62 deletions(-) (limited to 'wqflask/base') diff --git a/webtests/browser_run.py b/webtests/browser_run.py index 7ee540b7..6cf46de5 100644 --- a/webtests/browser_run.py +++ b/webtests/browser_run.py @@ -9,7 +9,7 @@ from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException from selenium.webdriver.common.keys import Keys -class Test(object): +class Test: def __init__(self): #self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') self.browser = webdriver.Firefox() diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 1ae138d2..3183363b 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -220,7 +220,7 @@ def create_datasets_list(): return datasets -class Markers(object): +class Markers: """Todo: Build in cacheing so it saves us reading the same file more than once""" def __init__(self, name): @@ -316,7 +316,7 @@ class HumanMarkers(Markers): super(HumanMarkers, self).add_pvalues(p_values) -class DatasetGroup(object): +class DatasetGroup: """ Each group has multiple datasets; each species has multiple groups. @@ -540,7 +540,7 @@ def datasets(group_name, this_group=None): return dataset_menu -class DataSet(object): +class DataSet: """ DataSet class defines a dataset in webqtl, can be either Microarray, Published phenotype, genotype, or user input dataset(temp) diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py index f1929518..1f8224af 100644 --- a/wqflask/base/mrna_assay_tissue_data.py +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -11,7 +11,7 @@ from utility.db_tools import escape from utility.logger import getLogger logger = getLogger(__name__ ) -class MrnaAssayTissueData(object): +class MrnaAssayTissueData: def __init__(self, gene_symbols=None): self.gene_symbols = gene_symbols diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 2771d116..eae3325a 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -6,7 +6,7 @@ from flask import Flask, g from utility.logger import getLogger logger = getLogger(__name__ ) -class TheSpecies(object): +class TheSpecies: def __init__(self, dataset=None, species_name=None): if species_name != None: self.name = species_name @@ -15,7 +15,7 @@ class TheSpecies(object): self.dataset = dataset self.chromosomes = Chromosomes(dataset=self.dataset) -class IndChromosome(object): +class IndChromosome: def __init__(self, name, length): self.name = name self.length = length @@ -25,7 +25,7 @@ class IndChromosome(object): """Chromosome length in megabases""" return self.length / 1000000 -class Chromosomes(object): +class Chromosomes: def __init__(self, dataset=None, species=None): self.chromosomes = collections.OrderedDict() if species != None: diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index a9223a32..968b6d4b 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -51,7 +51,7 @@ def create_trait(**kw): return None -class GeneralTrait(object): +class GeneralTrait: """ Trait class defines a trait in webqtl, can be either Microarray, Published phenotype, genotype, or user input trait diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py index d49742f2..0853b3ac 100644 --- a/wqflask/maintenance/convert_geno_to_bimbam.py +++ b/wqflask/maintenance/convert_geno_to_bimbam.py @@ -22,7 +22,7 @@ from pprint import pformat as pf class EmptyConfigurations(Exception): pass -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -30,7 +30,7 @@ class Marker(object): self.Mb = None self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file, output_files): self.input_file = input_file diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py index 60257b28..3e4d1741 100644 --- a/wqflask/maintenance/generate_kinship_from_bimbam.py +++ b/wqflask/maintenance/generate_kinship_from_bimbam.py @@ -13,7 +13,7 @@ sys.path.append("..") import os import glob -class GenerateKinshipMatrices(object): +class GenerateKinshipMatrices: def __init__(self, group_name, geno_file, pheno_file): self.group_name = group_name self.geno_file = geno_file diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py index 7e7fd241..f5f7e0e7 100644 --- a/wqflask/maintenance/geno_to_json.py +++ b/wqflask/maintenance/geno_to_json.py @@ -29,7 +29,7 @@ class EmptyConfigurations(Exception): pass -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -37,7 +37,7 @@ class Marker(object): self.Mb = None self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file, output_file): diff --git a/wqflask/maintenance/print_benchmark.py b/wqflask/maintenance/print_benchmark.py index b24ce4f1..a1046c86 100644 --- a/wqflask/maintenance/print_benchmark.py +++ b/wqflask/maintenance/print_benchmark.py @@ -5,7 +5,7 @@ import time from pprint import pformat as pf -class TheCounter(object): +class TheCounter: Counters = {} def __init__(self): diff --git a/wqflask/utility/__init__.py b/wqflask/utility/__init__.py index 204ff59a..df926884 100644 --- a/wqflask/utility/__init__.py +++ b/wqflask/utility/__init__.py @@ -2,7 +2,7 @@ from pprint import pformat as pf # Todo: Move these out of __init__ -class Bunch(object): +class Bunch: """Like a dictionary but using object notation""" def __init__(self, **kw): self.__dict__ = kw @@ -11,7 +11,7 @@ class Bunch(object): return pf(self.__dict__) -class Struct(object): +class Struct: '''The recursive class for building and representing objects with. From http://stackoverflow.com/a/6573827/1175849 diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py index ea5a0ab6..91ea91e8 100644 --- a/wqflask/utility/benchmark.py +++ b/wqflask/utility/benchmark.py @@ -6,7 +6,7 @@ from utility.tools import LOG_BENCH from utility.logger import getLogger logger = getLogger(__name__ ) -class Bench(object): +class Bench: entries = collections.OrderedDict() def __init__(self, name=None, write_output=LOG_BENCH): diff --git a/wqflask/utility/gen_geno_ob.py b/wqflask/utility/gen_geno_ob.py index 81085ffe..0a381c9b 100644 --- a/wqflask/utility/gen_geno_ob.py +++ b/wqflask/utility/gen_geno_ob.py @@ -1,7 +1,7 @@ import utility.logger logger = utility.logger.getLogger(__name__ ) -class genotype(object): +class genotype: """ Replacement for reaper.Dataset so we can remove qtlreaper use while still generating mapping output figure """ @@ -119,7 +119,7 @@ class genotype(object): self.chromosomes.append(chr_ob) -class Chr(object): +class Chr: def __init__(self, name, geno_ob): self.name = name self.loci = [] @@ -140,7 +140,7 @@ class Chr(object): def add_marker(self, marker_row): self.loci.append(Locus(self.geno_ob, marker_row)) -class Locus(object): +class Locus: def __init__(self, geno_ob, marker_row = None): self.chr = None self.name = None diff --git a/wqflask/utility/genofile_parser.py b/wqflask/utility/genofile_parser.py index 0b736176..f8e96d19 100644 --- a/wqflask/utility/genofile_parser.py +++ b/wqflask/utility/genofile_parser.py @@ -12,7 +12,7 @@ import simplejson as json from pprint import pformat as pf -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -21,7 +21,7 @@ class Marker(object): self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file): self.mb_exists = False diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py index 4144ae00..b2cbd458 100644 --- a/wqflask/utility/temp_data.py +++ b/wqflask/utility/temp_data.py @@ -2,7 +2,7 @@ from redis import Redis import simplejson as json -class TempData(object): +class TempData: def __init__(self, temp_uuid): self.temp_uuid = temp_uuid diff --git a/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py b/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py index 92de6073..5855ccf0 100644 --- a/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py +++ b/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py @@ -31,7 +31,7 @@ from MySQLdb import escape_string as escape from flask import Flask, g -class ComparisonBarChart(object): +class ComparisonBarChart: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index c87776bb..d5dc26f5 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -11,7 +11,7 @@ import numpy as np import utility.logger logger = utility.logger.getLogger(__name__ ) -class CorrScatterPlot(object): +class CorrScatterPlot: """Page that displays a correlation scatterplot with a line fitted to it""" def __init__(self, params): diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index fb4dc4f4..cb341e79 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -58,7 +58,7 @@ TISSUE_METHODS = [METHOD_TISSUE_PEARSON, METHOD_TISSUE_RANK] TISSUE_MOUSE_DB = 1 -class CorrelationResults(object): +class CorrelationResults: def __init__(self, start_vars): # get trait list from db (database name) # calculate correlation with Base vector and targets diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index f77761d8..d0b4a156 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -41,7 +41,7 @@ Redis = get_redis_conn() THIRTY_DAYS = 60 * 60 * 24 * 30 -class CorrelationMatrix(object): +class CorrelationMatrix: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index 72b4f3a3..1556e370 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -39,7 +39,7 @@ r_write_table = ro.r["write.table"] # Map the write.table function r_data_frame = ro.r["data.frame"] # Map the write.table function r_as_numeric = ro.r["as.numeric"] # Map the write.table function -class CTL(object): +class CTL: def __init__(self): logger.info("Initialization of CTL") #log = r_file("/tmp/genenetwork_ctl.log", open = "wt") diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py index f420b472..25e624ef 100644 --- a/wqflask/wqflask/db_info.py +++ b/wqflask/wqflask/db_info.py @@ -10,7 +10,7 @@ from utility.logger import getLogger logger = getLogger(__name__) -class InfoPage(object): +class InfoPage: def __init__(self, start_vars): self.info = None self.gn_accession_id = None diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 00636563..364a3eed 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -17,7 +17,7 @@ from utility.logger import getLogger logger = getLogger(__name__) -class DoSearch(object): +class DoSearch: """Parent class containing parameters/functions used for all searches""" # Used to translate search phrases into classes diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 23fc3cad..207767c4 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -5,7 +5,7 @@ from flask import g from utility.logger import getLogger logger = getLogger(__name__) -class Docs(object): +class Docs: def __init__(self, entry, start_vars={}): sql = """ diff --git a/wqflask/wqflask/external_tools/send_to_bnw.py b/wqflask/wqflask/external_tools/send_to_bnw.py index efa17f05..c5c79e98 100644 --- a/wqflask/wqflask/external_tools/send_to_bnw.py +++ b/wqflask/wqflask/external_tools/send_to_bnw.py @@ -24,7 +24,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToBNW(object): +class SendToBNW: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/external_tools/send_to_geneweaver.py b/wqflask/wqflask/external_tools/send_to_geneweaver.py index 4c958a88..47e4c53a 100644 --- a/wqflask/wqflask/external_tools/send_to_geneweaver.py +++ b/wqflask/wqflask/external_tools/send_to_geneweaver.py @@ -29,7 +29,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToGeneWeaver(object): +class SendToGeneWeaver: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/external_tools/send_to_webgestalt.py b/wqflask/wqflask/external_tools/send_to_webgestalt.py index 2f068792..e1e5e655 100644 --- a/wqflask/wqflask/external_tools/send_to_webgestalt.py +++ b/wqflask/wqflask/external_tools/send_to_webgestalt.py @@ -29,7 +29,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToWebGestalt(object): +class SendToWebGestalt: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 907f1180..9bf23d57 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -18,7 +18,7 @@ from utility.type_checking import is_float, is_int, is_str, get_float, get_int, from utility.logger import getLogger logger = getLogger(__name__) -class GSearch(object): +class GSearch: def __init__(self, kw): assert('type' in kw) diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py index cca5a4fc..20e3559a 100644 --- a/wqflask/wqflask/heatmap/heatmap.py +++ b/wqflask/wqflask/heatmap/heatmap.py @@ -14,7 +14,7 @@ Redis = Redis() logger = getLogger(__name__ ) -class Heatmap(object): +class Heatmap: def __init__(self, start_vars, temp_uuid): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 6a5fe2f6..4074f098 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -152,7 +152,7 @@ class HtmlGenWrapper: return map_ -class DisplayMappingResults(object): +class DisplayMappingResults: """Inteval Mapping Plot Page""" cMGraphInterval = 5 GRAPH_MIN_WIDTH = 900 diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 8f051c14..7dd0bcb6 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -45,7 +45,7 @@ from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR import utility.logger logger = utility.logger.getLogger(__name__ ) -class RunMapping(object): +class RunMapping: def __init__(self, start_vars, temp_uuid): helper_functions.get_species_dataset_trait(self, start_vars) diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index 1d5316a2..f5ee5303 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -28,7 +28,7 @@ from utility import corr_result_helpers from utility.tools import GN2_BRANCH_URL -class NetworkGraph(object): +class NetworkGraph: def __init__(self, start_vars): trait_db_list = [trait.strip() diff --git a/wqflask/wqflask/news.py b/wqflask/wqflask/news.py index 0675ec4b..861a93f2 100644 --- a/wqflask/wqflask/news.py +++ b/wqflask/wqflask/news.py @@ -1,6 +1,6 @@ from flask import g -class News(object): +class News: def __init__(self): sql = """ diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index f23c0582..36500a8d 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -24,7 +24,7 @@ from utility.type_checking import is_str from utility.logger import getLogger logger = getLogger(__name__ ) -class SearchResultPage(object): +class SearchResultPage: #maxReturn = 3000 def __init__(self, kw): diff --git a/wqflask/wqflask/server_side.py b/wqflask/wqflask/server_side.py index 5f764767..48761fa0 100644 --- a/wqflask/wqflask/server_side.py +++ b/wqflask/wqflask/server_side.py @@ -2,7 +2,7 @@ -class ServerSideTable(object): +class ServerSideTable: """ This class is used to do server-side processing on the DataTables table such as paginating, sorting, diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 857e4456..f955f632 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -8,7 +8,7 @@ from pprint import pformat as pf from utility import Plot from utility import Bunch -class SampleList(object): +class SampleList: def __init__(self, dataset, sample_names, diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index e5e94c7e..f9c5fbe6 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -35,8 +35,7 @@ logger = getLogger(__name__) ############################################## -class ShowTrait(object): - +class ShowTrait: def __init__(self, kw): if 'trait_id' in kw and kw['dataset'] != "Temp": self.temp_trait = False @@ -54,7 +53,8 @@ class ShowTrait(object): self.dataset = data_set.create_dataset( dataset_name="Temp", dataset_type="Temp", group_name=self.temp_group) - # Put values in Redis so they can be looked up later if added to a collection + # Put values in Redis so they can be looked up later if + # added to a collection Redis.set(self.trait_id, kw['trait_paste'], ex=ONE_YEAR) self.trait_vals = kw['trait_paste'].split() self.this_trait = create_trait(dataset=self.dataset, diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index a52399a2..8658abf8 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -9,7 +9,7 @@ logger = getLogger(__name__) from base import species from base import webqtlConfig -class SnpBrowser(object): +class SnpBrowser: def __init__(self, start_vars): self.strain_lists = get_browser_sample_lists() diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py index 672f95b1..22a46ef2 100644 --- a/wqflask/wqflask/update_search_results.py +++ b/wqflask/wqflask/update_search_results.py @@ -10,7 +10,7 @@ from utility.benchmark import Bench from utility.logger import getLogger logger = getLogger(__name__) -class GSearch(object): +class GSearch: def __init__(self, kw): self.type = kw['type'] diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py index 7b25b68e..fcec3b67 100644 --- a/wqflask/wqflask/user_manager.py +++ b/wqflask/wqflask/user_manager.py @@ -58,7 +58,7 @@ def timestamp(): return datetime.datetime.utcnow().isoformat() -class AnonUser(object): +class AnonUser: """Anonymous user handling""" cookie_name = 'anon_user_v1' @@ -158,7 +158,7 @@ def create_signed_cookie(): logger.debug("uuid_signed:", uuid_signed) return the_uuid, uuid_signed -class UserSession(object): +class UserSession: """Logged in user handling""" cookie_name = 'session_id_v1' @@ -353,12 +353,12 @@ def set_cookie(response): response.set_cookie(g.cookie_session.cookie_name, g.cookie_session.cookie) return response -class UsersManager(object): +class UsersManager: def __init__(self): self.users = model.User.query.all() logger.debug("Users are:", self.users) -class UserManager(object): +class UserManager: def __init__(self, kw): self.user_id = kw['user_id'] logger.debug("In UserManager locals are:", pf(locals())) @@ -377,7 +377,7 @@ class UserManager(object): #logger.debug(" ---> self.datasets:", self.datasets) -class RegisterUser(object): +class RegisterUser: def __init__(self, kw): self.thank_you_mode = False self.errors = [] @@ -454,7 +454,7 @@ def set_password(password, user): ) -class VerificationEmail(object): +class VerificationEmail: template_name = "email/verification.txt" key_prefix = "verification_code" subject = "GeneNetwork email verification" @@ -511,7 +511,7 @@ class ForgotPasswordEmail(VerificationEmail): send_email(toaddr, msg.as_string()) -class Password(object): +class Password: def __init__(self, unencrypted_password, salt, iterations, keylength, hashfunc): hashfunc = getattr(hashlib, hashfunc) logger.debug("hashfunc is:", hashfunc) @@ -589,7 +589,7 @@ def password_reset_step2(): return response -class DecodeUser(object): +class DecodeUser: def __init__(self, code_prefix): verify_url_hmac(request.url) @@ -695,7 +695,7 @@ def get_github_user_details(access_token): result = requests.get(GITHUB_API_URL, params={"access_token":access_token}) return result.json() -class LoginUser(object): +class LoginUser: remember_time = 60 * 60 * 24 * 30 # One month in seconds def __init__(self): @@ -1039,12 +1039,12 @@ def send_email(toaddr, msg, fromaddr="no-reply@genenetwork.org"): server.quit() logger.info("Successfully sent email to "+toaddr) -class GroupsManager(object): +class GroupsManager: def __init__(self, kw): self.datasets = create_datasets_list() -class RolesManager(object): +class RolesManager: def __init__(self): self.roles = model.Role.query.all() logger.debug("Roles are:", self.roles) diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index c5a577df..cc0ac744 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -63,7 +63,7 @@ def manage_user(): return render_template("admin/manage_user.html", user_details = user_details) -class UserSession(object): +class UserSession: """Logged in user handling""" user_cookie_name = 'session_id_v2' diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py index 6bf75216..21516b30 100644 --- a/wqflask/wqflask/wgcna/wgcna_analysis.py +++ b/wqflask/wqflask/wgcna/wgcna_analysis.py @@ -42,7 +42,7 @@ r_png = ro.r["png"] # Map the png function for plotting r_dev_off = ro.r["dev.off"] # Map the dev.off function -class WGCNA(object): +class WGCNA: def __init__(self): # To log output from stdout/stderr to a file add `r_sink(log)` print("Initialization of WGCNA") -- cgit v1.2.3