Mercurial > repos > iuc > enasearch_search_data
annotate generate_macros.py @ 2:63b13eb2cb8a draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/enasearch commit a0adc28145cce02ecaed3a90156ed54c4385d1a0"
author | iuc |
---|---|
date | Tue, 21 Jan 2020 19:05:10 -0500 |
parents | fc42e7901a23 |
children |
rev | line source |
---|---|
0
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
2 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
3 import enasearch |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
4 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
5 spaces = ' ' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
6 operator_names = { |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
7 "=": "equal", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
8 "!=": "different", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
9 "<": "lower", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
10 "<=": "equal or lower", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
11 ">": "higher", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
12 ">=": "equal or higher", |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
13 } |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
14 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
15 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
16 def format_name(name, alternative_name): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
17 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
18 Format name to remove None name and & in name |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
19 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
20 if name is None: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
21 name = alternative_name |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
22 name = name.replace("&", "and") |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
23 return name |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
24 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
25 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
26 def sort_by_name(dict): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
27 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
28 Sort a dictionary on the values |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
29 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
30 return sorted(dict, key=dict.get) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
31 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
32 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
33 def write_analysis_fields(): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
34 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
35 Write the analysis fields |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
36 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
37 s = '%s<xml name="analysis_fields">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
38 fields = enasearch.get_returnable_fields(result="analysis", verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
39 for f in fields: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
40 s += '%s<option value="%s">%s</option>\n' % (2 * spaces, f, f) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
41 s += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
42 return s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
43 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
44 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
45 def write_display_options(): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
46 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
47 Write the display options |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
48 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
49 s = '%s<xml name="display_options">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
50 when_s = '%s<xml name="when_display_options">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
51 options = enasearch.get_display_options(verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
52 for opt in options: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
53 s += '%s<option value="%s">%s</option>\n' % (2 * spaces, opt, options[opt]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
54 when_s += '%s<when value="%s">\n' % (2 * spaces, opt) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
55 if opt == 'fasta' or opt == 'fastq': |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
56 when_s += '%s<param name="range_start" argument="--subseq_range" type="integer" optional="true" label="Start integer for subsequences"/>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
57 when_s += '%s<param name="range_stop" argument="--subseq_range" type="integer" optional="true" label="Stop integer for subsequences"/>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
58 else: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
59 when_s += '%s<param argument="--offset" type="integer" optional="true" label="First record to get"/>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
60 when_s += '%s<param argument="--length" type="integer" optional="true" label="Number of records to retrieve"/>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
61 when_s += '%s</when>\n' % (2 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
62 s += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
63 when_s += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
64 s += when_s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
65 return s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
66 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
67 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
68 def write_run_fields(): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
69 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
70 Write the run fields |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
71 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
72 s = '%s<xml name="run_fields">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
73 fields = enasearch.get_returnable_fields(result="read_run", verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
74 for f in fields: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
75 s += '%s<option value="%s">%s</option>\n' % (2 * spaces, f, f) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
76 s += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
77 return s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
78 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
79 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
80 def write_taxonomy_results(): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
81 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
82 Write the possible taxonomy results |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
83 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
84 s = '%s<xml name="taxonomy_results">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
85 fields = enasearch.get_taxonomy_results(verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
86 for f in fields: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
87 s += '%s<option value="%s">%s</option>\n' % (2 * spaces, f, fields[f]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
88 s += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
89 return s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
90 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
91 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
92 def write_result_parameters(fts=False): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
93 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
94 Write the parameters that are dependant of results |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
95 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
96 res = enasearch.get_results(verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
97 options = enasearch.get_display_options(verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
98 ft = enasearch.get_filter_types(verbose=False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
99 # Format the filter type related parameters |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
100 ft_parameters = {} |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
101 for t in ft: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
102 s = '' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
103 if 'operators' in ft[t]: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
104 s = '%s<param name="operation" type="select" label="Operator">\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
105 for o in ft[t]['operators']: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
106 on = o |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
107 if o in operator_names: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
108 on = operator_names[o] |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
109 s += '%s<option value="%s">%s</option>\n' % (8 * spaces, on, on) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
110 s += '%s</param>\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
111 if 'value' in ft[t]: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
112 value_format = 'float' if t == 'Number' else 'text' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
113 s += '%s<param name="value" type="%s" value="" label="%s"/>\n' % (7 * spaces, value_format, ft[t]['value']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
114 elif 'values' in ft[t]: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
115 s += '%s<param name="value" type="select" label="Value">\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
116 for v in ft[t]['values']: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
117 s += '%s<option value="%s">%s</option>\n' % (8 * spaces, v, v) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
118 s += '%s</param>\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
119 else: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
120 s += '%s<conditional name="op">\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
121 s += '%s<param name="operation" type="select" label="Operation">\n' % (8 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
122 for op in ft[t]: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
123 s += '%s<option value="%s">%s</option>\n' % (9 * spaces, op, ft[t][op]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
124 s += '%s</param>\n' % (8 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
125 for op in ft[t]: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
126 s += '%s<when value="%s">\n' % (8 * spaces, op) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
127 s += '%s<param name="values" type="text" value="" label="%s" help="Values separated by simple comma"/>\n' % (9 * spaces, ",".join(ft[t][op]['parameters'])) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
128 s += '%s</when>\n' % (8 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
129 s += '%s</conditional>\n' % (7 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
130 ft_parameters[t] = s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
131 # Start adding the conditional |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
132 s = '%s<conditional name="res">\n' % (2 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
133 # Add result parameter |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
134 s += '%s<param argument="--result" type="select" label="Result to return">\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
135 for r in res: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
136 s += '%s<option value="%s">%s</option>\n' % (4 * spaces, r, res[r]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
137 s += '%s</param>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
138 for r in res: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
139 sf = enasearch.get_sortable_fields(r) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
140 ff = res[r]['filter_fields'] |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
141 s += '%s<when value="%s">\n' % (3 * spaces, r) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
142 if not fts: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
143 s += '%s<repeat name="queries" title="Add a query">\n' % (4 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
144 # Add combination operator |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
145 s += '%s<param name="combination_operation" type="select" label="Combination operation">\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
146 s += '%s<option value="AND">AND</option>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
147 s += '%s<option value="OR">OR</option>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
148 s += '%s<option value="NOT">NOT</option>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
149 s += '%s</param>\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
150 s += '%s<conditional name="filter_field">\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
151 s += '%s<param name="field" type="select" label="Field to query">\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
152 for f in ff: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
153 s += '%s<option value="%s">%s</option>\n' % (7 * spaces, f, ff[f]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
154 s += '%s</param>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
155 for f in ff: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
156 # Add the correct parameter given the type of field |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
157 typ = ff[f]['type'].capitalize() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
158 if typ not in ft_parameters: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
159 if f == 'location': |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
160 typ = 'Geospatial' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
161 else: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
162 continue |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
163 s += '%s<when value="%s">\n' % (6 * spaces, f) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
164 s += ft_parameters[typ] |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
165 s += '%s</when>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
166 s += '%s</conditional>\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
167 s += '%s</repeat>\n' % (4 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
168 # Add display opt |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
169 s += '%s<conditional name="display_opt">\n' % (4 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
170 s += '%s<param argument="--display" type="select" label="Display option to specify the display format">\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
171 s += '%s<expand macro="display_options"/>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
172 s += '%s</param>\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
173 for opt in options: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
174 s += '%s<when value="%s"' % (5 * spaces, opt) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
175 if opt != 'fasta' and opt != 'fastq': |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
176 s += '>\n' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
177 s += '%s<param argument="--offset" type="integer" optional="true" label="First record to get"/>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
178 s += '%s<param argument="--length" type="integer" optional="true" label="Number of records to retrieve"/>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
179 if opt == 'report': |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
180 s += '%s<param argument="--fields" type="select" multiple="true" label="Fields to return">\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
181 for f in res[r]['returnable_fields']: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
182 s += '%s<option value="%s">%s</option>\n' % (7 * spaces, f, f) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
183 s += '%s</param>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
184 s += '%s<param argument="--sortfields" type="select" optional="true" multiple="true" label="Fields to sort the results">\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
185 for f in sf: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
186 s += '%s<option value="%s">%s</option>\n' % (7 * spaces, f, sf[f]['description']) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
187 s += '%s</param>\n' % (6 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
188 s += '%s</when>\n' % (5 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
189 else: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
190 s += '/>\n' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
191 s += '%s</conditional>\n' % (4 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
192 s += '%s</when>\n' % (3 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
193 s += '%s</conditional>\n' % (2 * spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
194 return s |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
195 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
196 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
197 def write_search_data_parameters(): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
198 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
199 Write the parameters for search_data |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
200 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
201 fts = '%s<xml name="free_text_search">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
202 fts += write_result_parameters(True) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
203 fts += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
204 cts = '%s<xml name="conditional_text_search">\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
205 cts += write_result_parameters(False) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
206 cts += '%s</xml>\n' % (spaces) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
207 return fts + cts |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
208 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
209 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
210 def generate_search_macros(filepath): |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
211 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
212 Generate the content of the macro file |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
213 """ |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
214 s = '<?xml version="1.0" ?>\n' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
215 s += '<macros>\n' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
216 s += write_analysis_fields() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
217 s += write_display_options() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
218 s += write_run_fields() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
219 s += write_taxonomy_results() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
220 s += write_search_data_parameters() |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
221 s += '</macros>\n' |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
222 with open(filepath, "w") as file: |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
223 file.write(s) |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
224 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
225 |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
226 if __name__ == '__main__': |
fc42e7901a23
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff
changeset
|
227 generate_search_macros("search_macros.xml") |