aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/generate_probesetfreeze_file.py
diff options
context:
space:
mode:
authorArthur Centeno2021-06-15 15:33:59 +0000
committerArthur Centeno2021-06-15 15:33:59 +0000
commitc1a6ca69f7c48d99b6c5d62e56a445583fd4c08b (patch)
treef98fccc44829e3f52e585d6b41a1942aa52bd8b7 /wqflask/maintenance/generate_probesetfreeze_file.py
parent7e49c006af9c4f7453c3578a7d4f1fc4d7bdf3ed (diff)
parent9e9e0e4d440383f617542e810a1115833eafd7bf (diff)
downloadgenenetwork2-c1a6ca69f7c48d99b6c5d62e56a445583fd4c08b.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into acenteno
Diffstat (limited to 'wqflask/maintenance/generate_probesetfreeze_file.py')
-rw-r--r--wqflask/maintenance/generate_probesetfreeze_file.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/wqflask/maintenance/generate_probesetfreeze_file.py b/wqflask/maintenance/generate_probesetfreeze_file.py
index b1e41e9a..e964c8ed 100644
--- a/wqflask/maintenance/generate_probesetfreeze_file.py
+++ b/wqflask/maintenance/generate_probesetfreeze_file.py
@@ -23,10 +23,12 @@ def get_cursor():
cursor = con.cursor()
return cursor
+
def show_progress(process, counter):
if counter % 1000 == 0:
print("{}: {}".format(process, counter))
+
def get_strains(cursor):
cursor.execute("""select Strain.Name
from Strain, StrainXRef, InbredSet
@@ -42,6 +44,7 @@ def get_strains(cursor):
return strains
+
def get_probeset_vals(cursor, dataset_name):
cursor.execute(""" select ProbeSet.Id, ProbeSet.Name
from ProbeSetXRef,
@@ -77,6 +80,7 @@ def get_probeset_vals(cursor, dataset_name):
return probeset_vals
+
def trim_strains(strains, probeset_vals):
trimmed_strains = []
#print("probeset_vals is:", pf(probeset_vals))
@@ -89,6 +93,7 @@ def trim_strains(strains, probeset_vals):
print("trimmed_strains:", pf(trimmed_strains))
return trimmed_strains
+
def write_data_matrix_file(strains, probeset_vals, filename):
with open(filename, "wb") as fh:
csv_writer = csv.writer(fh, delimiter=",", quoting=csv.QUOTE_ALL)
@@ -103,10 +108,12 @@ def write_data_matrix_file(strains, probeset_vals, filename):
csv_writer.writerow(row_data)
show_progress("Writing", counter)
+
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()
@@ -117,5 +124,6 @@ def main():
trimmed_strains = trim_strains(strains, probeset_vals)
write_data_matrix_file(trimmed_strains, probeset_vals, filename)
+
if __name__ == '__main__':
main()