Mercurial > repos > iuc > ncbi_entrez_direct_esearch
comparison __efetch_build_options.py @ 0:b6ffd64c448e draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_direct commit 8f96f378620bb663dcce2845ecb14355413f7afa"
author | iuc |
---|---|
date | Tue, 22 Mar 2022 22:30:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b6ffd64c448e |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 # Daniel Blankenberg | |
4 # Creates the options for tool interface | |
5 | |
6 # http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi | |
7 db_list = '''<DbName>pubmed</DbName> | |
8 <DbName>protein</DbName> | |
9 <DbName>nuccore</DbName> | |
10 <DbName>nucleotide</DbName> | |
11 <DbName>nucgss</DbName> | |
12 <DbName>nucest</DbName> | |
13 <DbName>structure</DbName> | |
14 <DbName>genome</DbName> | |
15 <DbName>annotinfo</DbName> | |
16 <DbName>assembly</DbName> | |
17 <DbName>bioproject</DbName> | |
18 <DbName>biosample</DbName> | |
19 <DbName>blastdbinfo</DbName> | |
20 <DbName>books</DbName> | |
21 <DbName>cdd</DbName> | |
22 <DbName>clinvar</DbName> | |
23 <DbName>clone</DbName> | |
24 <DbName>gap</DbName> | |
25 <DbName>gapplus</DbName> | |
26 <DbName>grasp</DbName> | |
27 <DbName>dbvar</DbName> | |
28 <DbName>gene</DbName> | |
29 <DbName>gds</DbName> | |
30 <DbName>geoprofiles</DbName> | |
31 <DbName>homologene</DbName> | |
32 <DbName>medgen</DbName> | |
33 <DbName>mesh</DbName> | |
34 <DbName>ncbisearch</DbName> | |
35 <DbName>nlmcatalog</DbName> | |
36 <DbName>omim</DbName> | |
37 <DbName>orgtrack</DbName> | |
38 <DbName>pmc</DbName> | |
39 <DbName>popset</DbName> | |
40 <DbName>probe</DbName> | |
41 <DbName>proteinclusters</DbName> | |
42 <DbName>pcassay</DbName> | |
43 <DbName>biosystems</DbName> | |
44 <DbName>pccompound</DbName> | |
45 <DbName>pcsubstance</DbName> | |
46 <DbName>pubmedhealth</DbName> | |
47 <DbName>seqannot</DbName> | |
48 <DbName>snp</DbName> | |
49 <DbName>sra</DbName> | |
50 <DbName>taxonomy</DbName> | |
51 <DbName>unigene</DbName> | |
52 <DbName>gencoll</DbName> | |
53 <DbName>gtr</DbName>'''.replace("<DbName>", "").replace("</DbName>", "").split("\n") | |
54 | |
55 | |
56 help = ''' (all) | |
57 docsum DocumentSummarySet XML | |
58 docsum json DocumentSummarySet JSON | |
59 full Same as native except for mesh | |
60 uid Unique Identifier List | |
61 url Entrez URL | |
62 xml Same as -format full -mode xml | |
63 | |
64 bioproject | |
65 native BioProject Report | |
66 native xml RecordSet XML | |
67 | |
68 biosample | |
69 native BioSample Report | |
70 native xml BioSampleSet XML | |
71 | |
72 biosystems | |
73 native xml Sys-set XML | |
74 | |
75 gds | |
76 native xml RecordSet XML | |
77 summary Summary | |
78 | |
79 gene | |
80 gene_table Gene Table | |
81 native Gene Report | |
82 native asn.1 Entrezgene ASN.1 | |
83 native xml Entrezgene-Set XML | |
84 tabular Tabular Report | |
85 | |
86 homologene | |
87 alignmentscores Alignment Scores | |
88 fasta FASTA | |
89 homologene Homologene Report | |
90 native Homologene List | |
91 native asn.1 HG-Entry ASN.1 | |
92 native xml Entrez-Homologene-Set XML | |
93 | |
94 mesh | |
95 full Full Record | |
96 native MeSH Report | |
97 native xml RecordSet XML | |
98 | |
99 nlmcatalog | |
100 native Full Record | |
101 native xml NLMCatalogRecordSet XML | |
102 | |
103 pmc | |
104 medline MEDLINE | |
105 native xml pmc-articleset XML | |
106 | |
107 pubmed | |
108 abstract Abstract | |
109 medline MEDLINE | |
110 native asn.1 Pubmed-entry ASN.1 | |
111 native xml PubmedArticleSet XML | |
112 | |
113 (sequences) | |
114 acc Accession Number | |
115 est EST Report | |
116 fasta FASTA | |
117 fasta xml TinySeq XML | |
118 fasta_cds_aa FASTA of CDS Products | |
119 fasta_cds_na FASTA of Coding Regions | |
120 ft Feature Table | |
121 gb GenBank Flatfile | |
122 gb xml GBSet XML | |
123 gbc xml INSDSet XML | |
124 gbwithparts GenBank with Contig Sequences | |
125 gene_fasta FASTA of Gene | |
126 gp GenPept Flatfile | |
127 gp xml GBSet XML | |
128 gpc xml INSDSet XML | |
129 gss GSS Report | |
130 ipg Identical Protein Report | |
131 ipg xml IPGReportSet XML | |
132 native text Seq-entry ASN.1 | |
133 native xml Bioseq-set XML | |
134 seqid Seq-id ASN.1 | |
135 | |
136 snp | |
137 chr Chromosome Report | |
138 docset Summary | |
139 fasta FASTA | |
140 flt Flat File | |
141 native asn.1 Rs ASN.1 | |
142 native xml ExchangeSet XML | |
143 rsr RS Cluster Report | |
144 ssexemplar SS Exemplar List | |
145 | |
146 sra | |
147 native xml EXPERIMENT_PACKAGE_SET XML | |
148 runinfo xml SraRunInfo XML | |
149 | |
150 structure | |
151 mmdb Ncbi-mime-asn1 strucseq ASN.1 | |
152 native MMDB Report | |
153 native xml RecordSet XML | |
154 | |
155 taxonomy | |
156 native Taxonomy List | |
157 native xml TaxaSet XML'''.split("\n") | |
158 | |
159 db = {} | |
160 name = None | |
161 all = "(all)" | |
162 for line in help: | |
163 if line.strip() and line[2] != ' ': | |
164 name = line.strip() | |
165 db[name] = {} | |
166 elif line.strip(): | |
167 format = line[0:len(" docsum ")].strip() | |
168 mode = line[len(" docsum "):len(" docsum json ")].strip() | |
169 if format not in db[name]: | |
170 db[name][format] = [] | |
171 db[name][format].append(mode) | |
172 | |
173 for name in db_list: | |
174 if name not in db: | |
175 db[name] = {} | |
176 | |
177 db["sequences"] = db["(sequences)"] | |
178 del db["(sequences)"] | |
179 | |
180 print('<conditional name="db">') | |
181 print(' <param name="db" type="select" label="Database" argument="-db">') | |
182 for name in sorted(db.keys()): | |
183 if name == all: | |
184 continue | |
185 print(' <option value="%s">%s</option>' % (name, name)) | |
186 print(' <option value="">Manual Entry</option>') | |
187 print(' </param>') | |
188 | |
189 for name in sorted(db.keys()): | |
190 if name == all: | |
191 continue | |
192 my_dict = db[all].copy() | |
193 | |
194 for format, modes in db[name].items(): | |
195 if format in my_dict: | |
196 for mode in modes: | |
197 if mode not in my_dict[format]: | |
198 my_dict[format].append(mode) | |
199 else: | |
200 my_dict[format] = modes | |
201 if "" not in my_dict: | |
202 my_dict[""] = [""] | |
203 print(' <when value="%s">' % name) | |
204 print(' <conditional name="format">') | |
205 print(' <param name="format" type="select" label="Format" argument="-format">') | |
206 for format in sorted(my_dict.keys()): | |
207 print(' <option value="%s">%s</option>' % (format, format or "None")) | |
208 print(' </param>') | |
209 for format in sorted(my_dict.keys()): | |
210 print(' <when value="%s">' % format) | |
211 print(' <param name="mode" type="select" label="Mode" argument="-mode">') | |
212 if "" not in my_dict[format]: | |
213 my_dict[format].append("") | |
214 for mode in sorted(my_dict[format]): | |
215 print(' <option value="%s">%s</option>' % (mode, mode or "None")) | |
216 print(' </param>') | |
217 print(' </when>') | |
218 print(' </conditional>') | |
219 print(' </when>') | |
220 print(' <when value="">') | |
221 print(' <param name="db_manual" type="text" label="Database" argument="-db"/>') | |
222 print(' <param name="format" type="text" label="Format" argument="-format"/>') | |
223 print(' <param name="mode" type="text" label="Mode" argument="-mode"/>') | |
224 print(' </when>') | |
225 print('</conditional>') |