annotate getOntology.py @ 1:f70f75e89890 draft default tip

"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
author azomics
date Thu, 23 Jul 2020 08:50:18 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
1 #!/usr/bin/env python
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
2 ######################################################################
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
3 # Copyright (c) 2016 Northrop Grumman.
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
4 # All rights reserved.
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
5 ######################################################################
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
6 from __future__ import print_function
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
7 import sys
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
8 import os
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
9
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
10 from collections import defaultdict
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
11 from argparse import ArgumentParser
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
12 from jinja2 import Environment, FileSystemLoader
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
13
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
14
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
15 def generate_flowCL_query(list_markers, list_types):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
16 if (len(list_markers) != len(list_types)):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
17 return("pb with headers")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
18 query = []
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
19 # go through both lists, remove fsc/ssc
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
20 for i in range(0, len(list_markers)):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
21 if not list_markers[i].startswith("FSC") and not list_markers[i].startswith("SSC"):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
22 query.append(list_markers[i].upper())
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
23 query.append(list_types[i])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
24 # return concatenated string
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
25 return("".join(query))
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
26
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
27
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
28 def run_flowCL(phenotype, output_file, output_dir, tool_dir):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
29 os.mkdir(output_dir)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
30 tool = "/".join([tool_dir, "getOntology.R"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
31 output_txt = "".join([output_dir, "/flowCL_run_summary.txt"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
32 output_table = "".join([output_dir, "/flowCL_table.txt"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
33 output_pdf = "".join([output_dir, "/flowCL_res.pdf"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
34 run_command = " ". join(["Rscript --slave --vanilla", tool, output_txt, phenotype])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
35 os.system(run_command)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
36
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
37 table = defaultdict(list)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
38 labels = []
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
39 nb_match = 0
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
40 if os.path.isfile(output_txt):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
41 with open(output_txt, "r") as txt:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
42 check = txt.readline().strip()
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
43 if (not check):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
44 sys.exit(2)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
45 else:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
46 i = -1
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
47 for lines in txt:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
48 data = lines.strip("\n").split("\"")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
49 if data[0].strip():
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
50 labels.append(data[0].strip())
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
51 i += 1
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
52 if data[0].startswith("Score"):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
53 count_matches = data[1].split(") ")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
54 nb_match = len(count_matches) - 1
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
55 table[i].append(data[1])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
56 else:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
57 sys.stderr.write("There are no results with this query. Please check your markers if you believe there should be.")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
58 sys.exit(2)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
59
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
60 with open(output_table, "w") as tbl:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
61 tbl.write("1\t2\nQuery\t" + phenotype + "\n")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
62 for j in table:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
63 newline = " ".join(table[j])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
64 for k in range(1, nb_match + 1):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
65 cur_stg = "".join([str(k+1), ")"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
66 new_stg = "".join(["<br>", cur_stg])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
67 newline = newline.replace(cur_stg, new_stg)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
68
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
69 if labels[j] == "Cell ID":
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
70 cls = newline.split(" ")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
71 for m in range(0, len(cls)):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
72 if cls[m].startswith("CL"):
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
73 cl_id = cls[m].replace("_", ":")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
74 link = "".join(['<a href="http://www.immport-labs.org/immport-ontology/public/home/home/', cl_id, '" target="_blank">'])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
75 cls[m] = "".join([link, cls[m], "</a>"])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
76 newline = " ".join(cls)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
77 tbl.write("\t".join([labels[j], newline]) + "\n")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
78
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
79 get_graph = " ".join(["mv flowCL_results/*.pdf", output_pdf])
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
80 os.system(get_graph)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
81
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
82 env = Environment(loader=FileSystemLoader(tool_dir + "/templates"))
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
83 template = env.get_template("flowCL.template")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
84
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
85 real_directory = output_dir.replace("/job_working_directory", "")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
86 context = {'outputDirectory': real_directory}
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
87 overview = template.render(**context)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
88 with open(output_file, "w") as outf:
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
89 outf.write(overview)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
90 return
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
91
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
92
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
93 if __name__ == "__main__":
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
94 parser = ArgumentParser(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
95 prog="getOntology",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
96 description="runs flowCL on a set of markers.")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
97
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
98 parser.add_argument(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
99 '-m',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
100 dest="markers",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
101 required=True,
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
102 action='append',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
103 help="marker queries.")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
104
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
105 parser.add_argument(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
106 '-y',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
107 dest="marker_types",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
108 required=True,
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
109 action='append',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
110 help="marker queries.")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
111
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
112 parser.add_argument(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
113 '-o',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
114 dest="output_file",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
115 required=True,
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
116 help="Name of the output html file.")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
117
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
118 parser.add_argument(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
119 '-d',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
120 dest="output_dir",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
121 required=True,
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
122 help="Path to the html supporting directory")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
123
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
124 parser.add_argument(
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
125 '-t',
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
126 dest="tool_dir",
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
127 required=True,
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
128 help="Path to the tool directory")
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
129
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
130 args = parser.parse_args()
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
131
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
132 markers = [m.strip() for m in args.markers]
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
133 query = generate_flowCL_query(markers, args.marker_types)
f70f75e89890 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f"
azomics
parents:
diff changeset
134 run_flowCL(query, args.output_file, args.output_dir, args.tool_dir)