| 1 |
#!/bin/sh |
| 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: test-eutils |
| 28 |
# |
| 29 |
# Author: Jonathan Kans |
| 30 |
# |
| 31 |
# Version Creation Date: 3/12/19 |
| 32 |
# |
| 33 |
# ========================================================================== |
| 34 |
|
| 35 |
# Entrez Direct - EDirect |
| 36 |
|
| 37 |
dir=`dirname "$0"` |
| 38 |
|
| 39 |
cmd="-all" |
| 40 |
|
| 41 |
verby=false |
| 42 |
timey=false |
| 43 |
failed=false |
| 44 |
failures="" |
| 45 |
count=0 |
| 46 |
numFails=0 |
| 47 |
repeats=1 |
| 48 |
justAlive=false |
| 49 |
START=0 |
| 50 |
END=0 |
| 51 |
DIFF=0 |
| 52 |
|
| 53 |
seconds_start=$(date "+%s") |
| 54 |
|
| 55 |
ver=$( einfo -help | head -n 1 | sed 's/einfo //g' ) |
| 56 |
int=$( einfo -help | grep internal ) |
| 57 |
|
| 58 |
ColorSetup() { |
| 59 |
|
| 60 |
if [ -z "$TERM" ] || [ ! -t 2 ] |
| 61 |
then |
| 62 |
INIT="" |
| 63 |
elif command -v tput >/dev/null |
| 64 |
then |
| 65 |
INIT="$(tput sgr0)" |
| 66 |
else |
| 67 |
# assume ANSI |
| 68 |
escape="$(printf '\033')" |
| 69 |
INIT="${escape}[0m" |
| 70 |
fi |
| 71 |
# clear color on terminal if "set -x" (export EDIRECT_TRACE=true) debugging has been used |
| 72 |
echo "${INIT}" > /dev/null |
| 73 |
} |
| 74 |
|
| 75 |
ColorSetup |
| 76 |
|
| 77 |
while [ $# -gt 0 ] |
| 78 |
do |
| 79 |
case "$1" in |
| 80 |
-all | -alive | -preview | -einfo | -esearch | -elink | -efetch | -esummary ) |
| 81 |
cmd="$1" |
| 82 |
shift |
| 83 |
;; |
| 84 |
all | alive | preview | einfo | esearch | elink | efetch | esummary ) |
| 85 |
cmd="$1" |
| 86 |
shift |
| 87 |
;; |
| 88 |
-info | -search | -link | -fetch | -summary ) |
| 89 |
cmd="$1" |
| 90 |
shift |
| 91 |
;; |
| 92 |
info | search | link | fetch | summary ) |
| 93 |
cmd="$1" |
| 94 |
shift |
| 95 |
;; |
| 96 |
-verbose ) |
| 97 |
verby=true |
| 98 |
shift |
| 99 |
;; |
| 100 |
-timer | -timed ) |
| 101 |
timey=true |
| 102 |
shift |
| 103 |
;; |
| 104 |
-repeat | -repeats ) |
| 105 |
shift |
| 106 |
if [ $# -gt 0 ] |
| 107 |
then |
| 108 |
repeats="$1" |
| 109 |
shift |
| 110 |
if [ "$repeats" -lt 1 ] |
| 111 |
then |
| 112 |
repeats=1 |
| 113 |
fi |
| 114 |
if [ "$repeats" -gt 100 ] |
| 115 |
then |
| 116 |
repeats=1 |
| 117 |
fi |
| 118 |
fi |
| 119 |
;; |
| 120 |
-h | -help | --help ) |
| 121 |
cat <<EOF |
| 122 |
USAGE: $0 |
| 123 |
[ -all | -alive | -esearch | -elink | -efetch | -esummary ] |
| 124 |
[ -verbose ] |
| 125 |
[ -repeats # ] |
| 126 |
|
| 127 |
EXAMPLE: test-eutils -alive |
| 128 |
EOF |
| 129 |
exit 0 |
| 130 |
;; |
| 131 |
-* | * ) |
| 132 |
exec >&2 |
| 133 |
echo "$0: Unrecognized option $1" |
| 134 |
exit 1 |
| 135 |
;; |
| 136 |
esac |
| 137 |
done |
| 138 |
|
| 139 |
MarkFailure() { |
| 140 |
fails="$1" |
| 141 |
res="$2" |
| 142 |
if [ "$failed" != true ] |
| 143 |
then |
| 144 |
if [ "$verby" = true ] |
| 145 |
then |
| 146 |
echo "" |
| 147 |
echo "FAILURE" |
| 148 |
echo "" |
| 149 |
fi |
| 150 |
failed=true |
| 151 |
fi |
| 152 |
if [ "$verby" = true ] |
| 153 |
then |
| 154 |
echo "" |
| 155 |
echo "$fails" |
| 156 |
echo "" |
| 157 |
echo "$res" |
| 158 |
echo "" |
| 159 |
fi |
| 160 |
if [ -n "$failures" ] |
| 161 |
then |
| 162 |
# add failed command only if not already present in failure list |
| 163 |
case $failures in |
| 164 |
*$fails* ) |
| 165 |
;; |
| 166 |
* ) |
| 167 |
failures=$(printf '%s\n\n %s' "$failures" "$fails") |
| 168 |
;; |
| 169 |
esac |
| 170 |
else |
| 171 |
failures=$(printf ' %s' "$fails") |
| 172 |
fi |
| 173 |
numFails=$(( numFails + 1 )) |
| 174 |
if [ "$numFails" -gt 0 ] |
| 175 |
then |
| 176 |
export NQUIRE_TIMEOUT=2 |
| 177 |
fi |
| 178 |
} |
| 179 |
|
| 180 |
DoStart() { |
| 181 |
DIFF=0 |
| 182 |
START=$(perl -MTime::HiRes -e 'printf("%.0f\n",Time::HiRes::time()*1000)') |
| 183 |
} |
| 184 |
|
| 185 |
DoStop() { |
| 186 |
END=$(perl -MTime::HiRes -e 'printf("%.0f\n",Time::HiRes::time()*1000)') |
| 187 |
DIFF=$((END - START)) |
| 188 |
} |
| 189 |
|
| 190 |
DoTime() { |
| 191 |
if [ "$timey" = true ] |
| 192 |
then |
| 193 |
echo " $DIFF" |
| 194 |
fi |
| 195 |
} |
| 196 |
|
| 197 |
DoAlive() { |
| 198 |
|
| 199 |
baseURL="$1" |
| 200 |
|
| 201 |
for i in $(seq 1 $repeats) |
| 202 |
do |
| 203 |
sleep 1 |
| 204 |
DoStart |
| 205 |
size=0 |
| 206 |
res=$( |
| 207 |
nquire -get "$baseURL" einfo.fcgi |
| 208 |
) |
| 209 |
count=$(( count + 1 )) |
| 210 |
if [ -n "$res" ] |
| 211 |
then |
| 212 |
size=${#res} |
| 213 |
fi |
| 214 |
DoStop |
| 215 |
tst=$( |
| 216 |
echo "$res" | xtract -pattern DbList -sep "\n" -element DbName | |
| 217 |
sort | uniq | tr '\n' ' ' |
| 218 |
) |
| 219 |
case "$tst" in |
| 220 |
*" mesh "* ) |
| 221 |
printf "${INIT}." |
| 222 |
;; |
| 223 |
* ) |
| 224 |
fails="nquire -get $baseURL einfo.fcgi" |
| 225 |
MarkFailure "$fails" "$res" |
| 226 |
printf "${INIT}x" |
| 227 |
;; |
| 228 |
esac |
| 229 |
DoTime |
| 230 |
if [ "$size" -ne 1229 ] |
| 231 |
then |
| 232 |
echo "($size)" |
| 233 |
fi |
| 234 |
done |
| 235 |
|
| 236 |
for i in $(seq 1 $repeats) |
| 237 |
do |
| 238 |
sleep 1 |
| 239 |
DoStart |
| 240 |
size=0 |
| 241 |
res=$( |
| 242 |
nquire -get "$baseURL" elink.fcgi -dbfrom pubmed -db pubmed -id 2539356 -linkname pubmed_pubmed |
| 243 |
) |
| 244 |
count=$(( count + 1 )) |
| 245 |
if [ -n "$res" ] |
| 246 |
then |
| 247 |
size=${#res} |
| 248 |
fi |
| 249 |
DoStop |
| 250 |
num=$( |
| 251 |
echo "$res" | tr '\n' ' ' | xtract -pattern LinkSet -num "Link/Id" |
| 252 |
) |
| 253 |
if [ -z "$num" ] || [ "$num" -lt 100 ] |
| 254 |
then |
| 255 |
fails="nquire -get $baseURL elink.fcgi -dbfrom pubmed -db pubmed -id 2539356 -linkname pubmed_pubmed" |
| 256 |
MarkFailure "$fails" "$res" |
| 257 |
printf "${INIT}x" |
| 258 |
else |
| 259 |
printf "${INIT}." |
| 260 |
fi |
| 261 |
DoTime |
| 262 |
done |
| 263 |
|
| 264 |
for i in $(seq 1 $repeats) |
| 265 |
do |
| 266 |
sleep 1 |
| 267 |
DoStart |
| 268 |
size=0 |
| 269 |
res=$( |
| 270 |
nquire -get "$baseURL" efetch.fcgi -db pubmed -id 2539356 -rettype native -retmode xml |
| 271 |
) |
| 272 |
count=$(( count + 1 )) |
| 273 |
if [ -n "$res" ] |
| 274 |
then |
| 275 |
size=${#res} |
| 276 |
fi |
| 277 |
DoStop |
| 278 |
tst=$( |
| 279 |
echo "$res" | tr '\n' ' ' |
| 280 |
) |
| 281 |
case "$tst" in |
| 282 |
*"Tn3 transposon inserts at a reduced frequency"* ) |
| 283 |
printf "${INIT}." |
| 284 |
;; |
| 285 |
* ) |
| 286 |
fails="nquire -get $baseURL efetch.fcgi -db pubmed -id 2539356 -rettype native -retmode xml" |
| 287 |
MarkFailure "$fails" "$res" |
| 288 |
printf "${INIT}x" |
| 289 |
;; |
| 290 |
esac |
| 291 |
DoTime |
| 292 |
if [ "$size" -ne 14106 ] |
| 293 |
then |
| 294 |
echo "($size)" |
| 295 |
fi |
| 296 |
done |
| 297 |
|
| 298 |
for i in $(seq 1 $repeats) |
| 299 |
do |
| 300 |
sleep 1 |
| 301 |
DoStart |
| 302 |
size=0 |
| 303 |
res=$( |
| 304 |
nquire -get "$baseURL" esummary.fcgi -db pubmed -id 2539356 -version 2.0 |
| 305 |
) |
| 306 |
count=$(( count + 1 )) |
| 307 |
if [ -n "$res" ] |
| 308 |
then |
| 309 |
size=${#res} |
| 310 |
fi |
| 311 |
DoStop |
| 312 |
tst=$( |
| 313 |
echo "$res" | tr '\n' ' ' |
| 314 |
) |
| 315 |
case "$tst" in |
| 316 |
*"Nucleotide sequences required for Tn3 transposition immunity"* ) |
| 317 |
printf "${INIT}." |
| 318 |
;; |
| 319 |
* ) |
| 320 |
fails="nquire -get $baseURL esummary.fcgi -db pubmed -id 2539356 -version 2.0" |
| 321 |
MarkFailure "$fails" "$res" |
| 322 |
printf "${INIT}x" |
| 323 |
;; |
| 324 |
esac |
| 325 |
DoTime |
| 326 |
done |
| 327 |
|
| 328 |
for i in $(seq 1 $repeats) |
| 329 |
do |
| 330 |
sleep 1 |
| 331 |
DoStart |
| 332 |
size=0 |
| 333 |
res=$( |
| 334 |
nquire -get "$baseURL" esearch.fcgi -db pubmed -retmax 50 -term "tn3 transposition immunity" |
| 335 |
) |
| 336 |
count=$(( count + 1 )) |
| 337 |
if [ -n "$res" ] |
| 338 |
then |
| 339 |
size=${#res} |
| 340 |
fi |
| 341 |
DoStop |
| 342 |
tst=$( |
| 343 |
echo "$res" | tr '\n' ' ' |
| 344 |
) |
| 345 |
case "$tst" in |
| 346 |
*"QueryTranslation>\"tn3"* ) |
| 347 |
printf "${INIT}." |
| 348 |
;; |
| 349 |
* ) |
| 350 |
fails="nquire -get $baseURL esearch.fcgi -db pubmed -retmax 50 -term \"tn3 transposition immunity\"" |
| 351 |
MarkFailure "$fails" "$res" |
| 352 |
printf "${INIT}x" |
| 353 |
;; |
| 354 |
esac |
| 355 |
DoTime |
| 356 |
if [ "$size" -ne 2605 ] |
| 357 |
then |
| 358 |
echo "($size)" |
| 359 |
fi |
| 360 |
done |
| 361 |
|
| 362 |
printf "${INIT}\n" |
| 363 |
|
| 364 |
for i in $(seq 1 10) |
| 365 |
do |
| 366 |
sleep 1 |
| 367 |
DoStart |
| 368 |
res=$( |
| 369 |
nquire -url "$baseURL" elink.fcgi -dbfrom gene -db pubmed -id 101376644 -cmd neighbor -linkname gene_pubmed |
| 370 |
# curl -fsSL "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi" \ |
| 371 |
# -d "id=101376644&dbfrom=gene&db=pubmed&cmd=neighbor&linkname=gene_pubmed" |
| 372 |
) |
| 373 |
count=$(( count + 1 )) |
| 374 |
DoStop |
| 375 |
tst=$( |
| 376 |
echo "$res" | tr '\n' ' ' |
| 377 |
) |
| 378 |
case "$tst" in |
| 379 |
*"22301074"* ) |
| 380 |
printf "${INIT}." |
| 381 |
;; |
| 382 |
*"peer"* ) |
| 383 |
fails="nquire -url $baseURL elink.fcgi -dbfrom gene -db pubmed -id 101376644 -cmd neighbor -linkname gene_pubmed" |
| 384 |
MarkFailure "$fails" "$res" |
| 385 |
if [ -n "$int" ] || [ "$justAlive" = true ] |
| 386 |
then |
| 387 |
fst="${tst#*peer: }" |
| 388 |
scd="${fst% </ERROR>*}" |
| 389 |
MarkFailure "Elink IP: $scd" "$res" |
| 390 |
fi |
| 391 |
printf "${INIT}x" |
| 392 |
;; |
| 393 |
* ) |
| 394 |
fails="nquire -url $baseURL elink.fcgi -dbfrom gene -db pubmed -id 101376644 -cmd neighbor -linkname gene_pubmed" |
| 395 |
MarkFailure "$fails" "$res" |
| 396 |
printf "${INIT}x" |
| 397 |
;; |
| 398 |
esac |
| 399 |
DoTime |
| 400 |
done |
| 401 |
|
| 402 |
printf "${INIT}\n" |
| 403 |
} |
| 404 |
|
| 405 |
DoInfo() { |
| 406 |
for i in $(seq 1 $repeats) |
| 407 |
do |
| 408 |
DoStart |
| 409 |
res=$( |
| 410 |
einfo -db all |
| 411 |
) |
| 412 |
DoStop |
| 413 |
count=$(( count + 1 )) |
| 414 |
tst=$( |
| 415 |
echo "$res" | xtract -pattern DbInfo -sep "\n" -element DbName | |
| 416 |
sort | uniq | tr '\n' ' ' |
| 417 |
) |
| 418 |
case "$tst" in |
| 419 |
*" mesh "* ) |
| 420 |
printf "${INIT}." |
| 421 |
;; |
| 422 |
* ) |
| 423 |
fails="einfo -db all" |
| 424 |
MarkFailure "$fails" "$res" |
| 425 |
printf "${INIT}x" |
| 426 |
;; |
| 427 |
esac |
| 428 |
DoTime |
| 429 |
done |
| 430 |
printf "${INIT}\n" |
| 431 |
} |
| 432 |
|
| 433 |
DoSearch() { |
| 434 |
while read db qy |
| 435 |
do |
| 436 |
for i in $(seq 1 $repeats) |
| 437 |
do |
| 438 |
DoStart |
| 439 |
res=$( |
| 440 |
esearch -db "$db" -query "$qy" < /dev/null |
| 441 |
) |
| 442 |
DoStop |
| 443 |
count=$(( count + 1 )) |
| 444 |
num=$( |
| 445 |
echo "$res" | xtract -pattern ENTREZ_DIRECT -element Count |
| 446 |
) |
| 447 |
if [ -z "$num" ] || [ "$num" -lt 1 ] |
| 448 |
then |
| 449 |
fails=$(echo "esearch -db \"$db\" -query \"$qy\"") |
| 450 |
MarkFailure "$fails" "$res" |
| 451 |
printf "${INIT}x" |
| 452 |
else |
| 453 |
printf "${INIT}." |
| 454 |
fi |
| 455 |
DoTime |
| 456 |
done |
| 457 |
done < "$dir/help/tst-esearch.txt" |
| 458 |
printf "${INIT}\n" |
| 459 |
} |
| 460 |
|
| 461 |
DoLink() { |
| 462 |
while read db tg id |
| 463 |
do |
| 464 |
for i in $(seq 1 $repeats) |
| 465 |
do |
| 466 |
DoStart |
| 467 |
res=$( elink -db "$db" -target "$tg" -id "$id" < /dev/null ) |
| 468 |
DoStop |
| 469 |
count=$(( count + 1 )) |
| 470 |
num=$( |
| 471 |
echo "$res" | xtract -pattern ENTREZ_DIRECT -element Count |
| 472 |
) |
| 473 |
if [ -z "$num" ] || [ "$num" -lt 1 ] |
| 474 |
then |
| 475 |
fails=$(echo "elink -db \"$db\" -target \"$tg\" -id \"$id\"") |
| 476 |
MarkFailure "$fails" "$res" |
| 477 |
printf "${INIT}x" |
| 478 |
else |
| 479 |
printf "${INIT}." |
| 480 |
fi |
| 481 |
DoTime |
| 482 |
done |
| 483 |
done < "$dir/help/tst-elink.txt" |
| 484 |
printf "${INIT}\n" |
| 485 |
} |
| 486 |
|
| 487 |
DoFetch() { |
| 488 |
while read db ft id mt |
| 489 |
do |
| 490 |
for i in $(seq 1 $repeats) |
| 491 |
do |
| 492 |
DoStart |
| 493 |
res=$( |
| 494 |
efetch -db "$db" -id "$id" -format "$ft" < /dev/null |
| 495 |
) |
| 496 |
DoStop |
| 497 |
count=$(( count + 1 )) |
| 498 |
tst=$( |
| 499 |
echo "$res" | tr '\n' ' ' |
| 500 |
) |
| 501 |
case "$tst" in |
| 502 |
*"$mt"* ) |
| 503 |
printf "${INIT}." |
| 504 |
;; |
| 505 |
* ) |
| 506 |
fails=$(echo "efetch -db \"$db\" -id \"$id\" -format \"$ft\"") |
| 507 |
MarkFailure "$fails" "$res" |
| 508 |
printf "${INIT}x" |
| 509 |
;; |
| 510 |
esac |
| 511 |
DoTime |
| 512 |
done |
| 513 |
done < "$dir/help/tst-efetch.txt" |
| 514 |
printf "${INIT}\n" |
| 515 |
} |
| 516 |
|
| 517 |
DoSummary() { |
| 518 |
while read db id |
| 519 |
do |
| 520 |
for i in $(seq 1 $repeats) |
| 521 |
do |
| 522 |
DoStart |
| 523 |
res=$( |
| 524 |
esummary -db "$db" -id "$id" < /dev/null |
| 525 |
) |
| 526 |
DoStop |
| 527 |
count=$(( count + 1 )) |
| 528 |
tst=$( |
| 529 |
echo "$res" | xtract -pattern DocumentSummary -element DocumentSummary/Id |
| 530 |
) |
| 531 |
if [ -z "$tst" ] || [ "$tst" != "$id" ] |
| 532 |
then |
| 533 |
fails=$(echo "esummary -db \"$db\" -id \"$id\"") |
| 534 |
MarkFailure "$fails" "$res" |
| 535 |
printf "${INIT}x" |
| 536 |
else |
| 537 |
printf "${INIT}." |
| 538 |
fi |
| 539 |
DoTime |
| 540 |
done |
| 541 |
done < "$dir/help/tst-esummary.txt" |
| 542 |
|
| 543 |
# special tests for dbVar summary, since IDs are reconstructed weekly |
| 544 |
DoStart |
| 545 |
res=$( |
| 546 |
esearch -db dbvar -query "study [OT] AND case_set [STYPE]" | |
| 547 |
efetch -format docsum -start 1 -stop 1 |
| 548 |
) |
| 549 |
DoStop |
| 550 |
count=$(( count + 1 )) |
| 551 |
tst=$( |
| 552 |
echo "$res" | xtract -pattern DocumentSummary -element Study_type |
| 553 |
) |
| 554 |
if [ -z "$tst" ] || [ "$tst" != "Case-Set" ] |
| 555 |
then |
| 556 |
fails=$(echo "esearch -db dbvar -query \"study AND case_set\"") |
| 557 |
MarkFailure "$fails" "$res" |
| 558 |
printf "${INIT}x" |
| 559 |
else |
| 560 |
printf "${INIT}." |
| 561 |
fi |
| 562 |
DoTime |
| 563 |
|
| 564 |
DoStart |
| 565 |
query="pathogenic [CLIN] AND germline [ALLELE_ORIGIN]" |
| 566 |
query="$query AND nstd102 [ACC] AND brca1 [GENE_NAME]" |
| 567 |
query="$query AND copy_number_variation [VT] AND variant [OT]" |
| 568 |
res=$( esearch -db dbvar -query "$query" | |
| 569 |
efetch -format docsum -start 1 -stop 1 ) |
| 570 |
DoStop |
| 571 |
count=$(( count + 1 )) |
| 572 |
tst=$( |
| 573 |
echo "$res" | xtract -pattern DocumentSummary -first dbVarGene/name |
| 574 |
) |
| 575 |
if [ "$tst" != "BRCA1" ] && [ "$tst" != "NBR2" ] |
| 576 |
then |
| 577 |
fails=$(echo "esearch -db dbvar -query \"nstd102 AND brca1\"") |
| 578 |
MarkFailure "$fails" "$res" |
| 579 |
printf "${INIT}x" |
| 580 |
else |
| 581 |
printf "${INIT}." |
| 582 |
fi |
| 583 |
DoTime |
| 584 |
|
| 585 |
printf "${INIT}\n" |
| 586 |
} |
| 587 |
|
| 588 |
DoCmd() { |
| 589 |
|
| 590 |
case "$cmd" in |
| 591 |
-all | all ) |
| 592 |
echo "einfo" |
| 593 |
DoInfo |
| 594 |
echo "esearch" |
| 595 |
DoSearch |
| 596 |
echo "elink" |
| 597 |
DoLink |
| 598 |
echo "efetch" |
| 599 |
DoFetch |
| 600 |
echo "esummary" |
| 601 |
DoSummary |
| 602 |
echo "" |
| 603 |
;; |
| 604 |
-alive | alive ) |
| 605 |
;; |
| 606 |
-preview | preview ) |
| 607 |
echo "retired" |
| 608 |
;; |
| 609 |
-einfo | einfo | -info | info ) |
| 610 |
DoInfo |
| 611 |
;; |
| 612 |
-esearch | esearch | -search | search ) |
| 613 |
DoSearch |
| 614 |
;; |
| 615 |
-elink | elink | -link | link ) |
| 616 |
DoLink |
| 617 |
;; |
| 618 |
-efetch | efetch | -fetch | fetch ) |
| 619 |
DoFetch |
| 620 |
;; |
| 621 |
-esummary | esummary | -summary | summary ) |
| 622 |
DoSummary |
| 623 |
;; |
| 624 |
* ) |
| 625 |
break |
| 626 |
;; |
| 627 |
esac |
| 628 |
|
| 629 |
seconds_end=$(date "+%s") |
| 630 |
seconds=$((seconds_end - seconds_start)) |
| 631 |
|
| 632 |
echo "${INIT}$count queries in $seconds seconds" |
| 633 |
echo "" |
| 634 |
} |
| 635 |
|
| 636 |
echo "" |
| 637 |
echo "EDirect $ver" |
| 638 |
echo "" |
| 639 |
|
| 640 |
case "$cmd" in |
| 641 |
-alive | alive ) |
| 642 |
justAlive=true |
| 643 |
;; |
| 644 |
esac |
| 645 |
case "$cmd" in |
| 646 |
-all | all | -alive | alive ) |
| 647 |
echo "alive" |
| 648 |
DoAlive "https://eutils.ncbi.nlm.nih.gov/entrez/eutils" |
| 649 |
if [ -n "$int" ] |
| 650 |
then |
| 651 |
echo "internal" |
| 652 |
DoAlive "https://eutils-internal.ncbi.nlm.nih.gov/entrez/eutils" |
| 653 |
fi |
| 654 |
echo "" |
| 655 |
|
| 656 |
seconds_end=$(date "+%s") |
| 657 |
seconds=$((seconds_end - seconds_start)) |
| 658 |
|
| 659 |
echo "${INIT}$count queries in $seconds seconds" |
| 660 |
echo "" |
| 661 |
;; |
| 662 |
esac |
| 663 |
|
| 664 |
if [ "$justAlive" = true ] |
| 665 |
then |
| 666 |
if [ "$failed" = true ] |
| 667 |
then |
| 668 |
echo "Failure in test-eutils commands:" |
| 669 |
echo "" |
| 670 |
echo "$failures" |
| 671 |
echo "" |
| 672 |
exit 1 |
| 673 |
fi |
| 674 |
exit 0 |
| 675 |
fi |
| 676 |
|
| 677 |
seconds_start=$(date "+%s") |
| 678 |
count=0 |
| 679 |
|
| 680 |
if [ -n "$int" ] |
| 681 |
then |
| 682 |
echo "Internal" |
| 683 |
else |
| 684 |
echo "External" |
| 685 |
fi |
| 686 |
echo "" |
| 687 |
|
| 688 |
DoCmd |
| 689 |
|
| 690 |
if [ -n "$int" ] |
| 691 |
then |
| 692 |
export EXTERNAL_EDIRECT=true |
| 693 |
export NQUIRE_TIMEOUT=1 |
| 694 |
seconds_start=$(date "+%s") |
| 695 |
count=0 |
| 696 |
|
| 697 |
echo "External" |
| 698 |
echo "" |
| 699 |
|
| 700 |
DoCmd |
| 701 |
fi |
| 702 |
|
| 703 |
if [ "$failed" = true ] |
| 704 |
then |
| 705 |
echo "Failure in test-eutils commands:" |
| 706 |
echo "" |
| 707 |
echo "$failures" |
| 708 |
echo "" |
| 709 |
exit 1 |
| 710 |
fi |
| 711 |
|
| 712 |
echo "Successful completion" |