aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/maintenance')
-rwxr-xr-xwqflask/maintenance/gen_select_dataset.py34
-rwxr-xr-xwqflask/maintenance/generate_probesetfreeze_file.py2
-rwxr-xr-xwqflask/maintenance/get_group_samplelists.py8
-rwxr-xr-xwqflask/maintenance/print_benchmark.py16
4 files changed, 30 insertions, 30 deletions
diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py
index 8742b531..f91d3d88 100755
--- a/wqflask/maintenance/gen_select_dataset.py
+++ b/wqflask/maintenance/gen_select_dataset.py
@@ -22,7 +22,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
#
#
#
@@ -61,15 +61,15 @@ sys.exit()
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
@@ -150,12 +150,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
@@ -165,14 +165,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):
@@ -197,10 +197,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))
@@ -217,10 +217,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))
@@ -239,11 +239,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:
@@ -296,7 +296,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()
diff --git a/wqflask/maintenance/generate_probesetfreeze_file.py b/wqflask/maintenance/generate_probesetfreeze_file.py
index 91a2b8a1..84319a21 100755
--- a/wqflask/maintenance/generate_probesetfreeze_file.py
+++ b/wqflask/maintenance/generate_probesetfreeze_file.py
@@ -107,7 +107,7 @@ 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" +
+ "ProbeSetFreezeId_210_FullName_Eye_AXBXA_Illumina_V6.2" +
"(Oct08)_RankInv_Beta.txt")
dataset_name = "Eye_AXBXA_1008_RankInv"
diff --git a/wqflask/maintenance/get_group_samplelists.py b/wqflask/maintenance/get_group_samplelists.py
index a9059fad..2d48ce78 100755
--- a/wqflask/maintenance/get_group_samplelists.py
+++ b/wqflask/maintenance/get_group_samplelists.py
@@ -28,7 +28,7 @@ def get_samplelist_from_geno(genofilename):
genofile = gzip.open(genofilename)
else:
genofile = open(genofilename)
-
+
for line in genofile:
line = line.strip()
if not line:
@@ -36,9 +36,9 @@ def get_samplelist_from_geno(genofilename):
if line.startswith(("#", "@")):
continue
break
-
+
headers = line.split()
-
+
if headers[3] == "Mb":
samplelist = headers[4:]
else:
@@ -47,7 +47,7 @@ def get_samplelist_from_geno(genofilename):
def get_samplelist_from_plink(genofilename):
genofile = open(genofilename)
-
+
samplelist = []
for line in genofile:
line = line.split(" ")
diff --git a/wqflask/maintenance/print_benchmark.py b/wqflask/maintenance/print_benchmark.py
index 540e0904..ae327cf3 100755
--- a/wqflask/maintenance/print_benchmark.py
+++ b/wqflask/maintenance/print_benchmark.py
@@ -9,34 +9,34 @@ from pprint import pformat as pf
class TheCounter(object):
Counters = {}
-
+
def __init__(self):
start_time = time.time()
for counter in range(170000):
self.print_it(counter)
self.time_took = time.time() - start_time
- TheCounter.Counters[self.__class__.__name__] = self.time_took
+ TheCounter.Counters[self.__class__.__name__] = self.time_took
-class PrintAll(TheCounter):
+class PrintAll(TheCounter):
def print_it(self, counter):
print(counter)
-
+
class PrintSome(TheCounter):
def print_it(self, counter):
if counter % 1000 == 0:
print(counter)
-
+
class PrintNone(TheCounter):
def print_it(self, counter):
pass
-
-
+
+
def new_main():
print("Running new_main")
tests = [PrintAll, PrintSome, PrintNone]
for test in tests:
test()
-
+
print(pf(TheCounter.Counters))
if __name__ == '__main__':