diff options
author | BonfaceKilz | 2021-04-30 13:01:02 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-04-30 13:45:15 +0300 |
commit | 90ec57905c8afdbd5e9e8c44dcc369bd0e9c2d1b (patch) | |
tree | cc6ce096e5e96e4794fb49d041fda67ed6229c0e /wqflask | |
parent | bd702e59d7a426fe351d34367bf824683c655696 (diff) | |
download | genenetwork2-90ec57905c8afdbd5e9e8c44dcc369bd0e9c2d1b.tar.gz |
autopep8: Fix W504
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/GeneralObject.py | 4 | ||||
-rw-r--r-- | wqflask/base/data_set.py | 4 | ||||
-rw-r--r-- | wqflask/base/trait.py | 10 | ||||
-rw-r--r-- | wqflask/maintenance/generate_probesetfreeze_file.py | 7 | ||||
-rw-r--r-- | wqflask/tests/unit/base/test_data_set.py | 10 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/api/test_gen_menu.py | 68 | ||||
-rw-r--r-- | wqflask/utility/svg.py | 24 | ||||
-rw-r--r-- | wqflask/wqflask/api/gen_menu.py | 10 | ||||
-rw-r--r-- | wqflask/wqflask/correlation/show_corr_results.py | 10 | ||||
-rw-r--r-- | wqflask/wqflask/db_info.py | 34 | ||||
-rw-r--r-- | wqflask/wqflask/do_search.py | 12 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/qtlreaper_mapping.py | 14 | ||||
-rw-r--r-- | wqflask/wqflask/show_trait/SampleList.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/user_session.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 12 |
16 files changed, 116 insertions, 115 deletions
diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py index 249195e2..ce8e60b8 100644 --- a/wqflask/base/GeneralObject.py +++ b/wqflask/base/GeneralObject.py @@ -62,5 +62,5 @@ class GeneralObject: return s def __eq__(self, other): - return (len(list(self.__dict__.keys())) == - len(list(other.__dict__.keys()))) + return (len(list(self.__dict__.keys())) + == len(list(other.__dict__.keys()))) diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 8ec0aaad..5eac695e 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -1032,8 +1032,8 @@ class MrnaAssayDataSet(DataSet): else: description_display = this_trait.symbol - if (len(description_display) > 1 and description_display != 'N/A' and - len(target_string) > 1 and target_string != 'None'): + if (len(description_display) > 1 and description_display != 'N/A' + and len(target_string) > 1 and target_string != 'None'): description_display = description_display + '; ' + target_string.strip() # Save it for the jinja2 template diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 5574128d..d09cfd40 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -479,9 +479,9 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False): else: description_display = trait.symbol - if (str(description_display or "") != "" and - description_display != 'N/A' and - str(target_string or "") != "" and target_string != 'None'): + if (str(description_display or "") != "" + and description_display != 'N/A' + and str(target_string or "") != "" and target_string != 'None'): description_display = description_display + '; ' + target_string.strip() # Save it for the jinja2 template @@ -575,6 +575,6 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False): if str(trait.lrs or "") != "": trait.LRS_score_repr = LRS_score_repr = '%3.1f' % trait.lrs else: - raise KeyError(repr(trait.name) + - ' information is not found in the database.') + raise KeyError(repr(trait.name) + + ' information is not found in the database.') return trait diff --git a/wqflask/maintenance/generate_probesetfreeze_file.py b/wqflask/maintenance/generate_probesetfreeze_file.py index bd9c2ab4..e964c8ed 100644 --- a/wqflask/maintenance/generate_probesetfreeze_file.py +++ b/wqflask/maintenance/generate_probesetfreeze_file.py @@ -110,9 +110,10 @@ def write_data_matrix_file(strains, probeset_vals, filename): def main(): - filename = os.path.expanduser("~/gene/wqflask/maintenance/" + - "ProbeSetFreezeId_210_FullName_Eye_AXBXA_Illumina_V6.2" + - "(Oct08)_RankInv_Beta.txt") + filename = os.path.expanduser( + "~/gene/wqflask/maintenance/" + "ProbeSetFreezeId_210_FullName_Eye_AXBXA_Illumina_V6.2" + "(Oct08)_RankInv_Beta.txt") dataset_name = "Eye_AXBXA_1008_RankInv" cursor = get_cursor() diff --git a/wqflask/tests/unit/base/test_data_set.py b/wqflask/tests/unit/base/test_data_set.py index ee5d6f06..66ad361d 100644 --- a/wqflask/tests/unit/base/test_data_set.py +++ b/wqflask/tests/unit/base/test_data_set.py @@ -88,8 +88,8 @@ class TestDataSetTypes(unittest.TestCase): '"B139_K_1206_R": "ProbeSet", ' '"Test": "ProbeSet"}')) db_mock.db.execute.assert_called_once_with( - ("SELECT ProbeSetFreeze.Id FROM ProbeSetFreeze " + - "WHERE ProbeSetFreeze.Name = \"Test\" ") + ("SELECT ProbeSetFreeze.Id FROM ProbeSetFreeze " + + "WHERE ProbeSetFreeze.Name = \"Test\" ") ) @mock.patch('base.data_set.g') @@ -145,9 +145,9 @@ class TestDataSetTypes(unittest.TestCase): '"Test": "Publish"}')) db_mock.db.execute.assert_called_with( - ("SELECT PublishFreeze.Name " + - "FROM PublishFreeze, InbredSet " + - "WHERE InbredSet.Name = 'Test' AND " + ("SELECT PublishFreeze.Name " + + "FROM PublishFreeze, InbredSet " + + "WHERE InbredSet.Name = 'Test' AND " "PublishFreeze.InbredSetId = InbredSet.Id") ) diff --git a/wqflask/tests/unit/wqflask/api/test_gen_menu.py b/wqflask/tests/unit/wqflask/api/test_gen_menu.py index 57eb1650..fd0fe52e 100644 --- a/wqflask/tests/unit/wqflask/api/test_gen_menu.py +++ b/wqflask/tests/unit/wqflask/api/test_gen_menu.py @@ -105,13 +105,13 @@ class TestGenMenu(unittest.TestCase): for name in ["mouse", "human"]: db_mock.db.execute.assert_any_call( ("SELECT InbredSet.Name, InbredSet.FullName, " + - "IFNULL(InbredSet.Family, 'None') " + - "FROM InbredSet, Species WHERE Species.Name " + - "= '{}' AND InbredSet.SpeciesId = Species.Id GROUP by " + - "InbredSet.Name ORDER BY IFNULL(InbredSet.FamilyOrder, " + - "InbredSet.FullName) ASC, IFNULL(InbredSet.Family, " + - "InbredSet.FullName) ASC, InbredSet.FullName ASC, " + - "InbredSet.MenuOrderId ASC").format(name) + "IFNULL(InbredSet.Family, 'None') " + + "FROM InbredSet, Species WHERE Species.Name " + + "= '{}' AND InbredSet.SpeciesId = Species.Id GROUP by " + + "InbredSet.Name ORDER BY IFNULL(InbredSet.FamilyOrder, " + + "InbredSet.FullName) ASC, IFNULL(InbredSet.Family, " + + "InbredSet.FullName) ASC, InbredSet.FullName ASC, " + + "InbredSet.MenuOrderId ASC").format(name) ) @mock.patch('wqflask.api.gen_menu.g') @@ -172,12 +172,12 @@ class TestGenMenu(unittest.TestCase): self.assertEqual(build_datasets("Mouse", "BXD", "Phenotypes"), [['602', "BXDPublish", "BXD Published Phenotypes"]]) db_mock.db.execute.assert_called_with( - "SELECT InfoFiles.GN_AccesionId, PublishFreeze.Name, " + - "PublishFreeze.FullName FROM InfoFiles, PublishFreeze, " + - "InbredSet WHERE InbredSet.Name = 'BXD' AND " + - "PublishFreeze.InbredSetId = InbredSet.Id AND " + - "InfoFiles.InfoPageName = PublishFreeze.Name " + - "ORDER BY PublishFreeze.CreateTime ASC" + "SELECT InfoFiles.GN_AccesionId, PublishFreeze.Name, " + + "PublishFreeze.FullName FROM InfoFiles, PublishFreeze, " + + "InbredSet WHERE InbredSet.Name = 'BXD' AND " + + "PublishFreeze.InbredSetId = InbredSet.Id AND " + + "InfoFiles.InfoPageName = PublishFreeze.Name " + + "ORDER BY PublishFreeze.CreateTime ASC" ) self.assertEqual(build_datasets("Mouse", "MDP", "Phenotypes"), [['602', "BXDPublish", "Mouse Phenome Database"]]) @@ -221,8 +221,8 @@ class TestGenMenu(unittest.TestCase): "SELECT InfoFiles.GN_AccesionId FROM InfoFiles, " "GenoFreeze, InbredSet WHERE InbredSet.Name = 'HLC' AND " "GenoFreeze.InbredSetId = InbredSet.Id AND " - "InfoFiles.InfoPageName = GenoFreeze.ShortName " + - "ORDER BY GenoFreeze.CreateTime DESC" + "InfoFiles.InfoPageName = GenoFreeze.ShortName " + + "ORDER BY GenoFreeze.CreateTime DESC" ) db_mock.db.execute.return_value.fetchone.return_value = () self.assertEqual(build_datasets("Mouse", "HLC", "Genotypes"), @@ -239,16 +239,16 @@ class TestGenMenu(unittest.TestCase): "112", 'HC_M2_0606_P', "Hippocampus Consortium M430v2 (Jun06) PDNN" ]]) db_mock.db.execute.assert_called_once_with( - "SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, " + - "ProbeSetFreeze.FullName FROM ProbeSetFreeze, " + - "ProbeFreeze, InbredSet, Tissue, Species WHERE " + - "Species.Name = 'Mouse' AND Species.Id = " + - "InbredSet.SpeciesId AND InbredSet.Name = 'HLC' AND " + - "ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id AND " + - "Tissue.Name = 'mRNA' AND ProbeFreeze.TissueId = " + - "Tissue.Id AND ProbeFreeze.InbredSetId = InbredSet.Id AND " + - "ProbeSetFreeze.public > 0 " + - "ORDER BY -ProbeSetFreeze.OrderList DESC, ProbeSetFreeze.CreateTime DESC") + "SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, " + + "ProbeSetFreeze.FullName FROM ProbeSetFreeze, " + + "ProbeFreeze, InbredSet, Tissue, Species WHERE " + + "Species.Name = 'Mouse' AND Species.Id = " + + "InbredSet.SpeciesId AND InbredSet.Name = 'HLC' AND " + + "ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id AND " + + "Tissue.Name = 'mRNA' AND ProbeFreeze.TissueId = " + + "Tissue.Id AND ProbeFreeze.InbredSetId = InbredSet.Id AND " + + "ProbeSetFreeze.public > 0 " + + "ORDER BY -ProbeSetFreeze.OrderList DESC, ProbeSetFreeze.CreateTime DESC") @mock.patch('wqflask.api.gen_menu.build_datasets') @mock.patch('wqflask.api.gen_menu.g') @@ -266,15 +266,15 @@ class TestGenMenu(unittest.TestCase): ['H', 'H', 'Molecular Traits'], ['R', 'R', 'Molecular Traits']]) db_mock.db.execute.assert_called_once_with( - "SELECT DISTINCT Tissue.Name " + - "FROM ProbeFreeze, ProbeSetFreeze, InbredSet, " + - "Tissue, Species WHERE Species.Name = 'mouse' " + - "AND Species.Id = InbredSet.SpeciesId AND " + - "InbredSet.Name = 'random group' AND " + - "ProbeFreeze.TissueId = Tissue.Id AND " + - "ProbeFreeze.InbredSetId = InbredSet.Id AND " + - "ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id " + - "ORDER BY Tissue.Name" + "SELECT DISTINCT Tissue.Name " + + "FROM ProbeFreeze, ProbeSetFreeze, InbredSet, " + + "Tissue, Species WHERE Species.Name = 'mouse' " + + "AND Species.Id = InbredSet.SpeciesId AND " + + "InbredSet.Name = 'random group' AND " + + "ProbeFreeze.TissueId = Tissue.Id AND " + + "ProbeFreeze.InbredSetId = InbredSet.Id AND " + + "ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id " + + "ORDER BY Tissue.Name" ) @mock.patch('wqflask.api.gen_menu.build_types') diff --git a/wqflask/utility/svg.py b/wqflask/utility/svg.py index 8d2e13ab..bc3bc833 100644 --- a/wqflask/utility/svg.py +++ b/wqflask/utility/svg.py @@ -229,13 +229,13 @@ class pathdata: def bezier(self, x1, y1, x2, y2, x, y): """bezier with xy1 and xy2 to xy absolut""" - self.path.append('C' + str(x1) + ','+str(y1)+' '+str(x2) + - ',' + str(y2) + ' '+str(x)+','+str(y)) + self.path.append('C' + str(x1) + ','+str(y1)+' '+str(x2) + + ',' + str(y2) + ' '+str(x)+','+str(y)) def relbezier(self, x1, y1, x2, y2, x, y): """bezier with xy1 and xy2 to xy relative""" - self.path.append('c' + str(x1) + ','+str(y1)+' '+str(x2) + - ',' + str(y2) + ' '+str(x)+','+str(y)) + self.path.append('c' + str(x1) + ','+str(y1)+' '+str(x2) + + ',' + str(y2) + ' '+str(x)+','+str(y)) def smbezier(self, x2, y2, x, y): """smooth bezier with xy2 to xy absolut""" @@ -267,13 +267,13 @@ class pathdata: def ellarc(self, rx, ry, xrot, laf, sf, x, y): """elliptival arc with rx and ry rotating with xrot using large-arc-flag and sweep-flag to xy absolut""" - self.path.append('A' + str(rx) + ','+str(ry)+' '+str(xrot) + - ' ' + str(laf) + ' '+str(sf)+' '+str(x)+' '+str(y)) + self.path.append('A' + str(rx) + ','+str(ry)+' '+str(xrot) + + ' ' + str(laf) + ' '+str(sf)+' '+str(x)+' '+str(y)) def relellarc(self, rx, ry, xrot, laf, sf, x, y): """elliptival arc with rx and ry rotating with xrot using large-arc-flag and sweep-flag to xy relative""" - self.path.append('a' + str(rx) + ','+str(ry)+' '+str(xrot) + - ' ' + str(laf) + ' '+str(sf)+' '+str(x)+' '+str(y)) + self.path.append('a' + str(rx) + ','+str(ry)+' '+str(xrot) + + ' ' + str(laf) + ' '+str(sf)+' '+str(x)+' '+str(y)) def __repr__(self): return ' '.join(self.path) @@ -319,11 +319,11 @@ class SVGelement: f.write('\t' * level) f.write('<' + self.type) for attkey in list(self.attributes.keys()): - f.write(' ' + _escape(str(attkey)) + '=' + - _quoteattr(str(self.attributes[attkey]))) + f.write(' ' + _escape(str(attkey)) + '=' + + _quoteattr(str(self.attributes[attkey]))) if self.namespace: - f.write(' xmlns="' + _escape(str(self.namespace)) + - '" xmlns:xlink="http://www.w3.org/1999/xlink"') + f.write(' xmlns="' + _escape(str(self.namespace)) + + '" xmlns:xlink="http://www.w3.org/1999/xlink"') if self.elements or self.text or self.cdata: f.write('>') if self.elements: diff --git a/wqflask/wqflask/api/gen_menu.py b/wqflask/wqflask/api/gen_menu.py index a64524dd..e65b36e4 100644 --- a/wqflask/wqflask/api/gen_menu.py +++ b/wqflask/wqflask/api/gen_menu.py @@ -179,11 +179,11 @@ def build_datasets(species, group, type_name): elif type_name == "Genotypes": results = g.db.execute( ("SELECT InfoFiles.GN_AccesionId " + - "FROM InfoFiles, GenoFreeze, InbredSet " + - "WHERE InbredSet.Name = '{}' AND " + - "GenoFreeze.InbredSetId = InbredSet.Id AND " + - "InfoFiles.InfoPageName = GenoFreeze.ShortName " + - "ORDER BY GenoFreeze.CreateTime DESC").format(group)).fetchone() + "FROM InfoFiles, GenoFreeze, InbredSet " + + "WHERE InbredSet.Name = '{}' AND " + + "GenoFreeze.InbredSetId = InbredSet.Id AND " + + "InfoFiles.InfoPageName = GenoFreeze.ShortName " + + "ORDER BY GenoFreeze.CreateTime DESC").format(group)).fetchone() dataset_id = "None" if bool(results): diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 8ee24246..e8b7b057 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -96,9 +96,9 @@ class CorrelationResults: self.p_range_lower = get_float(start_vars, 'p_range_lower', -1.0) self.p_range_upper = get_float(start_vars, 'p_range_upper', 1.0) - if ('loc_chr' in start_vars and - 'min_loc_mb' in start_vars and - 'max_loc_mb' in start_vars): + if ('loc_chr' in start_vars + and 'min_loc_mb' in start_vars + and 'max_loc_mb' in start_vars): self.location_type = get_string(start_vars, 'location_type') self.location_chr = get_string(start_vars, 'loc_chr') @@ -200,8 +200,8 @@ class CorrelationResults: if chr_info.name == trait_object.chr: chr_as_int = order_id - if (float(self.correlation_data[trait][0]) >= self.p_range_lower and - float(self.correlation_data[trait][0]) <= self.p_range_upper): + if (float(self.correlation_data[trait][0]) >= self.p_range_lower + and float(self.correlation_data[trait][0]) <= self.p_range_upper): if (self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Publish") and bool(trait_object.mean): if (self.min_expr != None) and (float(trait_object.mean) < self.min_expr): diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py index 8d28fef0..938c453e 100644 --- a/wqflask/wqflask/db_info.py +++ b/wqflask/wqflask/db_info.py @@ -23,23 +23,23 @@ class InfoPage: def get_info(self, create=False): query_base = ("SELECT InfoPageName, GN_AccesionId, Species.MenuName, Species.TaxonomyId, Tissue.Name, InbredSet.Name, " + - "GeneChip.GeneChipName, GeneChip.GeoPlatform, AvgMethod.Name, Datasets.DatasetName, Datasets.GeoSeries, " + - "Datasets.PublicationTitle, DatasetStatus.DatasetStatusName, Datasets.Summary, Datasets.AboutCases, " + - "Datasets.AboutTissue, Datasets.AboutDataProcessing, Datasets.Acknowledgment, Datasets.ExperimentDesign, " + - "Datasets.Contributors, Datasets.Citation, Datasets.Notes, Investigators.FirstName, Investigators.LastName, " + - "Investigators.Address, Investigators.City, Investigators.State, Investigators.ZipCode, Investigators.Country, " + - "Investigators.Phone, Investigators.Email, Investigators.Url, Organizations.OrganizationName, " + - "InvestigatorId, DatasetId, DatasetStatusId, Datasets.AboutPlatform, InfoFileTitle, Specifics " + - "FROM InfoFiles " + - "LEFT JOIN Species USING (SpeciesId) " + - "LEFT JOIN Tissue USING (TissueId) " + - "LEFT JOIN InbredSet USING (InbredSetId) " + - "LEFT JOIN GeneChip USING (GeneChipId) " + - "LEFT JOIN AvgMethod USING (AvgMethodId) " + - "LEFT JOIN Datasets USING (DatasetId) " + - "LEFT JOIN Investigators USING (InvestigatorId) " + - "LEFT JOIN Organizations USING (OrganizationId) " + - "LEFT JOIN DatasetStatus USING (DatasetStatusId) WHERE ") + "GeneChip.GeneChipName, GeneChip.GeoPlatform, AvgMethod.Name, Datasets.DatasetName, Datasets.GeoSeries, " + + "Datasets.PublicationTitle, DatasetStatus.DatasetStatusName, Datasets.Summary, Datasets.AboutCases, " + + "Datasets.AboutTissue, Datasets.AboutDataProcessing, Datasets.Acknowledgment, Datasets.ExperimentDesign, " + + "Datasets.Contributors, Datasets.Citation, Datasets.Notes, Investigators.FirstName, Investigators.LastName, " + + "Investigators.Address, Investigators.City, Investigators.State, Investigators.ZipCode, Investigators.Country, " + + "Investigators.Phone, Investigators.Email, Investigators.Url, Organizations.OrganizationName, " + + "InvestigatorId, DatasetId, DatasetStatusId, Datasets.AboutPlatform, InfoFileTitle, Specifics " + + "FROM InfoFiles " + + "LEFT JOIN Species USING (SpeciesId) " + + "LEFT JOIN Tissue USING (TissueId) " + + "LEFT JOIN InbredSet USING (InbredSetId) " + + "LEFT JOIN GeneChip USING (GeneChipId) " + + "LEFT JOIN AvgMethod USING (AvgMethodId) " + + "LEFT JOIN Datasets USING (DatasetId) " + + "LEFT JOIN Investigators USING (InvestigatorId) " + + "LEFT JOIN Organizations USING (OrganizationId) " + + "LEFT JOIN DatasetStatus USING (DatasetStatusId) WHERE ") if self.gn_accession_id: final_query = query_base + \ diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index e50ff50b..48527785 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -111,8 +111,8 @@ class MrnaAssaySearch(DoSearch): else: match_clause = "" - where_clause = (match_clause + - """ProbeSet.Id = ProbeSetXRef.ProbeSetId + where_clause = (match_clause + + """ProbeSet.Id = ProbeSetXRef.ProbeSetId and ProbeSetXRef.ProbeSetFreezeId = %s """ % (escape(str(self.dataset.id)))) @@ -134,8 +134,8 @@ class MrnaAssaySearch(DoSearch): else: match_clause = "" - where_clause = (match_clause + - """ProbeSet.Id = ProbeSetXRef.ProbeSetId + where_clause = (match_clause + + """ProbeSet.Id = ProbeSetXRef.ProbeSetId and ProbeSetXRef.ProbeSetFreezeId = %s """ % (escape(str(self.dataset.id)))) @@ -348,8 +348,8 @@ class GenotypeSearch(DoSearch): from_clause = self.normalize_spaces(from_clause) if self.search_term[0] == "*": - query = (self.base_query + - """WHERE Geno.Id = GenoXRef.GenoId + query = (self.base_query + + """WHERE Geno.Id = GenoXRef.GenoId and GenoXRef.GenoFreezeId = GenoFreeze.Id and GenoFreeze.Id = %s""" % (escape(str(self.dataset.id)))) else: diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index c51b7a9a..9f9591ad 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -25,8 +25,8 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo trait_filename = f"{str(this_trait.name)}_{str(this_dataset.name)}_pheno" gen_pheno_txt_file(samples, vals, trait_filename) - output_filename = (f"{this_dataset.group.name}_GWA_" + - ''.join(random.choice(string.ascii_uppercase + string.digits) + output_filename = (f"{this_dataset.group.name}_GWA_" + + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) ) bootstrap_filename = None @@ -34,8 +34,8 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo opt_list = [] if boot_check and num_bootstrap > 0: - bootstrap_filename = (f"{this_dataset.group.name}_BOOTSTRAP_" + - ''.join(random.choice(string.ascii_uppercase + string.digits) + bootstrap_filename = (f"{this_dataset.group.name}_BOOTSTRAP_" + + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) ) @@ -44,9 +44,9 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo opt_list.append( f"--bootstrap_output {webqtlConfig.GENERATED_IMAGE_DIR}{bootstrap_filename}.txt") if num_perm > 0: - permu_filename = ("{this_dataset.group.name}_PERM_" + - ''.join(random.choice(string.ascii_uppercase + - string.digits) for _ in range(6)) + permu_filename = ("{this_dataset.group.name}_PERM_" + + ''.join(random.choice(string.ascii_uppercase + + string.digits) for _ in range(6)) ) opt_list.append("-n " + str(num_perm)) opt_list.append( diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 6419335e..3a63c84e 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -57,8 +57,8 @@ class SampleList: sample = webqtlCaseData.webqtlCaseData(name=sample_name) sample.extra_info = {} - if (self.dataset.group.name == 'AXBXA' and - sample_name in ('AXB18/19/20', 'AXB13/14', 'BXA8/17')): + if (self.dataset.group.name == 'AXBXA' + and sample_name in ('AXB18/19/20', 'AXB13/14', 'BXA8/17')): sample.extra_info['url'] = "/mouseCross.html#AXB/BXA" sample.extra_info['css_class'] = "fs12" diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 18cadea4..fcebbc4d 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -452,8 +452,8 @@ class ShowTrait: for sample in list(self.this_trait.data.keys()): if (self.this_trait.data[sample].name2 != self.this_trait.data[sample].name): - if ((self.this_trait.data[sample].name2 in primary_sample_names) and - (self.this_trait.data[sample].name not in primary_sample_names)): + if ((self.this_trait.data[sample].name2 in primary_sample_names) + and (self.this_trait.data[sample].name not in primary_sample_names)): primary_sample_names.append( self.this_trait.data[sample].name) primary_sample_names.remove( diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index 963288b3..3e543445 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -184,8 +184,8 @@ class UserSession: # ZS: Get user's collections if they exist collections = get_user_collections(self.user_id) collections = [item for item in collections if item['name'] != "Your Default Collection"] + \ - [item for item in collections if item['name'] == - "Your Default Collection"] # ZS: Ensure Default Collection is last in list + [item for item in collections if item['name'] + == "Your Default Collection"] # ZS: Ensure Default Collection is last in list return collections @property diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 2c53012a..f75209ff 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -140,8 +140,8 @@ def handle_bad_request(e): logger.error(traceback.format_exc()) now = datetime.datetime.utcnow() time_str = now.strftime('%l:%M%p UTC %b %d, %Y') - formatted_lines = [request.url + - " (" + time_str + ")"]+traceback.format_exc().splitlines() + formatted_lines = [request.url + + " (" + time_str + ")"]+traceback.format_exc().splitlines() # Handle random animations # Use a cookie to have one animation on refresh @@ -518,10 +518,10 @@ def export_perm_data(): ["#N_genotypes: " + str(perm_info['n_genotypes'])], ["#Genotype_file: " + perm_info['genofile']], ["#Units_linkage: " + perm_info['units_linkage']], - ["#Permutation_stratified_by: " + - ", ".join([str(cofactor) for cofactor in perm_info['strat_cofactors']])], - ["#RESULTS_1: Suggestive LRS(p=0.63) = " + - str(np.percentile(np.array(perm_info['perm_data']), 67))], + ["#Permutation_stratified_by: " + + ", ".join([str(cofactor) for cofactor in perm_info['strat_cofactors']])], + ["#RESULTS_1: Suggestive LRS(p=0.63) = " + + str(np.percentile(np.array(perm_info['perm_data']), 67))], ["#RESULTS_2: Significant LRS(p=0.05) = " + str( np.percentile(np.array(perm_info['perm_data']), 95))], ["#RESULTS_3: Highly Significant LRS(p=0.01) = " + str( |