annotate generate_macros.py @ 2:3dd81790a236 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:06:02 -0500
parents c320e878909a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
1 #!/usr/bin/env python
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
2
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
3 import enasearch
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
4
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
5 spaces = ' '
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
6 operator_names = {
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
7 "=": "equal",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
8 "!=": "different",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
9 "<": "lower",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
10 "<=": "equal or lower",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
11 ">": "higher",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
12 ">=": "equal or higher",
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
13 }
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
14
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
15
c320e878909a 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):
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
17 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
19 """
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
20 if name is None:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
21 name = alternative_name
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
22 name = name.replace("&", "and")
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
23 return name
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
24
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
25
c320e878909a 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):
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
27 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
29 """
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
31
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
32
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
33 def write_analysis_fields():
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
34 """
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
35 Write the analysis fields
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
36 """
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
39 for f in fields:
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
42 return s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
43
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
44
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
45 def write_display_options():
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
46 """
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
47 Write the display options
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
48 """
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
52 for opt in options:
c320e878909a 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'])
c320e878909a 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)
c320e878909a 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':
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
58 else:
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
64 s += when_s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
65 return s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
66
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
67
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
68 def write_run_fields():
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
69 """
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
70 Write the run fields
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
71 """
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
74 for f in fields:
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
77 return s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
78
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
79
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
80 def write_taxonomy_results():
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
81 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
83 """
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
86 for f in fields:
c320e878909a 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'])
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
89 return s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
90
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
91
c320e878909a 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):
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
93 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
95 """
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
100 ft_parameters = {}
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
101 for t in ft:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
102 s = ''
c320e878909a 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]:
c320e878909a 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)
c320e878909a 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']:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
106 on = o
c320e878909a 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:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
108 on = operator_names[o]
c320e878909a 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)
c320e878909a 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)
c320e878909a 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]:
c320e878909a 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'
c320e878909a 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'])
c320e878909a 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]:
c320e878909a 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)
c320e878909a 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']:
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
119 else:
c320e878909a 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)
c320e878909a 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)
c320e878909a 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]:
c320e878909a 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'])
c320e878909a 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)
c320e878909a 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]:
c320e878909a 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)
c320e878909a 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']))
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
130 ft_parameters[t] = s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
131 # Start adding the conditional
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
133 # Add result parameter
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
135 for r in res:
c320e878909a 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'])
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
138 for r in res:
c320e878909a 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)
c320e878909a 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']
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
142 if not fts:
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
144 # Add combination operator
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
152 for f in ff:
c320e878909a 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'])
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
155 for f in ff:
c320e878909a 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
c320e878909a 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()
c320e878909a 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:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
159 if f == 'location':
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
160 typ = 'Geospatial'
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
161 else:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
162 continue
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
164 s += ft_parameters[typ]
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
168 # Add display opt
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
173 for opt in options:
c320e878909a 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)
c320e878909a 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':
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
176 s += '>\n'
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
179 if opt == 'report':
c320e878909a 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)
c320e878909a 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']:
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
185 for f in sf:
c320e878909a 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'])
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
189 else:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
190 s += '/>\n'
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
194 return s
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
195
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
196
c320e878909a 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():
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
198 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
200 """
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a 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)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
207 return fts + cts
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
208
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
209
c320e878909a 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):
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
211 """
c320e878909a 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
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
213 """
c320e878909a 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'
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
215 s += '<macros>\n'
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
216 s += write_analysis_fields()
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
217 s += write_display_options()
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
218 s += write_run_fields()
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
219 s += write_taxonomy_results()
c320e878909a 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()
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
221 s += '</macros>\n'
c320e878909a 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:
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
223 file.write(s)
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
224
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
225
c320e878909a planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/enasearch/ commit 6eda25f5cccc0cf9be09c38a8b48d37aff56ed87
iuc
parents:
diff changeset
226 if __name__ == '__main__':
c320e878909a 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")