| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# =========================================================================== |
| 4 |
# |
| 5 |
# PUBLIC DOMAIN NOTICE |
| 6 |
# National Center for Biotechnology Information (NCBI) |
| 7 |
# |
| 8 |
# This software/database is a "United States Government Work" under the |
| 9 |
# terms of the United States Copyright Act. It was written as part of |
| 10 |
# the author's official duties as a United States Government employee and |
| 11 |
# thus cannot be copyrighted. This software/database is freely available |
| 12 |
# to the public for use. The National Library of Medicine and the U.S. |
| 13 |
# Government do not place any restriction on its use or reproduction. |
| 14 |
# We would, however, appreciate having the NCBI and the author cited in |
| 15 |
# any work or product based on this material. |
| 16 |
# |
| 17 |
# Although all reasonable efforts have been taken to ensure the accuracy |
| 18 |
# and reliability of the software and data, the NLM and the U.S. |
| 19 |
# Government do not and cannot warrant the performance or results that |
| 20 |
# may be obtained by using this software or data. The NLM and the U.S. |
| 21 |
# Government disclaim all warranties, express or implied, including |
| 22 |
# warranties of performance, merchantability or fitness for any particular |
| 23 |
# purpose. |
| 24 |
# |
| 25 |
# =========================================================================== |
| 26 |
# |
| 27 |
# File Name: efetch |
| 28 |
# |
| 29 |
# Author: Jonathan Kans, Aaron Ucko |
| 30 |
# |
| 31 |
# Version Creation Date: 04/08/2020 |
| 32 |
# |
| 33 |
# ========================================================================== |
| 34 |
|
| 35 |
pth=$( dirname "$0" ) |
| 36 |
|
| 37 |
case "$pth" in |
| 38 |
/* ) |
| 39 |
;; # already absolute |
| 40 |
* ) |
| 41 |
pth=$(cd "$pth" && pwd) |
| 42 |
;; |
| 43 |
esac |
| 44 |
|
| 45 |
case ":$PATH:" in |
| 46 |
*:"$pth":* ) |
| 47 |
;; |
| 48 |
* ) |
| 49 |
PATH="$PATH:$pth" |
| 50 |
export PATH |
| 51 |
;; |
| 52 |
esac |
| 53 |
|
| 54 |
# handle common flags - dot command is equivalent of "source" |
| 55 |
|
| 56 |
if [ ! -f "$pth"/ecommon.sh ] |
| 57 |
then |
| 58 |
echo "ERROR: Unable to find '$pth/ecommon.sh' file" >&2 |
| 59 |
exit 1 |
| 60 |
fi |
| 61 |
|
| 62 |
. "$pth"/ecommon.sh |
| 63 |
|
| 64 |
# initialize specific flags |
| 65 |
|
| 66 |
internal=false |
| 67 |
|
| 68 |
isDocsum=false |
| 69 |
|
| 70 |
format="" |
| 71 |
mode="" |
| 72 |
style="" |
| 73 |
|
| 74 |
chunk=1 |
| 75 |
force=0 |
| 76 |
min=0 |
| 77 |
max=0 |
| 78 |
|
| 79 |
seq_start=0 |
| 80 |
seq_stop=0 |
| 81 |
strand=0 |
| 82 |
complexity=0 |
| 83 |
extend=-1 |
| 84 |
extrafeat=-1 |
| 85 |
showgaps="" |
| 86 |
|
| 87 |
isTextASN=false |
| 88 |
isBinaryASN=false |
| 89 |
|
| 90 |
json=false |
| 91 |
|
| 92 |
# read command-line arguments |
| 93 |
|
| 94 |
while [ $# -gt 0 ] |
| 95 |
do |
| 96 |
tag="$1" |
| 97 |
rem="$#" |
| 98 |
case "$tag" in |
| 99 |
-internal ) |
| 100 |
internal=true |
| 101 |
shift |
| 102 |
;; |
| 103 |
-newmode | -oldmode ) |
| 104 |
shift |
| 105 |
;; |
| 106 |
-db ) |
| 107 |
shift |
| 108 |
if [ $# -gt 0 ] |
| 109 |
then |
| 110 |
if [ -n "$db" ] |
| 111 |
then |
| 112 |
if [ "$db" = "$1" ] |
| 113 |
then |
| 114 |
DisplayWarning "Redundant -db '$1' argument" |
| 115 |
else |
| 116 |
DisplayError "Colliding -db '$db' and '$1' arguments" |
| 117 |
# exit 1 |
| 118 |
fi |
| 119 |
fi |
| 120 |
db="$1" |
| 121 |
shift |
| 122 |
else |
| 123 |
DisplayError "Missing -db argument" |
| 124 |
exit 1 |
| 125 |
fi |
| 126 |
;; |
| 127 |
-id ) |
| 128 |
CheckForArgumentValue "$tag" "$rem" |
| 129 |
shift |
| 130 |
ids="$1" |
| 131 |
shift |
| 132 |
while [ $# -gt 0 ] |
| 133 |
do |
| 134 |
case "$1" in |
| 135 |
-* ) |
| 136 |
break |
| 137 |
;; |
| 138 |
* ) |
| 139 |
# concatenate run of UIDs with commas |
| 140 |
ids="$ids,$1" |
| 141 |
shift |
| 142 |
;; |
| 143 |
esac |
| 144 |
done |
| 145 |
;; |
| 146 |
-format ) |
| 147 |
shift |
| 148 |
if [ $# -gt 0 ] |
| 149 |
then |
| 150 |
if [ -n "$format" ] |
| 151 |
then |
| 152 |
if [ "$isDocsum" = true ] && [ "$1" = "docsum" ] |
| 153 |
then |
| 154 |
DisplayWarning "esummary does not need redundant -format docsum argument" |
| 155 |
elif [ "$format" = "$1" ] |
| 156 |
then |
| 157 |
DisplayWarning "Redundant -format '$1' argument" |
| 158 |
else |
| 159 |
DisplayError "Colliding -format '$format' and '$1' arguments" |
| 160 |
# exit 1 |
| 161 |
fi |
| 162 |
fi |
| 163 |
format="$1" |
| 164 |
shift |
| 165 |
else |
| 166 |
DisplayError "Missing -format argument" |
| 167 |
exit 1 |
| 168 |
fi |
| 169 |
;; |
| 170 |
-docsum ) |
| 171 |
# esummary is implemented as efetch -docsum "$@" |
| 172 |
if [ -n "$format" ] |
| 173 |
then |
| 174 |
if [ "$format" = "docsum" ] |
| 175 |
then |
| 176 |
DisplayWarning "Superflouous -docsum argument" |
| 177 |
else |
| 178 |
DisplayError "Colliding -docsum and -format '$format' arguments" |
| 179 |
# exit 1 |
| 180 |
fi |
| 181 |
fi |
| 182 |
format="docsum" |
| 183 |
isDocsum=true |
| 184 |
shift |
| 185 |
;; |
| 186 |
-mode ) |
| 187 |
CheckForArgumentValue "$tag" "$rem" |
| 188 |
shift |
| 189 |
mode="$1" |
| 190 |
shift |
| 191 |
;; |
| 192 |
-style ) |
| 193 |
CheckForArgumentValue "$tag" "$rem" |
| 194 |
shift |
| 195 |
style="$1" |
| 196 |
shift |
| 197 |
;; |
| 198 |
-seq_start ) |
| 199 |
CheckForArgumentValue "$tag" "$rem" |
| 200 |
shift |
| 201 |
# 1-based |
| 202 |
seq_start=$(( $1 )) |
| 203 |
shift |
| 204 |
;; |
| 205 |
-chr_start ) |
| 206 |
CheckForArgumentValue "$tag" "$rem" |
| 207 |
shift |
| 208 |
# 0-based |
| 209 |
seq_start=$(( $1 + 1 )) |
| 210 |
shift |
| 211 |
;; |
| 212 |
-seq_stop ) |
| 213 |
CheckForArgumentValue "$tag" "$rem" |
| 214 |
shift |
| 215 |
# 1-based |
| 216 |
seq_stop=$(( $1 )) |
| 217 |
shift |
| 218 |
;; |
| 219 |
-chr_stop ) |
| 220 |
CheckForArgumentValue "$tag" "$rem" |
| 221 |
shift |
| 222 |
# 0-based |
| 223 |
seq_stop=$(( $1 + 1 )) |
| 224 |
shift |
| 225 |
;; |
| 226 |
-strand ) |
| 227 |
shift |
| 228 |
if [ $# -gt 0 ] |
| 229 |
then |
| 230 |
case "$1" in |
| 231 |
forward | plus | 1 | "\+" ) |
| 232 |
strand=1 |
| 233 |
;; |
| 234 |
revcomp | reverse | minus | 2 | "\-" ) |
| 235 |
strand=2 |
| 236 |
;; |
| 237 |
* ) |
| 238 |
DisplayError "Unrecognized -strand argument '$strand'" |
| 239 |
exit 1 |
| 240 |
;; |
| 241 |
esac |
| 242 |
shift |
| 243 |
else |
| 244 |
DisplayError "Missing -strand argument" |
| 245 |
exit 1 |
| 246 |
fi |
| 247 |
;; |
| 248 |
-forward | -plus ) |
| 249 |
strand=1 |
| 250 |
shift |
| 251 |
;; |
| 252 |
-revcomp | -reverse | -minus ) |
| 253 |
strand=2 |
| 254 |
shift |
| 255 |
;; |
| 256 |
-h | -help | --help | help ) |
| 257 |
newVersion=$( NewerEntrezDirectVersion ) |
| 258 |
if [ "$isDocsum" = true ] |
| 259 |
then |
| 260 |
echo "esummary $version" |
| 261 |
echo "" |
| 262 |
if [ -n "$newVersion" ] |
| 263 |
then |
| 264 |
DisplayNote "EDirect version ${newVersion} is now available" |
| 265 |
echo "" >&2 |
| 266 |
cat "$pth/help/esummary-help.txt" |
| 267 |
echo "" |
| 268 |
DisplayNote "EDirect version ${newVersion} is now available" |
| 269 |
echo "" >&2 |
| 270 |
else |
| 271 |
cat "$pth/help/esummary-help.txt" |
| 272 |
echo "" |
| 273 |
fi |
| 274 |
else |
| 275 |
echo "efetch $version" |
| 276 |
echo "" |
| 277 |
if [ -n "$newVersion" ] |
| 278 |
then |
| 279 |
DisplayNote "EDirect version ${newVersion} is now available" |
| 280 |
echo "" >&2 |
| 281 |
cat "$pth/help/efetch-help.txt" |
| 282 |
echo "" |
| 283 |
DisplayNote "EDirect version ${newVersion} is now available" |
| 284 |
echo "" >&2 |
| 285 |
else |
| 286 |
cat "$pth/help/efetch-help.txt" |
| 287 |
echo "" |
| 288 |
fi |
| 289 |
fi |
| 290 |
exit 0 |
| 291 |
;; |
| 292 |
-chunk ) |
| 293 |
CheckForArgumentValue "$tag" "$rem" |
| 294 |
shift |
| 295 |
# override calculated chunk value (undocumented) |
| 296 |
force=$(( $1 )) |
| 297 |
shift |
| 298 |
;; |
| 299 |
-start ) |
| 300 |
CheckForArgumentValue "$tag" "$rem" |
| 301 |
shift |
| 302 |
min=$(( $1 )) |
| 303 |
shift |
| 304 |
;; |
| 305 |
-stop ) |
| 306 |
CheckForArgumentValue "$tag" "$rem" |
| 307 |
shift |
| 308 |
max=$(( $1 )) |
| 309 |
shift |
| 310 |
;; |
| 311 |
-complexity ) |
| 312 |
CheckForArgumentValue "$tag" "$rem" |
| 313 |
shift |
| 314 |
complexity=$(( $1 )) |
| 315 |
shift |
| 316 |
;; |
| 317 |
-extend ) |
| 318 |
CheckForArgumentValue "$tag" "$rem" |
| 319 |
shift |
| 320 |
extend=$(( $1 )) |
| 321 |
shift |
| 322 |
;; |
| 323 |
-extrafeat ) |
| 324 |
CheckForArgumentValue "$tag" "$rem" |
| 325 |
shift |
| 326 |
extrafeat=$(( $1 )) |
| 327 |
shift |
| 328 |
;; |
| 329 |
-showgaps | -show-gaps ) |
| 330 |
showgaps="on" |
| 331 |
shift |
| 332 |
;; |
| 333 |
-json ) |
| 334 |
json=true |
| 335 |
shift |
| 336 |
;; |
| 337 |
-* ) |
| 338 |
ParseCommonArgs "$@" |
| 339 |
if [ "$argsConsumed" -gt 0 ] |
| 340 |
then |
| 341 |
shift "$argsConsumed" |
| 342 |
else |
| 343 |
DisplayError "Unrecognized option $1" |
| 344 |
exit 1 |
| 345 |
fi |
| 346 |
;; |
| 347 |
* ) |
| 348 |
DisplayError "Unrecognized argument $1" |
| 349 |
shift |
| 350 |
;; |
| 351 |
esac |
| 352 |
done |
| 353 |
|
| 354 |
FinishSetup |
| 355 |
|
| 356 |
# check for ENTREZ_DIRECT message or piped UIDs unless database and UIDs provided in command line |
| 357 |
|
| 358 |
if [ -z "$db" ] |
| 359 |
then |
| 360 |
ParseStdin |
| 361 |
elif [ -z "$ids" ] && [ -z "$input" ] |
| 362 |
then |
| 363 |
ParseStdin |
| 364 |
fi |
| 365 |
|
| 366 |
if [ -z "$ids$rest$qury$input" ] |
| 367 |
then |
| 368 |
needHistory=true |
| 369 |
fi |
| 370 |
|
| 371 |
# reality check for -db against piped dbase |
| 372 |
|
| 373 |
if [ -n "$dbase" ] && [ -n "$db" ] |
| 374 |
then |
| 375 |
if [ "$dbase" = "$db" ] |
| 376 |
then |
| 377 |
DisplayWarning "Redundant -db '$db' argument" |
| 378 |
else |
| 379 |
DisplayError "Colliding '$dbase' database and -db '$db' argument" |
| 380 |
# exit 1 |
| 381 |
fi |
| 382 |
fi |
| 383 |
|
| 384 |
# take database from dbase value or -db argument |
| 385 |
|
| 386 |
if [ -z "$dbase" ] |
| 387 |
then |
| 388 |
dbase="$db" |
| 389 |
fi |
| 390 |
|
| 391 |
if [ "$dbase" = "nucleotide" ] |
| 392 |
then |
| 393 |
dbase="nuccore" |
| 394 |
fi |
| 395 |
|
| 396 |
# check for missing required arguments |
| 397 |
|
| 398 |
if [ -z "$dbase" ] |
| 399 |
then |
| 400 |
DisplayError "Missing -db argument" |
| 401 |
exit 1 |
| 402 |
fi |
| 403 |
|
| 404 |
# normalize to lower-case (e.g., SRA -> sra) |
| 405 |
|
| 406 |
dbase=$( echo "$dbase" | tr '[:upper:]' '[:lower:]' ) |
| 407 |
|
| 408 |
# take optional days and datetype arguments from message |
| 409 |
|
| 410 |
if [ -z "$reldate" ] && [ -n "$reldatex" ] |
| 411 |
then |
| 412 |
reldate="$reldatex" |
| 413 |
fi |
| 414 |
if [ -z "$mindate" ] && [ -n "$mindatex" ] |
| 415 |
then |
| 416 |
mindate="$mindatex" |
| 417 |
fi |
| 418 |
if [ -z "$maxdate" ] && [ -n "$maxdatex" ] |
| 419 |
then |
| 420 |
maxdate="$maxdatex" |
| 421 |
fi |
| 422 |
if [ -z "$datetype" ] && [ -n "$datetypex" ] |
| 423 |
then |
| 424 |
datetype="$datetypex" |
| 425 |
fi |
| 426 |
|
| 427 |
# normalize date arguments |
| 428 |
|
| 429 |
FixDateConstraints |
| 430 |
|
| 431 |
# convert spaces between UIDs to commas |
| 432 |
|
| 433 |
ids=$( echo "$ids" | sed -e "s/ /,/g; s/,,*/,/g" ) |
| 434 |
|
| 435 |
# database and format class flags |
| 436 |
|
| 437 |
isSequence=false |
| 438 |
isNucleotide=false |
| 439 |
isFasta=false |
| 440 |
|
| 441 |
case "$dbase" in |
| 442 |
nucleotide | nuccore ) |
| 443 |
isSequence=true |
| 444 |
isNucleotide=true |
| 445 |
;; |
| 446 |
protein ) |
| 447 |
isSequence=true |
| 448 |
;; |
| 449 |
esac |
| 450 |
|
| 451 |
case "$format" in |
| 452 |
*fasta* ) |
| 453 |
isFasta=true |
| 454 |
;; |
| 455 |
esac |
| 456 |
|
| 457 |
# adjust for -db pubmed |
| 458 |
|
| 459 |
pubmedAPA=false |
| 460 |
pubmedASN=false |
| 461 |
|
| 462 |
if [ "$dbase" = "pubmed" ] |
| 463 |
then |
| 464 |
if [ -z "$format" ] || [ "$format" = "native" ] |
| 465 |
then |
| 466 |
format="full" |
| 467 |
mode="xml" |
| 468 |
fi |
| 469 |
if [ "$format" = "apa" ] |
| 470 |
then |
| 471 |
format="full" |
| 472 |
mode="xml" |
| 473 |
pubmedAPA=true |
| 474 |
fi |
| 475 |
if [ "$format" = "asn" ] || [ "$format" = "asn.1" ] || [ "$format" = "asn1" ] |
| 476 |
then |
| 477 |
format="full" |
| 478 |
mode="xml" |
| 479 |
pubmedASN=true |
| 480 |
fi |
| 481 |
fi |
| 482 |
|
| 483 |
# adjust for -db clinvar |
| 484 |
|
| 485 |
is_variationid=false |
| 486 |
|
| 487 |
if [ "$dbase" = "clinvar" ] && [ "$format" = "variationid" ] |
| 488 |
then |
| 489 |
format="vcv" |
| 490 |
is_variationid=true |
| 491 |
fi |
| 492 |
|
| 493 |
# adjust for -db sra |
| 494 |
|
| 495 |
if [ "$dbase" = "sra" ] |
| 496 |
then |
| 497 |
if [ -z "$format" ] |
| 498 |
then |
| 499 |
format="runinfo" |
| 500 |
elif [ "$format" = "full" ] |
| 501 |
then |
| 502 |
mode="xml" |
| 503 |
elif [ "$format" = "native" ] |
| 504 |
then |
| 505 |
format="full" |
| 506 |
mode="xml" |
| 507 |
fi |
| 508 |
fi |
| 509 |
|
| 510 |
# adjust for sequence databases - asn.1 to asn temporarily for special case matching |
| 511 |
|
| 512 |
if [ "$isSequence" = true ] |
| 513 |
then |
| 514 |
if [ "$format" = "asn.1" ] || [ "$format" = "asn1" ] |
| 515 |
then |
| 516 |
format="asn" |
| 517 |
fi |
| 518 |
if [ "$mode" = "asn.1" ] || [ "$mode" = "asn1" ] |
| 519 |
then |
| 520 |
mode="asn" |
| 521 |
fi |
| 522 |
fi |
| 523 |
|
| 524 |
# special cases for format, mode, and style |
| 525 |
|
| 526 |
case "$format:$mode:$isSequence" in |
| 527 |
xml::* ) |
| 528 |
format="full" |
| 529 |
mode="xml" |
| 530 |
;; |
| 531 |
accn:*:true ) |
| 532 |
format="acc" |
| 533 |
;; |
| 534 |
asn:binary:true ) |
| 535 |
format="native" |
| 536 |
mode="asn.1" |
| 537 |
immediate=true |
| 538 |
isBinaryASN=true |
| 539 |
;; |
| 540 |
asn:*:true ) |
| 541 |
format="native" |
| 542 |
mode="text" |
| 543 |
immediate=true |
| 544 |
isTextASN=true |
| 545 |
;; |
| 546 |
asn:* ) |
| 547 |
format="asn.1" |
| 548 |
immediate=true |
| 549 |
;; |
| 550 |
gbf:*:true ) |
| 551 |
format="gb" |
| 552 |
;; |
| 553 |
gpf:*:true ) |
| 554 |
format="gp" |
| 555 |
;; |
| 556 |
esac |
| 557 |
|
| 558 |
case "$style" in |
| 559 |
normal | none | contig ) |
| 560 |
style="" |
| 561 |
;; |
| 562 |
master ) |
| 563 |
style="master" |
| 564 |
;; |
| 565 |
conwithfeat | conwithfeats | contigwithfeat | gbconwithfeat | gbconwithfeats ) |
| 566 |
style="conwithfeat" |
| 567 |
;; |
| 568 |
withpart | withparts | gbwithpart | gbwithparts ) |
| 569 |
# accept from old scripts - same result as style master |
| 570 |
style="withparts" |
| 571 |
;; |
| 572 |
"" ) |
| 573 |
;; |
| 574 |
* ) |
| 575 |
DisplayError "Unrecognized -style argument '$style'" |
| 576 |
exit 1 |
| 577 |
;; |
| 578 |
esac |
| 579 |
|
| 580 |
case "$format:$mode" in |
| 581 |
gbc: | gpc: ) |
| 582 |
mode="xml" |
| 583 |
;; |
| 584 |
"" ) |
| 585 |
format="native" |
| 586 |
;; |
| 587 |
docsum:json ) |
| 588 |
;; |
| 589 |
docsum:* ) |
| 590 |
mode="xml" |
| 591 |
;; |
| 592 |
esac |
| 593 |
|
| 594 |
if [ "$format" = "" ] |
| 595 |
then |
| 596 |
format="native" |
| 597 |
fi |
| 598 |
|
| 599 |
if [ "$mode" = "" ] |
| 600 |
then |
| 601 |
mode="text" |
| 602 |
fi |
| 603 |
|
| 604 |
if [ "$mode" = "asn" ] |
| 605 |
then |
| 606 |
mode="asn.1" |
| 607 |
fi |
| 608 |
|
| 609 |
# do not treat TinySeq XML as FASTA |
| 610 |
|
| 611 |
if [ "$format" = "fasta" ] && [ "$mode" = "xml" ] |
| 612 |
then |
| 613 |
isFasta=false |
| 614 |
fi |
| 615 |
|
| 616 |
# input reality checks |
| 617 |
|
| 618 |
if [ "$needHistory" = true ] |
| 619 |
then |
| 620 |
if [ -t 0 ] |
| 621 |
then |
| 622 |
DisplayError "ENTREZ_DIRECT message not piped from stdin" |
| 623 |
exit 1 |
| 624 |
fi |
| 625 |
if [ "$empty" = true ] |
| 626 |
then |
| 627 |
# silently exit if explicit count of "0" |
| 628 |
exit 0 |
| 629 |
fi |
| 630 |
if [ -z "$web_env" ] |
| 631 |
then |
| 632 |
if [ -z "$rest" ] |
| 633 |
then |
| 634 |
# no results piped in, silently exit |
| 635 |
exit 0 |
| 636 |
fi |
| 637 |
DisplayError "WebEnv value not found in efetch input" |
| 638 |
exit 1 |
| 639 |
fi |
| 640 |
if [ -z "$qry_key" ] |
| 641 |
then |
| 642 |
DisplayError "QueryKey value not found in efetch input" |
| 643 |
exit 1 |
| 644 |
fi |
| 645 |
if [ "$num" -lt 1 ] |
| 646 |
then |
| 647 |
# silently exit if no results to fetch |
| 648 |
exit 0 |
| 649 |
fi |
| 650 |
fi |
| 651 |
|
| 652 |
# -id 0 looks up default record for each database |
| 653 |
|
| 654 |
GetZero() { |
| 655 |
|
| 656 |
case "$dbase" in |
| 657 |
annotinfo ) ids="122134" ;; |
| 658 |
assembly ) ids="443538" ;; |
| 659 |
biocollections ) ids="7370" ;; |
| 660 |
bioproject ) ids="146229" ;; |
| 661 |
biosample ) ids="3737421" ;; |
| 662 |
biosystems ) ids="1223165" ;; |
| 663 |
blastdbinfo ) ids="998664" ;; |
| 664 |
books ) ids="1371014" ;; |
| 665 |
cdd ) ids="274590" ;; |
| 666 |
clinvar ) ids="10510" ;; |
| 667 |
clone ) ids="18646800" ;; |
| 668 |
dbvar ) ids="6173073" ;; |
| 669 |
gap ) ids="872875" ;; |
| 670 |
gapplus ) ids="136686" ;; |
| 671 |
gds ) ids="200022309" ;; |
| 672 |
gencoll ) ids="398148" ;; |
| 673 |
gene ) ids="3667" ;; |
| 674 |
genome ) ids="52" ;; |
| 675 |
geoprofiles ) ids="16029743" ;; |
| 676 |
grasp ) ids="2852486" ;; |
| 677 |
gtr ) ids="559277" ;; |
| 678 |
homologene ) ids="510" ;; |
| 679 |
ipg ) ids="422234" ;; |
| 680 |
medgen ) ids="162753" ;; |
| 681 |
mesh ) ids="68007328" ;; |
| 682 |
ncbisearch ) ids="3158" ;; |
| 683 |
nlmcatalog ) ids="0404511" ;; |
| 684 |
nuccore ) ids="1322283" ;; |
| 685 |
nucleotide ) ids="1322283" ;; |
| 686 |
omim ) ids="176730" ;; |
| 687 |
orgtrack ) ids="319950" ;; |
| 688 |
pcassay ) ids="1901" ;; |
| 689 |
pccompound ) ids="16132302" ;; |
| 690 |
pcsubstance ) ids="126522451" ;; |
| 691 |
pmc ) ids="209839" ;; |
| 692 |
protein ) ids="4557671" ;; |
| 693 |
proteinclusters ) ids="2945638" ;; |
| 694 |
pubmed ) ids="2539356" ;; |
| 695 |
seqannot ) ids="9561" ;; |
| 696 |
snp ) ids="137853337" ;; |
| 697 |
sra ) ids="190091" ;; |
| 698 |
structure ) ids="61024" ;; |
| 699 |
taxonomy ) ids="562" ;; |
| 700 |
unigene ) ids="1132160" ;; |
| 701 |
esac |
| 702 |
} |
| 703 |
|
| 704 |
if [ "$ids" = "0" ] |
| 705 |
then |
| 706 |
GetZero |
| 707 |
fi |
| 708 |
|
| 709 |
# lookup accessions in -id argument or piped from stdin |
| 710 |
|
| 711 |
if [ "$dbase" != "clinvar" ] || [ "$format" != "vcv" ] |
| 712 |
then |
| 713 |
LookupSpecialAccessions |
| 714 |
fi |
| 715 |
|
| 716 |
# reality checks and adjustments on sequence variables |
| 717 |
|
| 718 |
if [ "$isSequence" = true ] |
| 719 |
then |
| 720 |
if [ "$extend" -gt 0 ] |
| 721 |
then |
| 722 |
seq_start=$(( seq_start - extend )) |
| 723 |
seq_stop=$(( seq_stop + extend )) |
| 724 |
fi |
| 725 |
else |
| 726 |
if [ "$seq_start" -ne 0 ] |
| 727 |
then |
| 728 |
DisplayError "Only sequence formats may use -seq_start" |
| 729 |
exit 1 |
| 730 |
fi |
| 731 |
if [ "$seq_stop" -ne 0 ] |
| 732 |
then |
| 733 |
DisplayError "Only sequence formats may use -seq_stop" |
| 734 |
exit 1 |
| 735 |
fi |
| 736 |
if [ "$strand" -ne 0 ] |
| 737 |
then |
| 738 |
DisplayError "Only sequence formats may use -strand" |
| 739 |
exit 1 |
| 740 |
fi |
| 741 |
if [ "$complexity" -ne 0 ] |
| 742 |
then |
| 743 |
DisplayError "Only sequence formats may use -complexity" |
| 744 |
exit 1 |
| 745 |
fi |
| 746 |
if [ "$extrafeat" -ne -1 ] |
| 747 |
then |
| 748 |
DisplayError "Only sequence formats may use -extrafeat" |
| 749 |
exit 1 |
| 750 |
fi |
| 751 |
if [ -n "$showgaps" ] |
| 752 |
then |
| 753 |
DisplayError "Only sequence formats may use -showgaps" |
| 754 |
exit 1 |
| 755 |
fi |
| 756 |
fi |
| 757 |
|
| 758 |
if [ "$isSequence" = true ] |
| 759 |
then |
| 760 |
if [ "$seq_start" -gt 0 ] && [ "$seq_stop" -gt 0 ] |
| 761 |
then |
| 762 |
if [ "$seq_start" -gt "$seq_stop" ] |
| 763 |
then |
| 764 |
tmps="$seq_start" |
| 765 |
seq_start="$seq_stop" |
| 766 |
seq_stop="$tmps" |
| 767 |
if [ "$strand" -eq 0 ] |
| 768 |
then |
| 769 |
strand=2 |
| 770 |
fi |
| 771 |
fi |
| 772 |
else |
| 773 |
seq_start="" |
| 774 |
seq_stop="" |
| 775 |
fi |
| 776 |
if [ "$strand" -lt 1 ] |
| 777 |
then |
| 778 |
strand="" |
| 779 |
fi |
| 780 |
if [ "$complexity" -lt 1 ] |
| 781 |
then |
| 782 |
complexity="" |
| 783 |
fi |
| 784 |
if [ "$extrafeat" -lt 1 ] |
| 785 |
then |
| 786 |
extrafeat="" |
| 787 |
fi |
| 788 |
else |
| 789 |
# otherwise clear all sequence-related flags, will be ignored by AddIfNotEmpty |
| 790 |
seq_start="" |
| 791 |
seq_stop="" |
| 792 |
strand="" |
| 793 |
complexity="" |
| 794 |
extrafeat="" |
| 795 |
showgaps="" |
| 796 |
fi |
| 797 |
|
| 798 |
# determine size of individual requests |
| 799 |
|
| 800 |
case "$format:$dbase:$mode:$isSequence" in |
| 801 |
uid:pubmed:* ) chunk=5000 ;; |
| 802 |
uid:* ) chunk=25000 ;; |
| 803 |
acc:*:true ) chunk=10000 ;; |
| 804 |
url:* ) chunk=50 ;; |
| 805 |
docsum:gtr:json:* ) chunk=50 ;; |
| 806 |
docsum:*:json:* ) chunk=500 ;; |
| 807 |
docsum:*:true ) chunk=50 ;; |
| 808 |
fasta:* ) chunk=50 ;; |
| 809 |
bioc:* ) chunk=100 ;; |
| 810 |
ipg:* ) chunk=100 ;; |
| 811 |
json:snp:* ) chunk=10 ;; |
| 812 |
xml:gene:* ) chunk=200 ;; |
| 813 |
runinfo:sra:* ) chunk=5 ;; |
| 814 |
*:sra:* ) chunk=20 ;; |
| 815 |
*:*:true ) chunk=100 ;; |
| 816 |
* ) chunk=1000 ;; |
| 817 |
esac |
| 818 |
|
| 819 |
if [ "$style" = "master" ] || [ "$style" = "withparts" ] || [ "$style" = "conwithfeat" ] |
| 820 |
then |
| 821 |
chunk=1 |
| 822 |
fi |
| 823 |
|
| 824 |
if [ "$force" -gt 0 ] |
| 825 |
then |
| 826 |
chunk="$force" |
| 827 |
fi |
| 828 |
|
| 829 |
# limit uid list between min and max |
| 830 |
|
| 831 |
LimitUidList() { |
| 832 |
|
| 833 |
db="$1" |
| 834 |
|
| 835 |
res=$( GetUIDs ) |
| 836 |
if [ "$min" -gt 0 ] && [ "$max" -gt 0 ] |
| 837 |
then |
| 838 |
res=$( echo "$res" | sed -ne "${min},${max}p" ) |
| 839 |
elif [ "$min" -gt 0 ] |
| 840 |
then |
| 841 |
res=$( echo "$res" | head -n "${max}" ) |
| 842 |
elif [ "$max" -gt 0 ] |
| 843 |
then |
| 844 |
res=$( echo "$res" | tail -n +"${min}" ) |
| 845 |
fi |
| 846 |
|
| 847 |
echo "$res" |
| 848 |
} |
| 849 |
|
| 850 |
# -format uid |
| 851 |
|
| 852 |
if [ "$format" = "uid" ] |
| 853 |
then |
| 854 |
res=$( LimitUidList "$dbase" ) |
| 855 |
echo "$res" |
| 856 |
|
| 857 |
exit 0 |
| 858 |
fi |
| 859 |
|
| 860 |
# -format url |
| 861 |
|
| 862 |
if [ "$format" = "url" ] |
| 863 |
then |
| 864 |
res=$( LimitUidList "$dbase" ) |
| 865 |
echo "$res" | |
| 866 |
join-into-groups-of "$chunk" | |
| 867 |
while read uids |
| 868 |
do |
| 869 |
echo "https://www.ncbi.nlm.nih.gov/$dbase/$uids" |
| 870 |
done |
| 871 |
|
| 872 |
exit 0 |
| 873 |
fi |
| 874 |
|
| 875 |
# -format urls |
| 876 |
|
| 877 |
if [ "$format" = "urls" ] |
| 878 |
then |
| 879 |
res=$( LimitUidList "$dbase" ) |
| 880 |
echo "$res" | |
| 881 |
while read uid |
| 882 |
do |
| 883 |
echo "https://www.ncbi.nlm.nih.gov/$dbase/$uid" |
| 884 |
done |
| 885 |
|
| 886 |
exit 0 |
| 887 |
fi |
| 888 |
|
| 889 |
# -format edirect |
| 890 |
|
| 891 |
if [ "$format" = "xids" ] || [ "$format" = "xid" ] || [ "$format" = "xis" ] || [ "$format" = "edirect" ] |
| 892 |
then |
| 893 |
flt="" |
| 894 |
# instantiate UIDs within ENTREZ_DIRECT message |
| 895 |
raw=$( LimitUidList "$dbase" ) |
| 896 |
if [ -n "$raw" ] |
| 897 |
then |
| 898 |
flt=$( echo "$raw" | sed -e 's/^/ <Id>/' -e 's/$/<\/Id>/' ) |
| 899 |
num=$( echo "$raw" | wc -l | tr -d ' ' ) |
| 900 |
else |
| 901 |
# clear values if results are empty |
| 902 |
flt="" |
| 903 |
num="0" |
| 904 |
fi |
| 905 |
echo "<ENTREZ_DIRECT>" |
| 906 |
if [ -n "$dbase" ] |
| 907 |
then |
| 908 |
echo " <Db>${dbase}</Db>" |
| 909 |
fi |
| 910 |
if [ -n "$num" ] |
| 911 |
then |
| 912 |
echo " <Count>${num}</Count>" |
| 913 |
fi |
| 914 |
if [ -n "$flt" ] |
| 915 |
then |
| 916 |
echo "$flt" |
| 917 |
fi |
| 918 |
if [ -n "$err" ] |
| 919 |
then |
| 920 |
echo " <Error>${err}</Error>" |
| 921 |
fi |
| 922 |
echo "</ENTREZ_DIRECT>" |
| 923 |
|
| 924 |
exit 0 |
| 925 |
fi |
| 926 |
|
| 927 |
# -format docsum |
| 928 |
|
| 929 |
if [ "$format" = "docsum" ] |
| 930 |
then |
| 931 |
# temporary check for VDB docsum, remove once esummary.fcgi server is modified |
| 932 |
if [ "$isNucleotide" = true ] && [ -n "$ids" ] |
| 933 |
then |
| 934 |
is_vdb="" |
| 935 |
vacc=$( echo $ids | sed -e 's/\..*//' | LC_ALL=C tr a-z A-Z ) |
| 936 |
case "$vacc" in |
| 937 |
[HMN][0-9][0-9][0-9][0-9][0-9] | \ |
| 938 |
[EHMN][0-9][0-9][0-9][0-9][0-9][0-9][0-9] ) |
| 939 |
is_vdb=yes |
| 940 |
;; |
| 941 |
[CEFGJKOPRSTV][0-9][0-9][0-9][0-9][0-9] | \ |
| 942 |
[ACEJKO-X][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | \ |
| 943 |
[A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]* | \ |
| 944 |
[A-Z][A-Z][A-Z][A-Z][0-9][0-9][PS][0-9][0-9][0-9][0-9][0-9][0-9]* | \ |
| 945 |
[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]* | \ |
| 946 |
[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][PS][0-9][0-9][0-9][0-9][0-9][0-9][0-9]* ) |
| 947 |
is_vdb=maybe |
| 948 |
;; |
| 949 |
* ) |
| 950 |
is_vdb=no |
| 951 |
;; |
| 952 |
esac |
| 953 |
if [ "$is_vdb" = "yes" ] || [ "$is_vdb" = "maybe" ] |
| 954 |
then |
| 955 |
nquire -get https://www.ncbi.nlm.nih.gov/sviewer/flatfile/flatfile.fcgi -id "$vacc" -report 17 | grep '.' |
| 956 |
exit 0 |
| 957 |
fi |
| 958 |
fi |
| 959 |
|
| 960 |
if [ "$needHistory" = false ] |
| 961 |
then |
| 962 |
if [ "$log" = true ] |
| 963 |
then |
| 964 |
printf "EFetch\n" >&2 |
| 965 |
fi |
| 966 |
res=$( LimitUidList "$dbase" ) |
| 967 |
if [ -n "$res" ] |
| 968 |
then |
| 969 |
echo "$res" | |
| 970 |
join-into-groups-of "$chunk" | |
| 971 |
while read uids |
| 972 |
do |
| 973 |
if [ "$log" = true ] |
| 974 |
then |
| 975 |
printf "." >&2 |
| 976 |
fi |
| 977 |
RunWithCommonArgs nquire -url "$base" esummary.fcgi \ |
| 978 |
-db "$dbase" -id "$uids" -version "2.0" -retmode "$mode" |
| 979 |
done |
| 980 |
fi |
| 981 |
if [ "$log" = true ] |
| 982 |
then |
| 983 |
printf "\n" >&2 |
| 984 |
fi |
| 985 |
else |
| 986 |
if [ "$log" = true ] |
| 987 |
then |
| 988 |
printf "EFetch\n" >&2 |
| 989 |
fi |
| 990 |
GenerateHistoryChunks "$chunk" "$min" "$max" | |
| 991 |
while read fr chnk |
| 992 |
do |
| 993 |
if [ "$log" = true ] |
| 994 |
then |
| 995 |
printf "." >&2 |
| 996 |
fi |
| 997 |
RunWithCommonArgs nquire -url "$base" esummary.fcgi \ |
| 998 |
-query_key "$qry_key" -WebEnv "$web_env" -retstart "$fr" -retmax "$chnk" \ |
| 999 |
-db "$dbase" -version "2.0" -retmode "$mode" |
| 1000 |
done |
| 1001 |
if [ "$log" = true ] |
| 1002 |
then |
| 1003 |
printf "\n" >&2 |
| 1004 |
fi |
| 1005 |
fi | |
| 1006 |
if [ "$mode" = "json" ] |
| 1007 |
then |
| 1008 |
grep '.' |
| 1009 |
elif [ "$raw" = true ] |
| 1010 |
then |
| 1011 |
# transmute -mixed -format indent -doctype "" |
| 1012 |
grep '.' |
| 1013 |
elif [ "$json" = true ] |
| 1014 |
then |
| 1015 |
transmute -x2j |
| 1016 |
elif [ "$dbase" = "sra" ] |
| 1017 |
then |
| 1018 |
transmute -mixed -normalize "$dbase" | |
| 1019 |
sed -e 's/<!DOCTYPE eSummaryResult PUBLIC/<!DOCTYPE DocumentSummarySet PUBLIC/g; s/<eSummaryResult>//g; s/<\/eSummaryResult>//g' | |
| 1020 |
transmute -mixed -compress -format indent -doctype "" -self |
| 1021 |
else |
| 1022 |
transmute -mixed -normalize "$dbase" | |
| 1023 |
sed -e 's/<!DOCTYPE eSummaryResult PUBLIC/<!DOCTYPE DocumentSummarySet PUBLIC/g; s/<eSummaryResult>//g; s/<\/eSummaryResult>//g' | |
| 1024 |
transmute -mixed -compress -format indent -doctype "" |
| 1025 |
fi |
| 1026 |
|
| 1027 |
exit 0 |
| 1028 |
fi |
| 1029 |
|
| 1030 |
# -format bioc |
| 1031 |
|
| 1032 |
biocbase="https://www.ncbi.nlm.nih.gov/research/pubtator3-api/publications/" |
| 1033 |
idtype="" |
| 1034 |
prefix="" |
| 1035 |
xpoort="" |
| 1036 |
|
| 1037 |
if [ "$format" = "bioc" ] |
| 1038 |
then |
| 1039 |
if [ "$dbase" = "pubmed" ] |
| 1040 |
then |
| 1041 |
idtype="-pmids" |
| 1042 |
xpoort="export" |
| 1043 |
elif [ "$dbase" = "pmc" ] |
| 1044 |
then |
| 1045 |
idtype="-pmcids" |
| 1046 |
xpoort="pmc_export" |
| 1047 |
prefix="PMC" |
| 1048 |
else |
| 1049 |
DisplayError "BioC format must use -db pubmed or pmc" |
| 1050 |
exit 1 |
| 1051 |
fi |
| 1052 |
|
| 1053 |
GetUIDs | |
| 1054 |
while read uid |
| 1055 |
do |
| 1056 |
echo "$prefix${uid#PMC}" |
| 1057 |
done | |
| 1058 |
join-into-groups-of "$chunk" | |
| 1059 |
while read uids |
| 1060 |
do |
| 1061 |
res=$( nquire -get $biocbase $xpoort biocxml $idtype $uids ) |
| 1062 |
if [ -n "$res" ] |
| 1063 |
then |
| 1064 |
echo "$res" | |
| 1065 |
if [ "$raw" = true ] |
| 1066 |
then |
| 1067 |
# transmute -format indent -doctype "" |
| 1068 |
grep '.' |
| 1069 |
elif [ "$json" = true ] |
| 1070 |
then |
| 1071 |
transmute -x2j |
| 1072 |
else |
| 1073 |
transmute -normalize bioc | transmute -format indent -doctype "" |
| 1074 |
fi |
| 1075 |
fi |
| 1076 |
done |
| 1077 |
|
| 1078 |
exit 0 |
| 1079 |
fi |
| 1080 |
|
| 1081 |
# helper function adds sequence-specific arguments (if set) |
| 1082 |
|
| 1083 |
RunWithFetchArgs() { |
| 1084 |
|
| 1085 |
AddIfNotEmpty -style "$style" \ |
| 1086 |
AddIfNotEmpty -seq_start "$seq_start" \ |
| 1087 |
AddIfNotEmpty -seq_stop "$seq_stop" \ |
| 1088 |
AddIfNotEmpty -strand "$strand" \ |
| 1089 |
AddIfNotEmpty -complexity "$complexity" \ |
| 1090 |
AddIfNotEmpty -extrafeat "$extrafeat" \ |
| 1091 |
AddIfNotEmpty -show-gaps "$showgaps" \ |
| 1092 |
FlagIfNotEmpty -is_variationid "$is_variationid" \ |
| 1093 |
RunWithCommonArgs "$@" |
| 1094 |
} |
| 1095 |
|
| 1096 |
# -immediate flag for full sequence records or binary ASN.1 files |
| 1097 |
|
| 1098 |
if [ "$isFasta" = false ] && [ "$isSequence" = false ] |
| 1099 |
then |
| 1100 |
immediate=false |
| 1101 |
express=false |
| 1102 |
fi |
| 1103 |
|
| 1104 |
if [ "$immediate" = true ] |
| 1105 |
then |
| 1106 |
express=true |
| 1107 |
fi |
| 1108 |
|
| 1109 |
if [ -n "$format" ] && [ "$express" = true ] |
| 1110 |
then |
| 1111 |
chunk=5 |
| 1112 |
if [ "$immediate" = true ] || [ "$isBinaryASN" = true ] || [ "$isTextASN" = true ] |
| 1113 |
then |
| 1114 |
chunk=1 |
| 1115 |
fi |
| 1116 |
GetUIDs | |
| 1117 |
join-into-groups-of "$chunk" | |
| 1118 |
while read uid |
| 1119 |
do |
| 1120 |
if [ -n "$style" ] |
| 1121 |
then |
| 1122 |
nquire -url "$base" efetch.fcgi \ |
| 1123 |
-db "$dbase" -id "$uid" -rettype "$format" -retmode "$mode" -style "$style" |
| 1124 |
elif [ "$isBinaryASN" = true ] |
| 1125 |
then |
| 1126 |
temp=$(mktemp /tmp/FETCH_BIN_TEMP.XXXXXXXXX) |
| 1127 |
nquire -url "$base" efetch.fcgi \ |
| 1128 |
-db "$dbase" -id "$uid" -rettype "$format" -retmode "$mode" > "$temp" |
| 1129 |
|
| 1130 |
inhex=$( tail -c1 "$temp" | od -tx1 | tr '\n' ' ' | grep -i "0a" ) |
| 1131 |
if [ "$inhex" ] |
| 1132 |
then |
| 1133 |
flen=$( wc -c < "$temp" | tr -d ' ' ) |
| 1134 |
count=$(( flen - 1 )) |
| 1135 |
dd if="$temp" bs="$count" count=1 2>/dev/null |
| 1136 |
else |
| 1137 |
cat "$temp" |
| 1138 |
fi |
| 1139 |
|
| 1140 |
rm "$temp" |
| 1141 |
elif [ "$isTextASN" = true ] |
| 1142 |
then |
| 1143 |
nquire -url "$base" efetch.fcgi \ |
| 1144 |
-db "$dbase" -id "$uid" -rettype "$format" -retmode "$mode" | grep -v "^$" |
| 1145 |
else |
| 1146 |
nquire -url "$base" efetch.fcgi \ |
| 1147 |
-db "$dbase" -id "$uid" -rettype "$format" -retmode "$mode" |
| 1148 |
fi |
| 1149 |
done |
| 1150 |
|
| 1151 |
exit 0 |
| 1152 |
fi |
| 1153 |
|
| 1154 |
# other -format choices |
| 1155 |
|
| 1156 |
if [ -n "$format" ] |
| 1157 |
then |
| 1158 |
if [ "$needHistory" = false ] |
| 1159 |
then |
| 1160 |
res=$( LimitUidList "$dbase" ) |
| 1161 |
if [ -n "$res" ] |
| 1162 |
then |
| 1163 |
echo "$res" | |
| 1164 |
join-into-groups-of "$chunk" | |
| 1165 |
while read uids |
| 1166 |
do |
| 1167 |
RunWithFetchArgs nquire -url "$base" efetch.fcgi \ |
| 1168 |
-db "$dbase" -id "$uids" -rettype "$format" -retmode "$mode" |
| 1169 |
done |
| 1170 |
fi |
| 1171 |
else |
| 1172 |
GenerateHistoryChunks "$chunk" "$min" "$max" | |
| 1173 |
while read fr chnk |
| 1174 |
do |
| 1175 |
RunWithFetchArgs nquire -url "$base" efetch.fcgi \ |
| 1176 |
-query_key "$qry_key" -WebEnv "$web_env" -retstart "$fr" -retmax "$chnk" \ |
| 1177 |
-db "$dbase" -rettype "$format" -retmode "$mode" |
| 1178 |
done |
| 1179 |
fi | |
| 1180 |
if [ "$format" = "json" ] || [ "$mode" = "json" ] || [ "$raw" = true ] || [ "$isTextASN" = true ] |
| 1181 |
then |
| 1182 |
grep '.' |
| 1183 |
elif [ "$json" = true ] |
| 1184 |
then |
| 1185 |
transmute -x2j |
| 1186 |
elif [ "$isFasta" = true ] |
| 1187 |
then |
| 1188 |
grep '.' |
| 1189 |
elif [ "$format" = "full" ] && [ "$mode" = "xml" ] |
| 1190 |
then |
| 1191 |
if [ "$dbase" = "pubmed" ] |
| 1192 |
then |
| 1193 |
if [ "$pubmedAPA" = true ] |
| 1194 |
then |
| 1195 |
transmute -normalize "$dbase" | |
| 1196 |
pma2apa -ascii |
| 1197 |
elif [ "$pubmedASN" = true ] |
| 1198 |
then |
| 1199 |
transmute -normalize "$dbase" | |
| 1200 |
pma2pme -std |
| 1201 |
else |
| 1202 |
# first pass to convert SOLR server's &#x...; hex encodings with html.UnescapeString |
| 1203 |
transmute -normalize "$dbase" | |
| 1204 |
transmute -normalize "$dbase" | |
| 1205 |
transmute -format indent -combine -doctype "" |
| 1206 |
fi |
| 1207 |
elif [ "$dbase" = "sra" ] |
| 1208 |
then |
| 1209 |
transmute -normalize "$dbase" | |
| 1210 |
transmute -format indent -combine -doctype "" -self |
| 1211 |
elif [ "$dbase" = "pmc" ] |
| 1212 |
then |
| 1213 |
grep '.' |
| 1214 |
elif [ "$dbase" = "pccompound" ] || [ "$dbase" = "pcsubstance" ] |
| 1215 |
then |
| 1216 |
transmute -mixed -normalize "$dbase" |
| 1217 |
else |
| 1218 |
transmute -format indent -combine -doctype "" |
| 1219 |
fi |
| 1220 |
elif [ "$dbase" = "sra" ] && [ "$format" = "runinfo" ] |
| 1221 |
then |
| 1222 |
# remove extra copies of the header between batches of results |
| 1223 |
sed '2,${/Run,ReleaseDate,LoadDate/d;}' |
| 1224 |
else |
| 1225 |
grep '' |
| 1226 |
fi |
| 1227 |
|
| 1228 |
exit 0 |
| 1229 |
fi |
| 1230 |
|
| 1231 |
# warn if no format recognized |
| 1232 |
|
| 1233 |
DisplayError "Unrecognized format" |
| 1234 |
exit 1 |
| 1235 |
|