Mercurial > repos > iuc > ncbi_eutils_esearch
comparison generate_macros_xml.pl @ 3:e267701c187b draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit dae34e5e182b4cceb808d7353080f14aa9a78ca9"
| author | iuc |
|---|---|
| date | Wed, 23 Sep 2020 09:48:26 +0000 |
| parents | |
| children | 67602de82f6e |
comparison
equal
deleted
inserted
replaced
| 2:c6096cd97120 | 3:e267701c187b |
|---|---|
| 1 #!/usr/bin/env perl | |
| 2 | |
| 3 #Usage: perl generate_macros_xml.pl > macros.xml | |
| 4 | |
| 5 #Note, this script uses einfo.py to get database info. It also uses manually compiled data stored at the bottom of this script that is based on: https://www.ncbi.nlm.nih.gov/books/NBK25499/table/chapter4.T._valid_values_of__retmode_and/?report=objectonly | |
| 6 #The data in the table on that page was manipulated to replace nulls with 'none', remove duplicates, and add missing formats based on correspondence with MLN. | |
| 7 | |
| 8 ## | |
| 9 ## use einfo to retrieve all the valid databases | |
| 10 ## | |
| 11 | |
| 12 print STDERR "Retrieving database list\n"; | |
| 13 | |
| 14 my $dbxml = `python einfo.py --user_email "planemo@galaxyproject.org" --admin_email "planemo@galaxyproject.org;test@bx.psu.edu"`; | |
| 15 | |
| 16 my(@dblist); | |
| 17 my $dbs = {}; | |
| 18 my $dbfroms = {}; | |
| 19 my $dbnames = {}; | |
| 20 foreach(split(/\n/,$dbxml)) | |
| 21 { | |
| 22 if(/<DbName>(.+)<\/DbName>/) | |
| 23 { | |
| 24 my $db = $1; | |
| 25 push(@dblist,$db); | |
| 26 $dbs->{$db} = 0; | |
| 27 $dbfroms->{$db} = 0; | |
| 28 $dbnames->{$db} = $_; | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 ## | |
| 33 ## Use einfo to retrieve all the valid links for each database (Note: some databases are not linked) | |
| 34 ## | |
| 35 | |
| 36 my $h = {}; | |
| 37 foreach my $db (sort {$dbnames->{$a} cmp $dbnames->{$b}} @dblist) | |
| 38 { | |
| 39 sleep(2); | |
| 40 | |
| 41 print STDERR "Retrieving info for $db\n"; | |
| 42 | |
| 43 my $response = `python einfo.py --db $db --user_email "planemo\@galaxyproject.org" --admin_email "planemo\@galaxyproject.org;test\@bx.psu.edu"`; | |
| 44 | |
| 45 my $dolinks = 0; | |
| 46 my $link = ""; | |
| 47 my $name = ""; | |
| 48 | |
| 49 foreach(split(/\n/,$response)) | |
| 50 { | |
| 51 if(/<LinkList>/) | |
| 52 { | |
| 53 $dolinks = 1; | |
| 54 #Save whether there exist links from this database | |
| 55 $dbfroms->{$db} = 1; | |
| 56 } | |
| 57 elsif(!$dolinks) | |
| 58 { | |
| 59 if(/<MenuName>(.+)<\/MenuName>/) | |
| 60 {$dbnames->{$db} = "$1 ($db)"} | |
| 61 } | |
| 62 elsif($dolinks) | |
| 63 { | |
| 64 if(/<Name>(.+)<\/Name>/) | |
| 65 {$link=$1} | |
| 66 elsif(/<Menu>(.*)<\/Menu>/) | |
| 67 {$name=$1} | |
| 68 elsif(/<DbTo>(.+)<\/DbTo>/) | |
| 69 { | |
| 70 $dbto=$1; | |
| 71 push(@{$h->{$db}->{$dbto}},[$link,$name]); | |
| 72 $link=""; | |
| 73 $name=""; | |
| 74 } | |
| 75 } | |
| 76 } | |
| 77 } | |
| 78 | |
| 79 my @sorted_dblist = sort {$dbnames->{$a} cmp $dbnames->{$b}} @dblist; | |
| 80 | |
| 81 ## | |
| 82 ## Generate XML to govern the valid databases to use with efetch | |
| 83 ## | |
| 84 | |
| 85 my $efetch_dbhash = {}; #->{efetch-compatible-db}->{rettype-retmode-galaxy_format} = format_name (galaxy_format) | |
| 86 while(<DATA>) | |
| 87 { | |
| 88 chomp; | |
| 89 my($db,$galaxy_format,$retmode,$rettype,$format_name) = split(/\t/,$_); | |
| 90 $efetch_dbhash->{$db}->{"$rettype-$retmode-$galaxy_format"} = | |
| 91 "$format_name ($galaxy_format)"; | |
| 92 } | |
| 93 | |
| 94 #EFetch database select list | |
| 95 | |
| 96 print << 'EOXML'; | |
| 97 <xml name="dbselect_efetch" token_name="db_select" token_label="NCBI Database to Query"> | |
| 98 <param name="@NAME@" type="select" label="@LABEL@"> | |
| 99 EOXML | |
| 100 | |
| 101 foreach my $db (grep {exists($dbs->{$_})} | |
| 102 sort {$dbnames->{$a} cmp $dbnames->{$b}} | |
| 103 keys(%$efetch_dbhash)) | |
| 104 { | |
| 105 my $selected = ''; | |
| 106 if($db eq 'pubmed') | |
| 107 {$selected = ' selected="True"'} | |
| 108 print << " EOXML"; | |
| 109 <option value="$db"$selected>$dbnames->{$db}</option> | |
| 110 EOXML | |
| 111 } | |
| 112 | |
| 113 print << 'EOXML'; | |
| 114 </param> | |
| 115 </xml> | |
| 116 EOXML | |
| 117 | |
| 118 #EFetch output formats | |
| 119 | |
| 120 print << 'EOXML'; | |
| 121 <xml name="efetchdb"> | |
| 122 <conditional name="db"> | |
| 123 <expand macro="dbselect_efetch" /> | |
| 124 EOXML | |
| 125 | |
| 126 foreach my $db (grep {exists($dbs->{$_})} | |
| 127 sort {$dbnames->{$a} cmp $dbnames->{$b}} | |
| 128 keys(%$efetch_dbhash)) | |
| 129 { | |
| 130 print << " EOXML"; | |
| 131 <when value="$db"> | |
| 132 <param name="output_format" type="select" label="Output Format"> | |
| 133 EOXML | |
| 134 | |
| 135 foreach my $eutils_format (sort {$efetch_dbhash->{$db}->{$a} cmp | |
| 136 $efetch_dbhash->{$db}->{$b}} | |
| 137 keys(%{$efetch_dbhash->{$db}})) | |
| 138 { | |
| 139 print << " EOXML"; | |
| 140 <option value="$eutils_format">$efetch_dbhash->{$db}->{$eutils_format}</option> | |
| 141 EOXML | |
| 142 } | |
| 143 | |
| 144 print << " EOXML"; | |
| 145 </param> | |
| 146 </when> | |
| 147 EOXML | |
| 148 } | |
| 149 | |
| 150 print << 'EOXML'; | |
| 151 </conditional> | |
| 152 </xml> | |
| 153 EOXML | |
| 154 | |
| 155 ## | |
| 156 ## Create a select list for the databases linked *from* | |
| 157 ## | |
| 158 | |
| 159 print << 'EOXML'; | |
| 160 <xml name="dbselect" token_name="db_select" token_label="NCBI Database to Query"> | |
| 161 <param name="@NAME@" type="select" label="@LABEL@"> | |
| 162 EOXML | |
| 163 | |
| 164 foreach my $from (@sorted_dblist) | |
| 165 { | |
| 166 print << " EOXML"; | |
| 167 <option value="$from">$dbnames->{$from}</option> | |
| 168 EOXML | |
| 169 } | |
| 170 | |
| 171 print << 'EOXML'; | |
| 172 </param> | |
| 173 </xml> | |
| 174 EOXML | |
| 175 | |
| 176 ## | |
| 177 ## Create a select list for the databases linked *to* | |
| 178 ## | |
| 179 | |
| 180 print << 'EOXML'; | |
| 181 <xml name="dbselect_linked" token_name="db_select_linked" token_label="NCBI Database to Use"> | |
| 182 <param name="@NAME@" type="select" label="@LABEL@"> | |
| 183 EOXML | |
| 184 | |
| 185 foreach my $from (grep {$dbfroms->{$_}} @sorted_dblist) | |
| 186 { | |
| 187 print << " EOXML"; | |
| 188 <option value="$from">$dbnames->{$from}</option> | |
| 189 EOXML | |
| 190 } | |
| 191 | |
| 192 print << 'EOXML'; | |
| 193 </param> | |
| 194 </xml> | |
| 195 EOXML | |
| 196 | |
| 197 ## | |
| 198 ## Create empty entries for commands that take no *to* database or link | |
| 199 ## | |
| 200 | |
| 201 print << 'EOXML'; | |
| 202 <xml name="none_link_macro"> | |
| 203 <conditional name="db_to"> | |
| 204 <param name="db_select_to" type="select" label="To NCBI Database (n/a)"> | |
| 205 <option value="n/a">Not applicable</option> | |
| 206 </param> | |
| 207 <when value="n/a"> | |
| 208 <param name="linkname" type="select" label="Link Name (n/a)"> | |
| 209 <option value="n/a">Not applicable</option> | |
| 210 </param> | |
| 211 </when> | |
| 212 </conditional> | |
| 213 </xml> | |
| 214 <xml name="db_link_macro"> | |
| 215 <conditional name="db_from_link"> | |
| 216 <expand macro="dbselect_linked" name="db_select_from_link" label="From NCBI Database" /> | |
| 217 EOXML | |
| 218 | |
| 219 foreach(grep {$dbfroms->{$_}} @sorted_dblist) | |
| 220 { | |
| 221 print << " EOXML"; | |
| 222 <when value="$_"> | |
| 223 <expand macro="none_link_macro" name="db_select_none" label="To NCBI Database" /> | |
| 224 </when> | |
| 225 EOXML | |
| 226 } | |
| 227 | |
| 228 print << 'EOXML'; | |
| 229 </conditional> | |
| 230 </xml> | |
| 231 EOXML | |
| 232 | |
| 233 ## | |
| 234 ## This is the master macro for the command selection | |
| 235 ## | |
| 236 | |
| 237 print << 'EOXML'; | |
| 238 <xml name="linkmacro"> | |
| 239 <conditional name="cmd"> | |
| 240 <param name="cmd_select" type="select" label="Link Method" help="Fetch UIDs from the 'To' Database that are linked to supplied UIDs in the 'From' database"> | |
| 241 <option value="neighbor" selected="true">Neighbor (neighbor)</option> | |
| 242 <option value="neighbor_history">Neighbor, save result in history server (neighbor_history)</option> | |
| 243 <option value="neighbor_score">Neighbor Score (neighbor_score)</option> | |
| 244 <option value="acheck">Show available links to any database (acheck)</option> | |
| 245 <option value="ncheck">Show available links within the same database (ncheck)</option> | |
| 246 <option value="lcheck">Show available links to external sources (LinkOuts) (lcheck)</option> | |
| 247 <option value="llinks">Show available URLs and attributes for non-library LinkOut providers (llinks)</option> | |
| 248 <option value="llinkslib">Show available URLs and attributes for all LinkOut Providers (llinkslib)</option> | |
| 249 <option value="prlinks">Show available primary LinkOut Provider Links (prlinks)</option> | |
| 250 </param> | |
| 251 <when value="neighbor"> | |
| 252 <expand macro="db_db_link_macro" name="link_select" label="Link name" /> | |
| 253 <param name="output_format" type="select" label="Output Format"> | |
| 254 <option value="xml">ID File (xml)</option> | |
| 255 <option value="json">ID File (json)</option> | |
| 256 <option value="text" selected="true">ID File (tabular)</option> | |
| 257 </param> | |
| 258 </when> | |
| 259 <when value="neighbor_history"> | |
| 260 <expand macro="db_db_link_macro" name="link_select" label="Link name" /> | |
| 261 <param name="output_format" type="select" label="Output Format"> | |
| 262 <option value="json">History File (json)</option> | |
| 263 <option value="xml" selected="true">History File (xml)</option> | |
| 264 </param> | |
| 265 </when> | |
| 266 <when value="neighbor_score"> | |
| 267 <expand macro="db_db_link_macro" name="link_select" label="Link name" /> | |
| 268 <param name="output_format" type="select" label="Output Format"> | |
| 269 <option value="xml">ID File (xml)</option> | |
| 270 <option value="json">ID File (json)</option> | |
| 271 <option value="text" selected="true">ID File (tabular)</option> | |
| 272 </param> | |
| 273 </when> | |
| 274 <when value="acheck"> | |
| 275 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 276 <param name="output_format" type="select" label="Output Format"> | |
| 277 <option value="xml" selected="True">Link Description File (xml)</option> | |
| 278 <option value="json">Link Description File (json)</option> | |
| 279 </param> | |
| 280 </when> | |
| 281 <when value="ncheck"> | |
| 282 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 283 <param name="output_format" type="select" label="Output Format"> | |
| 284 <option value="xml" selected="True">Link Description File (xml)</option> | |
| 285 <option value="json">Link Description File (json)</option> | |
| 286 </param> | |
| 287 </when> | |
| 288 <when value="lcheck"> | |
| 289 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 290 <param name="output_format" type="select" label="Output Format"> | |
| 291 <option value="xml" selected="True">Link Description File (xml)</option> | |
| 292 <option value="json">Link Description File (json)</option> | |
| 293 </param> | |
| 294 </when> | |
| 295 <when value="llinks"> | |
| 296 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 297 <param name="output_format" type="select" label="Output Format"> | |
| 298 <option value="xml" selected="True">Link Description File (xml)</option> | |
| 299 <option value="json">Link Description File (json)</option> | |
| 300 </param> | |
| 301 </when> | |
| 302 <when value="llinkslib"> | |
| 303 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 304 <param name="output_format" type="select" label="Output Format"> | |
| 305 <option value="xml" selected="true">Link Description File (xml)</option> | |
| 306 <option value="json">Link Description File (json)</option> | |
| 307 </param> | |
| 308 </when> | |
| 309 <when value="prlinks"> | |
| 310 <expand macro="db_link_macro" name="db_select_from_link" label="From NCBI Database" /> | |
| 311 <param name="output_format" type="select" label="Output Format"> | |
| 312 <option value="xml" selected="true">Link Description File (xml)</option> | |
| 313 <option value="json">Link Description File (json)</option> | |
| 314 </param> | |
| 315 </when> | |
| 316 </conditional> | |
| 317 </xml> | |
| 318 EOXML | |
| 319 | |
| 320 ## | |
| 321 ## Create selections for valid links for command types neighbor, neighbor_history, and neighbor_score | |
| 322 ## | |
| 323 | |
| 324 print << 'EOXML'; | |
| 325 <xml name="db_db_link_macro"> | |
| 326 <conditional name="db_from_link"> | |
| 327 <expand macro="dbselect_linked" name="db_select_from_link" label="From NCBI Database" /> | |
| 328 EOXML | |
| 329 | |
| 330 foreach my $from (grep {$dbfroms->{$_}} @sorted_dblist) | |
| 331 { | |
| 332 print STDERR ("Creating Links From: $from\n"); | |
| 333 | |
| 334 print << " EOXML"; | |
| 335 <when value="$from"> | |
| 336 <conditional name="db_to"> | |
| 337 <param name="db_select_to" type="select" label="To NCBI Database"> | |
| 338 EOXML | |
| 339 | |
| 340 my @dbtos = (grep {exists($h->{$from}) && exists($h->{$from}->{$_})} | |
| 341 @sorted_dblist); | |
| 342 foreach(@dbtos) | |
| 343 { | |
| 344 print << " EOXML"; | |
| 345 <option value="$_">$dbnames->{$_}</option> | |
| 346 EOXML | |
| 347 } | |
| 348 if(scalar(@dbtos) == 0) | |
| 349 { | |
| 350 #Provide an option for a self-link: from->from | |
| 351 print << " EOXML"; | |
| 352 <option value="$from">$dbnames->{$from}</option> | |
| 353 EOXML | |
| 354 } | |
| 355 | |
| 356 print << ' EOXML'; | |
| 357 </param> | |
| 358 EOXML | |
| 359 | |
| 360 if(exists($h->{$from})) | |
| 361 { | |
| 362 #There do exist links to invalid(/outdated/non-existant) databases that | |
| 363 #would result in an error if they are selected, so we use the original | |
| 364 #@dblist instead of the keys present in the sub hash of $h->{$from}, and | |
| 365 #then check for existence in the sub-hash | |
| 366 foreach my $to (grep {exists($h->{$from}->{$_})} @sorted_dblist) | |
| 367 { | |
| 368 print STDERR ("\tTo: $to Links: ", | |
| 369 join(',',map {$_->[0]} @{$h->{$from}->{$to}}), | |
| 370 "\n"); | |
| 371 | |
| 372 print << " EOXML"; | |
| 373 <when value="$to"> | |
| 374 <param name="linkname" type="select" label="Link Name"> | |
| 375 <option value="None">All Links</option> | |
| 376 EOXML | |
| 377 | |
| 378 foreach(sort {"$a->[1] ($a->[0])" cmp "$b->[1] ($b->[0])"} | |
| 379 @{$h->{$from}->{$to}}) | |
| 380 { | |
| 381 print << " EOXML"; | |
| 382 <option value="$_->[0]">$_->[1] ($_->[0])</option> | |
| 383 EOXML | |
| 384 } | |
| 385 | |
| 386 print << " EOXML"; | |
| 387 </param> | |
| 388 </when> | |
| 389 EOXML | |
| 390 | |
| 391 } | |
| 392 } | |
| 393 else | |
| 394 { | |
| 395 ## | |
| 396 ## Add-on selections for self-links for command types neighbor, | |
| 397 ## neighbor_history, and neighbor_score | |
| 398 ## Note, I'm not sure this would yield a valid result from elink | |
| 399 ## | |
| 400 | |
| 401 #This shows $from, but this is the 'when' for db_to conditional | |
| 402 print << " EOXML"; | |
| 403 <when value="$from"> | |
| 404 <param name="linkname" type="select" label="Link Name"> | |
| 405 <option value="none">All Links</option> | |
| 406 </param> | |
| 407 </when> | |
| 408 EOXML | |
| 409 } | |
| 410 | |
| 411 print << ' EOXML'; | |
| 412 </conditional> | |
| 413 </when> | |
| 414 EOXML | |
| 415 } | |
| 416 | |
| 417 ## | |
| 418 ## Add-on selections for self-links for command types neighbor, | |
| 419 ## neighbor_history, and neighbor_score | |
| 420 ## Note, I'm not sure this would yield a valid result from elink | |
| 421 ## | |
| 422 | |
| 423 foreach my $from (grep {!exists($h->{$_})} @sorted_dblist) | |
| 424 { | |
| 425 print << "EOXML"; | |
| 426 <when value=\"$from\"> | |
| 427 <conditional name=\"db_to\"> | |
| 428 <param name=\"db_select_to\" type=\"select\" label=\"To NCBI Database\"> | |
| 429 <option value=\"none\">Not applicable</option> | |
| 430 </param> | |
| 431 <when value=\"none\"> | |
| 432 <param name=\"linkname\" type=\"select\" label=\"Link Name\"> | |
| 433 <option value=\"none\">Not applicable</option> | |
| 434 </param> | |
| 435 </when> | |
| 436 </conditional> | |
| 437 </when> | |
| 438 EOXML | |
| 439 } | |
| 440 | |
| 441 ## | |
| 442 ## This is the corresponding code for using the selections to add the respective command line options | |
| 443 ## | |
| 444 | |
| 445 print << 'EOXML'; | |
| 446 </conditional> | |
| 447 </xml> | |
| 448 EOXML | |
| 449 | |
| 450 print << 'EOXML'; | |
| 451 <token name="@LINK_TOKEN@"> | |
| 452 <![CDATA[ | |
| 453 #if $cmd.db_from_link.db_to.db_select_to == 'n/a': | |
| 454 none | |
| 455 #else: | |
| 456 $cmd.db_from_link.db_to.db_select_to | |
| 457 #end if | |
| 458 | |
| 459 $cmd.db_from_link.db_select_from_link | |
| 460 | |
| 461 $cmd.cmd_select | |
| 462 | |
| 463 #if $cmd.output_format == 'json': | |
| 464 --retmode json | |
| 465 #elif $cmd.output_format == 'text': | |
| 466 --retmode uilist | |
| 467 #else: | |
| 468 --retmode xml | |
| 469 #end if | |
| 470 | |
| 471 #if $cmd.db_from_link.db_to.linkname != 'None' and $cmd.cmd_select in ('neighbor', 'neighbor_history', 'neighbor_score'): | |
| 472 --linkname $cmd.db_from_link.db_to.linkname | |
| 473 #end if | |
| 474 ]]> | |
| 475 </token> | |
| 476 EOXML | |
| 477 | |
| 478 sub startXML | |
| 479 { | |
| 480 print << ' EOXML'; | |
| 481 <?xml version="1.0"?> | |
| 482 <macros> | |
| 483 <token name="@PROFILE@">18.01</token> | |
| 484 <token name="@WRAPPER_VERSION@">1.70</token> | |
| 485 <token name="@EMAIL_ARGUMENTS@"> | |
| 486 --user_email "$__user_email__" | |
| 487 #set admin_emails = ';'.join(str($__admin_users__).split(',')) | |
| 488 --admin_email "$admin_emails" | |
| 489 </token> | |
| 490 <!-- TODO: citation --> | |
| 491 <token name="@REFERENCES@"><![CDATA[ | |
| 492 ]]></token> | |
| 493 <token name="@DISCLAIMER@"><![CDATA[ | |
| 494 Usage Guidelines and Requirements | |
| 495 ================================= | |
| 496 | |
| 497 Frequency, Timing, and Registration of E-utility URL Requests | |
| 498 ------------------------------------------------------------- | |
| 499 | |
| 500 In order not to overload the E-utility servers, NCBI recommends that users | |
| 501 limit large jobs to either weekends or between 9:00 PM and 5:00 AM Eastern time | |
| 502 during weekdays. Failure to comply with this policy may result in an IP address | |
| 503 being blocked from accessing NCBI. | |
| 504 | |
| 505 Minimizing the Number of Requests | |
| 506 --------------------------------- | |
| 507 | |
| 508 If a task requires searching for and/or downloading a large number of | |
| 509 records, it is much more efficient to use the Entrez History to upload | |
| 510 and/or retrieve these records in batches rather than using separate | |
| 511 requests for each record. Please refer to Application 3 in Chapter 3 | |
| 512 for an example. Many thousands of IDs can be uploaded using a single | |
| 513 EPost request, and several hundred records can be downloaded using one | |
| 514 EFetch request. | |
| 515 | |
| 516 | |
| 517 Disclaimer and Copyright Issues | |
| 518 ------------------------------- | |
| 519 | |
| 520 In accordance with requirements of NCBI's E-Utilities, we must provide | |
| 521 the following disclaimer: | |
| 522 | |
| 523 Please note that abstracts in PubMed may incorporate material that may | |
| 524 be protected by U.S. and foreign copyright laws. All persons | |
| 525 reproducing, redistributing, or making commercial use of this | |
| 526 information are expected to adhere to the terms and conditions asserted | |
| 527 by the copyright holder. Transmission or reproduction of protected | |
| 528 items beyond that allowed by fair use (PDF) as defined in the copyright | |
| 529 laws requires the written permission of the copyright owners. NLM | |
| 530 provides no legal advice concerning distribution of copyrighted | |
| 531 materials. Please consult your legal counsel. If you wish to do a large | |
| 532 data mining project on PubMed data, you can enter into a licensing | |
| 533 agreement and lease the data for free from NLM. For more information on | |
| 534 this please see `https://www.nlm.nih.gov/databases/download/data_distrib_main.html <https://www.nlm.nih.gov/databases/download/data_distrib_main.html>`__ | |
| 535 | |
| 536 The `full disclaimer <https://www.ncbi.nlm.nih.gov/home/about/policies/>`__ is available on | |
| 537 their website | |
| 538 | |
| 539 Liability | |
| 540 ~~~~~~~~~ | |
| 541 | |
| 542 For documents and software available from this server, the | |
| 543 U.S. Government does not warrant or assume any legal liability or | |
| 544 responsibility for the accuracy, completeness, or usefulness of any | |
| 545 information, apparatus, product, or process disclosed. | |
| 546 | |
| 547 Endorsement | |
| 548 ~~~~~~~~~~~ | |
| 549 | |
| 550 NCBI does not endorse or recommend any commercial | |
| 551 products, processes, or services. The views and opinions of authors | |
| 552 expressed on NCBI's Web sites do not necessarily state or reflect those | |
| 553 of the U.S. Government, and they may not be used for advertising or | |
| 554 product endorsement purposes. | |
| 555 | |
| 556 External Links | |
| 557 ~~~~~~~~~~~~~~ | |
| 558 | |
| 559 Some NCBI Web pages may provide links to other Internet | |
| 560 sites for the convenience of users. NCBI is not responsible for the | |
| 561 availability or content of these external sites, nor does NCBI endorse, | |
| 562 warrant, or guarantee the products, services, or information described | |
| 563 or offered at these other Internet sites. Users cannot assume that the | |
| 564 external sites will abide by the same Privacy Policy to which NCBI | |
| 565 adheres. It is the responsibility of the user to examine the copyright | |
| 566 and licensing restrictions of linked pages and to secure all necessary | |
| 567 permissions. | |
| 568 ]]></token> | |
| 569 <token name="@LIST_OR_HIST@"> | |
| 570 #if $query_source.qss == "history_json": | |
| 571 --history_file $query_source.history_file | |
| 572 #else if $query_source.qss == "history_xml": | |
| 573 --history_xml $query_source.history_xml | |
| 574 #else if $query_source.qss == "id_file": | |
| 575 --id_list $query_source.id_file | |
| 576 #else if $query_source.qss == "id_list": | |
| 577 --id $query_source.id_list | |
| 578 #else if $query_source.qss == "id_xml": | |
| 579 --id_xml $query_source.id_xml | |
| 580 #else if $query_source.qss == "id_json": | |
| 581 --id_json $query_source.id_json | |
| 582 #end if | |
| 583 </token> | |
| 584 <xml name="list_or_hist"> | |
| 585 <conditional name="query_source"> | |
| 586 <param name="qss" type="select" label="Enter Query IDs by..." help="Files output by ELink or ESearch are acceptable. Query IDs in an ELink result are ignored."> | |
| 587 <option value="history_json">History File (JSON)</option> | |
| 588 <option value="history_xml">History File (XML)</option> | |
| 589 <option value="id_file" selected="True">ID file (Tabular)</option> | |
| 590 <option value="id_xml">ID File (XML)</option> | |
| 591 <option value="id_json">ID File (JSON)</option> | |
| 592 <option value="id_list">Paste IDs</option> | |
| 593 </param> | |
| 594 <when value="history_json"> | |
| 595 <param label="History File (JSON)" name="history_file" type="data" format="json" help="A JSON file containing the WebEnv ID and Query Key referencing the search on the NCBI history server"/> | |
| 596 </when> | |
| 597 <when value="history_xml"> | |
| 598 <param label="History File (XML)" name="history_xml" type="data" format="xml" help="An XML file containing the WebEnv ID and Query Key referencing the search on the NCBI history server"/> | |
| 599 </when> | |
| 600 <when value="id_file"> | |
| 601 <param label="ID File (Text)" name="id_file" type="data" format="text,tabular" help="A Text file containing one ID per line"/> | |
| 602 </when> | |
| 603 <when value="id_xml"> | |
| 604 <param label="ID File (XML)" name="id_xml" type="data" format="xml" help="ESearch or ELink Result XML file"/> | |
| 605 </when> | |
| 606 <when value="id_json"> | |
| 607 <param label="ID File (JSON)" name="id_json" type="data" format="json" help="ESearch or ELink Result JSON file"/> | |
| 608 </when> | |
| 609 <when value="id_list"> | |
| 610 <param label="Paste ID List" name="id_list" type="text" area="true" help="Newline/Comma separated list of IDs"/> | |
| 611 </when> | |
| 612 </conditional> | |
| 613 </xml> | |
| 614 <xml name="citations"> | |
| 615 <citations> | |
| 616 <citation type="bibtex">@Book{ncbiEutils, | |
| 617 author = {Eric Sayers}, | |
| 618 title = {Entrez Programming Utilities Help}, | |
| 619 year = {2010}, | |
| 620 publisher = {National Center for Biotechnology Information, Bethesda, Maryland}, | |
| 621 note = {https://www.ncbi.nlm.nih.gov/books/NBK25500/} | |
| 622 }</citation> | |
| 623 </citations> | |
| 624 </xml> | |
| 625 <xml name="requirements"> | |
| 626 <requirements> | |
| 627 <requirement type="package" version="1.70">biopython</requirement> | |
| 628 </requirements> | |
| 629 </xml> | |
| 630 <token name="@EFETCH_FORMAT_TOKEN@"> | |
| 631 <![CDATA[ | |
| 632 | |
| 633 ## This token must go at the end of the efetch command | |
| 634 | |
| 635 #set rettype, retmode, format = str($db.output_format).split('-') | |
| 636 | |
| 637 #if retmode != "none": | |
| 638 --retmode $retmode | |
| 639 #end if | |
| 640 ## Otherwise, defaults to a None/empty which implies 'default' to NCBI | |
| 641 | |
| 642 #if rettype != "none": | |
| 643 --rettype $rettype | |
| 644 #end if | |
| 645 | |
| 646 --galaxy_format $format | |
| 647 | |
| 648 ]]> | |
| 649 </token> | |
| 650 EOXML | |
| 651 } | |
| 652 | |
| 653 sub endXML | |
| 654 { | |
| 655 print << ' EOXML'; | |
| 656 </macros> | |
| 657 EOXML | |
| 658 } | |
| 659 | |
| 660 BEGIN {startXML()} | |
| 661 END {endXML()} | |
| 662 | |
| 663 | |
| 664 ## | |
| 665 ## Output formats for efetch mapped to galaxy formats | |
| 666 ## | |
| 667 | |
| 668 #Based on: | |
| 669 #https://www.ncbi.nlm.nih.gov/books/NBK25499/table/chapter4.T._valid_values_of__retmode_and/?report=objectonly | |
| 670 | |
| 671 #Note: While json works for esearch and elink, the only database that supports | |
| 672 #json (according to an NLM support ticket I have about this) is snp | |
| 673 | |
| 674 #The output_format param value for these will be "rettype-retmode-format" | |
| 675 | |
| 676 #db galaxy retmode rettype format_name | |
| 677 __DATA__ | |
| 678 bioproject tabular text uilist List of UIDs | |
| 679 bioproject xml xml docsum Document summary | |
| 680 bioproject xml xml uilist List of UIDs | |
| 681 bioproject xml xml xml Full record | |
| 682 biosample tabular text uilist List of UIDs | |
| 683 biosample txt text full Full record | |
| 684 biosample xml xml docsum Document summary | |
| 685 biosample xml xml full Full record | |
| 686 biosample xml xml uilist List of UIDs | |
| 687 biosystems tabular text uilist List of UIDs | |
| 688 biosystems xml xml docsum Document summary | |
| 689 biosystems xml xml uilist List of UIDs | |
| 690 biosystems xml xml xml Full record | |
| 691 clinvar tabular text uilist List of UIDs | |
| 692 clinvar xml xml clinvarset ClinVar Set | |
| 693 clinvar xml xml docsum Document summary | |
| 694 clinvar xml xml uilist List of UIDs | |
| 695 clinvar xml none none Full | |
| 696 gds tabular text uilist List of UIDs | |
| 697 gds txt text summary Summary | |
| 698 gds xml xml docsum Document summary | |
| 699 gds xml xml uilist List of UIDs | |
| 700 gds xml none none Full | |
| 701 gene txt text gene_table Gene table | |
| 702 gene tabular text uilist List of UIDs | |
| 703 gene txt asn.1 none text ASN.1 | |
| 704 gene xml xml docsum Document summary | |
| 705 gene xml xml none Full | |
| 706 gene xml xml uilist List of UIDs | |
| 707 gtr tabular text uilist List of UIDs | |
| 708 gtr xml xml docsum Document summary | |
| 709 gtr xml xml gtracc GTR Test Report | |
| 710 gtr xml xml uilist List of UIDs | |
| 711 gtr xml none none Full | |
| 712 homologene fasta text fasta FASTA | |
| 713 homologene tabular text alignmentscores Alignment scores | |
| 714 homologene tabular text uilist List of UIDs | |
| 715 homologene txt asn.1 none text ASN.1 | |
| 716 homologene txt text homologene HomoloGene | |
| 717 homologene xml xml docsum Document summary | |
| 718 homologene xml xml none Full | |
| 719 homologene xml xml uilist List of UIDs | |
| 720 mesh tabular text uilist List of UIDs | |
| 721 mesh txt text full Full record | |
| 722 mesh xml xml docsum Document summary | |
| 723 mesh xml xml uilist List of UIDs | |
| 724 nlmcatalog tabular text uilist List of UIDs | |
| 725 nlmcatalog txt text none Full record | |
| 726 nlmcatalog xml xml docsum Document summary | |
| 727 nlmcatalog xml xml none Full | |
| 728 nlmcatalog xml xml uilist List of UIDs | |
| 729 nuccore binary asn.1 none binary ASN.1 | |
| 730 nuccore fasta text fasta FASTA | |
| 731 nuccore fasta text fasta_cds_aa CDS protein FASTA | |
| 732 nuccore fasta text fasta_cds_na CDS nucleotide FASTA | |
| 733 nuccore genbank text gb GenBank flat file | |
| 734 nuccore genbank text gbwithparts GenBank flat file with full sequence (contigs) | |
| 735 nuccore tabular text acc Accession number(s) | |
| 736 nuccore txt text ft Feature table | |
| 737 nuccore tabular text seqid SeqID string | |
| 738 nuccore tabular text uilist List of UIDs | |
| 739 nuccore txt text none text ASN.1 | |
| 740 nuccore xml xml docsum Document summary | |
| 741 nuccore xml xml fasta TinySeq | |
| 742 nuccore xml xml gb GBSeq | |
| 743 nuccore xml xml gbc INSDSeq | |
| 744 nuccore xml xml native Full record | |
| 745 nuccore xml xml uilist List of UIDs | |
| 746 nucest binary asn.1 none binary ASN.1 | |
| 747 nucest fasta text fasta FASTA | |
| 748 nucest genbank text gb GenBank flat file | |
| 749 nucest tabular text acc Accession number(s) | |
| 750 nucest tabular text seqid SeqID string | |
| 751 nucest tabular text uilist List of UIDs | |
| 752 nucest txt text est EST report | |
| 753 nucest txt text none text ASN.1 | |
| 754 nucest xml xml docsum Document summary | |
| 755 nucest xml xml fasta TinySeq | |
| 756 nucest xml xml gb GBSeq | |
| 757 nucest xml xml gbc INSDSeq | |
| 758 nucest xml xml native Full record | |
| 759 nucest xml xml uilist List of UIDs | |
| 760 nucgss binary asn.1 none binary ASN.1 | |
| 761 nucgss fasta text fasta FASTA | |
| 762 nucgss genbank text gb GenBank flat file | |
| 763 nucgss tabular text acc Accession number(s) | |
| 764 nucgss tabular text seqid SeqID string | |
| 765 nucgss tabular text uilist List of UIDs | |
| 766 nucgss txt text gss GSS report | |
| 767 nucgss txt text none text ASN.1 | |
| 768 nucgss xml xml docsum Document summary | |
| 769 nucgss xml xml fasta TinySeq | |
| 770 nucgss xml xml gb GBSeq | |
| 771 nucgss xml xml gbc INSDSeq | |
| 772 nucgss xml xml native Full record | |
| 773 nucgss xml xml uilist List of UIDs | |
| 774 pmc tabular text uilist List of UIDs | |
| 775 pmc txt text medline MEDLINE | |
| 776 pmc xml xml docsum Document summary | |
| 777 pmc xml xml none FULL | |
| 778 pmc xml xml uilist List of UIDs | |
| 779 popset binary asn.1 none binary ASN.1 | |
| 780 popset fasta text fasta FASTA | |
| 781 popset genbank text gb GenBank flat file | |
| 782 popset tabular text acc Accession number(s) | |
| 783 popset tabular text seqid SeqID string | |
| 784 popset tabular text uilist List of UIDs | |
| 785 popset txt text none text ASN.1 | |
| 786 popset xml xml docsum Document summary | |
| 787 popset xml xml fasta TinySeq | |
| 788 popset xml xml gb GBSeq | |
| 789 popset xml xml gbc INSDSeq | |
| 790 popset xml xml native Full record | |
| 791 popset xml xml uilist List of UIDs | |
| 792 protein binary asn.1 none binary ASN.1 | |
| 793 protein fasta text fasta FASTA | |
| 794 protein tabular text acc Accession number(s) | |
| 795 protein txt text ft Feature table | |
| 796 protein tabular text seqid SeqID string | |
| 797 protein tabular text uilist List of UIDs | |
| 798 protein txt text gp GenPept flat file | |
| 799 protein txt text none text ASN.1 | |
| 800 protein xml xml docsum Document summary | |
| 801 protein xml xml fasta TinySeq | |
| 802 protein xml xml gp GBSeq | |
| 803 protein xml xml gpc INSDSeq | |
| 804 protein xml xml ipg Identical Protein | |
| 805 protein xml xml native Full record | |
| 806 protein xml xml uilist List of UIDs | |
| 807 pubmed tabular text uilist List of UIDs | |
| 808 pubmed txt asn.1 none text ASN.1 | |
| 809 pubmed txt text abstract Abstract | |
| 810 pubmed txt text medline MEDLINE | |
| 811 pubmed xml xml docsum Document summary | |
| 812 pubmed xml xml none Full | |
| 813 pubmed xml xml uilist List of UIDs | |
| 814 sequences fasta text fasta FASTA | |
| 815 sequences tabular text acc Accession number(s) | |
| 816 sequences tabular text seqid SeqID string | |
| 817 sequences tabular text uilist List of UIDs | |
| 818 sequences txt text none text ASN.1 | |
| 819 sequences xml xml docsum Document summary | |
| 820 sequences xml xml uilist List of UIDs | |
| 821 sequences xml none none Full | |
| 822 snp fasta text fasta FASTA | |
| 823 snp json json docsum Document summary | |
| 824 snp json json uilist List of UIDs | |
| 825 snp tabular text ssexemplar SS Exemplar list | |
| 826 snp tabular text uilist List of UIDs | |
| 827 snp txt asn.1 none text ASN.1 | |
| 828 snp txt text chr Chromosome report | |
| 829 snp txt text docset Summary | |
| 830 snp txt text flt Flat file | |
| 831 snp txt text rsr RS Cluster report | |
| 832 snp xml xml docsum Document summary | |
| 833 snp xml xml none XML | |
| 834 snp xml xml uilist List of UIDs | |
| 835 sra tabular text uilist List of UIDs | |
| 836 sra xml xml docsum Document summary | |
| 837 sra xml xml full Full | |
| 838 taxonomy tabular text uilist List of UIDs | |
| 839 taxonomy xml xml none Full | |
| 840 taxonomy xml xml docsum Document summary | |
| 841 taxonomy xml xml uilist List of UIDs |
