diff options
author | Pjotr Prins | 2016-06-17 06:15:59 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-06-17 06:15:59 +0000 |
commit | 9ed3c1e6ed99c56d77fd5d90ff42f9acfe7ace68 (patch) | |
tree | fabca0ec5073e2c17da425eeeb7e40a9e15c564f /wqflask/maintenance/gen_select_dataset.py | |
parent | 497b72d3496b9368167616774e58250598d7bd83 (diff) | |
download | genenetwork2-9ed3c1e6ed99c56d77fd5d90ff42f9acfe7ace68.tar.gz |
Removed trailing spaces in .py and .js files
Diffstat (limited to 'wqflask/maintenance/gen_select_dataset.py')
-rwxr-xr-x | wqflask/maintenance/gen_select_dataset.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 489d291f..b1459bf3 100755 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -21,7 +21,7 @@ It needs to be run manually when database has been changed. # (sourceforge.net/projects/genenetwork/). # # Contact Drs. Robert W. Williams -# at rwilliams@uthsc.edu +# at rwilliams@uthsc.edu # # # @@ -60,15 +60,15 @@ from pprint import pformat as pf def parse_db_uri(db_uri): """Converts a database URI to the db name, host name, user name, and password""" - + parsed_uri = urlparse.urlparse(zach_settings.DB_URI) - + db_conn_info = dict( db = parsed_uri.path[1:], host = parsed_uri.hostname, user = parsed_uri.username, passwd = parsed_uri.password) - + return db_conn_info @@ -149,12 +149,12 @@ def genotypes_exist(group_name): def build_types(species, group): """Fetches tissues - + Gets the tissues with data for this species/group (all types except phenotype/genotype are tissues) - + """ - + Cursor.execute("""select distinct Tissue.Name from ProbeFreeze, ProbeSetFreeze, InbredSet, Tissue, Species where Species.Name = %s and Species.Id = InbredSet.SpeciesId and @@ -164,14 +164,14 @@ def build_types(species, group): ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and ProbeSetFreeze.public > 0 order by Tissue.Name""", (species, group)) - + results = [] for result in Cursor.fetchall(): if len(result): these_datasets = build_datasets(species, group, result[0]) if len(these_datasets) > 0: results.append((result[0], result[0])) - + return results def get_datasets(types): @@ -196,10 +196,10 @@ def build_datasets(species, group, type_name): if type_name == "Phenotypes": print("GROUP:", group) Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where - InbredSet.Name = %s and + InbredSet.Name = %s and PublishFreeze.InbredSetId = InbredSet.Id and InfoFiles.InfoPageName = PublishFreeze.Name and - PublishFreeze.public > 0 and + PublishFreeze.public > 0 and PublishFreeze.confidentiality < 1 order by PublishFreeze.CreateTime desc""", (group)) @@ -216,10 +216,10 @@ def build_datasets(species, group, type_name): elif type_name == "Genotypes": Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where - InbredSet.Name = %s and + InbredSet.Name = %s and GenoFreeze.InbredSetId = InbredSet.Id and InfoFiles.InfoPageName = GenoFreeze.ShortName and - GenoFreeze.public > 0 and + GenoFreeze.public > 0 and GenoFreeze.confidentiality < 1 order by GenoFreeze.CreateTime desc""", (group)) @@ -238,11 +238,11 @@ def build_datasets(species, group, type_name): ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where Species.Name = %s and Species.Id = InbredSet.SpeciesId and InbredSet.Name = %s and - ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = %s and - ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and + ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = %s and + ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and ProbeSetFreeze.confidentiality < 1 and ProbeSetFreeze.public > 0 order by ProbeSetFreeze.CreateTime desc""", (species, group, type_name)) - + dataset_results = Cursor.fetchall() datasets = [] for dataset_info in dataset_results: @@ -295,7 +295,7 @@ def _test_it(): datasets = build_datasets("Mouse", "BXD", "Hippocampus") #print("build_datasets:", pf(datasets)) -if __name__ == '__main__': +if __name__ == '__main__': Conn = MySQLdb.Connect(**parse_db_uri(zach_settings.DB_URI)) Cursor = Conn.cursor() main() |