Debian Codegraph @

download-ncbi-data

raw
1 #!/bin/bash
2
3 # Public domain notice for all NCBI EDirect scripts is located at:
4 # https://www.ncbi.nlm.nih.gov/books/NBK179288/#chapter6.Public_Domain_Notice
5
6 useFtp=true
7 useHttps=false
8
9 while [ $# -gt 0 ]
10 do
11 case "$1" in
12 -ftp )
13 useFtp=true
14 useHttps=false
15 shift
16 ;;
17 -http | -https )
18 useFtp=false
19 useHttps=true
20 shift
21 ;;
22 * )
23 break
24 ;;
25 esac
26 done
27
28 cmd="$1"
29 shift
30
31 downloadFTP() {
32 dir="$1"
33 msk="$2"
34 nquire -lst ftp.ncbi.nlm.nih.gov "$dir" |
35 grep "$msk" |
36 skip-if-file-exists | tee /dev/stderr |
37 nquire -asp ftp.ncbi.nlm.nih.gov "$dir"
38 }
39
40 DoPMCOA() {
41
42 if [ "$useFtp" = true ]
43 then
44 downloadFTP "pub/pmc/oa_bulk" "xml.tar.gz"
45 elif [ "$useHttps" = true ]
46 then
47 downloadFTP "pub/pmc/oa_bulk" "xml.tar.gz"
48 fi
49 }
50
51 DoPMCBioC() {
52
53 if [ "$useFtp" = true ]
54 then
55 downloadFTP "pub/wilbur/BioC-PMC" "xml_unicode.tar.gz"
56 elif [ "$useHttps" = true ]
57 then
58 downloadFTP "pub/wilbur/BioC-PMC" "xml_unicode.tar.gz"
59 fi
60 }
61
62 DoBioconcepts() {
63
64 if [ ! -f "chemical2pubtatorcentral.gz" ]
65 then
66 if [ "$useFtp" = true ]
67 then
68 downloadFTP "pub/lu/PubTatorCentral" "chemical2pubtatorcentral.gz"
69 elif [ "$useHttps" = true ]
70 then
71 downloadFTP "pub/lu/PubTatorCentral" "chemical2pubtatorcentral.gz"
72 fi
73 fi
74
75 if [ ! -f "disease2pubtatorcentral.gz" ]
76 then
77 if [ "$useFtp" = true ]
78 then
79 downloadFTP "pub/lu/PubTatorCentral" "disease2pubtatorcentral.gz"
80 elif [ "$useHttps" = true ]
81 then
82 downloadFTP "pub/lu/PubTatorCentral" "disease2pubtatorcentral.gz"
83 fi
84 fi
85
86 if [ ! -f "gene2pubtatorcentral.gz" ]
87 then
88 if [ "$useFtp" = true ]
89 then
90 downloadFTP "pub/lu/PubTatorCentral" "gene2pubtatorcentral.gz"
91 elif [ "$useHttps" = true ]
92 then
93 downloadFTP "pub/lu/PubTatorCentral" "gene2pubtatorcentral.gz"
94 fi
95 fi
96 }
97
98 DoGeneRIFs() {
99
100 if [ ! -f "generifs_basic.gz" ]
101 then
102 if [ "$useFtp" = true ]
103 then
104 downloadFTP "gene/GeneRIF" "generifs_basic.gz"
105 elif [ "$useHttps" = true ]
106 then
107 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov gene/GeneRIF generifs_basic.gz > generifs_basic.gz
108 fi
109 fi
110
111 if [ ! -f "gene_info.gz" ]
112 then
113 if [ "$useFtp" = true ]
114 then
115 downloadFTP "gene/DATA" "gene_info.gz"
116 elif [ "$useHttps" = true ]
117 then
118 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov gene/DATA gene_info.gz > gene_info.gz
119 fi
120 fi
121
122 if [ ! -f "geneconv.xml" ] && [ -f "gene_info.gz" ]
123 then
124 gunzip -c gene_info.gz |
125 rchive -geneinfo > geneconv.xml
126 fi
127
128 if [ -f "geneconv.xml" ]
129 then
130 if [ ! -f "genename.txt" ]
131 then
132 cat geneconv.xml |
133 xtract -pattern Rec -if Id -and Gene -element Id Gene |
134 sort-table -k 1,1n > genename.txt
135 fi
136
137 if [ ! -f "genesyns.txt" ]
138 then
139 cat geneconv.xml |
140 xtract -pattern Rec -if Id -and Syns -element Id Syns |
141 sort-table -k 1,1n > genesyns.txt
142 fi
143 fi
144 }
145
146 DoMeSHTree() {
147
148 year=$(
149 nquire -get https://nlmpubs.nlm.nih.gov projects/mesh/MESH_FILES/xmlmesh |
150 xtract -mixed -pattern body -block a -if a -contains ".xml" -tab "\n" -terms a |
151 sort -Vr | head -n 1 | sed 's/[a-z.]//g'
152 )
153
154 if [ -z "$year" ]
155 then
156 year="$(date +%Y)"
157 fi
158
159 if [ ! -f "desc${year}.xml" ]
160 then
161 echo "desc${year}.xml"
162 if [ "$useFtp" = true ]
163 then
164 nquire -dwn "ftp://nlmpubs.nlm.nih.gov" "online/mesh/MESH_FILES/xmlmesh" "desc${year}.gz"
165 elif [ "$useHttps" = true ]
166 then
167 nquire -bulk -get https://nlmpubs.nlm.nih.gov projects/mesh/MESH_FILES/xmlmesh desc${year}.gz > desc${year}.gz
168 fi
169 sleep 1
170 if [ ! -f "desc${year}.gz" ]
171 then
172 echo "ERROR - Problem downloading desc${year}.gz" >&2
173 else
174 gunzip -q desc${year}.gz
175 fi
176 sleep 1
177 if [ ! -f "desc${year}.xml" ] && [ -f "desc${year}" ]
178 then
179 mv desc${year} desc${year}.xml
180 fi
181 if [ ! -f "desc${year}.xml" ]
182 then
183 echo "ERROR - Problem converting desc${year}.xml" >&2
184 else
185 chmod og-wx desc${year}.xml
186 chmod u-x desc${year}.xml
187 fi
188 fi
189
190 if [ ! -f "pa${year}.xml" ]
191 then
192 echo "pa${year}.xml"
193 if [ "$useFtp" = true ]
194 then
195 nquire -dwn "ftp://nlmpubs.nlm.nih.gov" "online/mesh/MESH_FILES/xmlmesh" "pa${year}.xml"
196 elif [ "$useHttps" = true ]
197 then
198 nquire -bulk -get https://nlmpubs.nlm.nih.gov/projects mesh/MESH_FILES/xmlmesh pa${year}.xml > pa${year}.xml
199 fi
200 fi
201
202 if [ ! -f "qual${year}.xml" ]
203 then
204 echo "qual${year}.xml"
205 if [ "$useFtp" = true ]
206 then
207 nquire -dwn "ftp://nlmpubs.nlm.nih.gov" "online/mesh/MESH_FILES/xmlmesh" "qual${year}.xml"
208 elif [ "$useHttps" = true ]
209 then
210 nquire -bulk -get https://nlmpubs.nlm.nih.gov/projects mesh/MESH_FILES/xmlmesh qual${year}.xml > qual${year}.xml
211 fi
212 fi
213
214 if [ ! -f "supp${year}.xml" ]
215 then
216 echo "supp${year}.xml"
217 if [ "$useFtp" = true ]
218 then
219 nquire -dwn "ftp://nlmpubs.nlm.nih.gov" "online/mesh/MESH_FILES/xmlmesh" "supp${year}.zip"
220 elif [ "$useHttps" = true ]
221 then
222 nquire -bulk -get https://nlmpubs.nlm.nih.gov/projects mesh/MESH_FILES/xmlmesh supp${year}.zip > supp${year}.zip
223 fi
224
225 if [ -f "supp${year}.zip" ]
226 then
227 unzip -qq supp${year}.zip
228 rm supp${year}.zip
229 chmod og-wx supp${year}.xml
230 chmod u-x supp${year}.xml
231 fi
232 fi
233
234 if [ ! -f "meshconv.xml" ]
235 then
236 rm -f meshtemp.xml
237 if [ -f "supp${year}.xml" ]
238 then
239 cat supp${year}.xml |
240 xtract -wrp "Set,Rec" -pattern SupplementalRecord \
241 -if "SupplementalRecord@SCRClass" -eq 1 \
242 -or "SupplementalRecord@SCRClass" -eq 3 \
243 -wrp "Code" -element "SupplementalRecord/SupplementalRecordUI" \
244 -wrp "Name" -encode "SupplementalRecordName/String" \
245 -wrp "Term" -encode "Term/String" > meshtemp.xml
246 fi
247
248 if [ -f "desc${year}.xml" ]
249 then
250 cat desc${year}.xml |
251 xtract -wrp "Set,Rec" -pattern DescriptorRecord \
252 -wrp "Code" -element "DescriptorRecord/DescriptorUI" \
253 -wrp "Name" -first "DescriptorName/String" \
254 -wrp "Term" -encode "Term/String" \
255 -wrp "Tree" -element "TreeNumberList/TreeNumber" >> meshtemp.xml
256 fi
257
258 if [ -f "meshtemp.xml" ]
259 then
260 cat meshtemp.xml | xtract -wrp Set -pattern Rec -sort Code |
261 transmute -format indent > meshconv.xml
262 rm meshtemp.xml
263 fi
264 fi
265
266 if [ -f "meshconv.xml" ]
267 then
268 if [ ! -f "meshtree.txt" ]
269 then
270 cat meshconv.xml |
271 xtract -pattern Rec -if Tree -element Code -sep "," -element Tree > meshtree.txt
272 fi
273
274 if [ ! -f "meshname.txt" ]
275 then
276 cat meshconv.xml |
277 xtract -pattern Rec -if Name -element Code -sep "," -element Name > meshname.txt
278 fi
279 fi
280 }
281
282 DoTaxnames() {
283
284 if [ ! -f "new_taxdump.tar.gz" ]
285 then
286 if [ "$useFtp" = true ]
287 then
288 nquire -asp ftp.ncbi.nlm.nih.gov "pub/taxonomy/new_taxdump" "new_taxdump.tar.gz"
289 elif [ "$useHttps" = true ]
290 then
291 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov pub/taxonomy/new_taxdump new_taxdump.tar.gz > new_taxdump.tar.gz
292 fi
293 fi
294
295 if [ -f "new_taxdump.tar.gz" ]
296 then
297 if [ ! -f "taxnames.txt" ]
298 then
299 tar -zxf new_taxdump.tar.gz names.dmp
300 cat names.dmp | cut -f 1,3,7 |
301 grep -e "scientific name" -e "common name" |
302 cut -f 1,2 > taxnames.txt
303 rm names.dmp
304 fi
305
306 if [ ! -f "lineages.txt" ]
307 then
308 tar -zxf new_taxdump.tar.gz fullnamelineage.dmp
309 cat fullnamelineage.dmp | cut -f 1,3,5 | sort -k 1,1n > lineages.txt
310 rm fullnamelineage.dmp
311 fi
312 fi
313 }
314
315 DoTaxonInfo() {
316
317 if [ ! -f "new_taxdump.tar.gz" ]
318 then
319 if [ "$useFtp" = true ]
320 then
321 nquire -asp ftp.ncbi.nlm.nih.gov "pub/taxonomy/new_taxdump" "new_taxdump.tar.gz"
322 elif [ "$useHttps" = true ]
323 then
324 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov pub/taxonomy/new_taxdump new_taxdump.tar.gz > new_taxdump.tar.gz
325 fi
326 fi
327
328 if [ -f "new_taxdump.tar.gz" ]
329 then
330 rm -f *.dmp
331 tar -tvf new_taxdump.tar.gz |
332 tr -s ' ' '\t' | cut -f 9 |
333 skip-if-file-exists |
334 while read fl
335 do
336 tar -zxf new_taxdump.tar.gz "$fl"
337 done
338 fi
339
340 rm -f taxoninfo.xml
341 rchive -taxon AC > taxoninfo.xml
342 }
343
344 DoSerials() {
345
346 year=""
347
348 files=$(
349 # obtain names of base and update files for several years
350 nquire -bulk -get https://ftp.nlm.nih.gov projects/serfilelease |
351 sed -ne 's,.* href="\([^/"]*\)".*,\1,p' | grep -v marcxml
352 )
353
354 if [ -n "$files" ]
355 then
356 year=$(
357 # get latest year embedded in file names
358 echo "$files" | grep serfilebase | sort -Vr | head -n 1 |
359 sed -e 's/serfilebase.//' -e 's/.xml//'
360 )
361 if [ -n "$year" ]
362 then
363 # limit to serfilebase and serfile updates for current year
364 files=$( echo "$files" | grep "$year" )
365 fi
366 fi
367
368 basefile="serfilebase.${year}.xml"
369 updates=$( echo "$files" | grep -v serfilebase | sort -V )
370
371 if [ ! -f "serials.txt" ] && [ ! -s "$basefile" ]
372 then
373 echo "$basefile" >&2
374 time nquire -bulk -get https://ftp.nlm.nih.gov projects/serfilelease "${basefile}" > $basefile
375 fi
376
377 if [ ! -f "serials.txt" ] && [ -s "$basefile" ]
378 then
379 echo "# ${basefile}" >> serials.txt
380 cat "$basefile" |
381 xtract -pattern NLMCatalogRecord -def "-" -element NlmUniqueID PublicationInfo/Country >> serials.txt
382 cat "$basefile" |
383 xtract -pattern DeleteCatalogRecord -block NlmUniqueID -element NlmUniqueID -lbl "-" -deq "\n" >> serials.txt
384 fi
385
386 if [ -f "serials.txt" ] && [ -n "$updates" ]
387 then
388 echo "$updates" |
389 while read serfile
390 do
391 if [ ! -s "$serfile" ]
392 then
393 echo "$serfile" >&2
394 time nquire -bulk -get https://ftp.nlm.nih.gov projects/serfilelease "${serfile}" > $serfile
395 fi
396 if [ -s "$serfile" ]
397 then
398 if ! grep -Fq "$serfile" serials.txt
399 then
400 echo "# ${serfile}" >> serials.txt
401 cat "$serfile" |
402 xtract -pattern NLMCatalogRecord -def "-" -element NlmUniqueID PublicationInfo/Country >> serials.txt
403 cat "$serfile" |
404 xtract -pattern DeleteCatalogRecord -block NlmUniqueID -element NlmUniqueID -lbl "-" -deq "\n" >> serials.txt
405 fi
406 fi
407 done
408 fi
409 }
410
411 finish_jtas() {
412
413 tr -s ' ' |
414 sed -e 's/^ *//g' -e 's/ *$//g' |
415 sort-table -k 1,1f -k 3,3n -k 4,4nr -k 2,2f |
416 uniq -i |
417 awk -F '\t' '(NR == 1 || $1 != prev_key) { if (NR > 1) { print prev_line }; prev_key = $1; prev_line = $0 } END { print prev_line }' |
418 cut -f 1,2
419 }
420
421 multi_jtas() {
422
423 tr -s ' ' |
424 sed -e 's/^ *//g' -e 's/ *$//g' |
425 sort-table -k 1,1f -k 3,3n -k 4,4nr -k 2,2f |
426 uniq -i |
427 awk -F '\t' '(NR > 1 && $1 == prev_key && $4 == prev_flag) { print } (NR == 1 || $1 != prev_key) { print; prev_key = $1; prev_flag = $4 }' |
428 cut -f 1,2 | sort | uniq |
429 awk -F '\t' '{ if (NR == 1 || $1 != prev_key) { if (NR > 1) { print saved }; prev_key = $1; saved = $1 "\t" $2 } else { saved = saved " | " $2 } } END { print saved }'
430 }
431
432 JourCache() {
433
434 if [ "$useFtp" = true ]
435 then
436 nquire -ftp ftp.ncbi.nlm.nih.gov pubmed jourcache.xml
437 elif [ "$useHttps" = true ]
438 then
439 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov pubmed jourcache.xml
440 fi
441 }
442
443 DoJournals() {
444
445 if [ ! -f "jourconv.xml" ]
446 then
447 if [ ! -f "jourcache.xml" ]
448 then
449 if [ -f "serials.txt" ]
450 then
451 JourCache |
452 grep -v DOCTYPE | grep -v ELEMENT | grep -v ATTLIST |
453 xtract -transfigure serials.txt \
454 -head "<JournalCache>" -tail "</JournalCache>" \
455 -pattern Journal -pkg Journal \
456 -block "Journal/*" -element "*" \
457 -block Journal -wrp Country -translate NlmUniqueID |
458 transmute -format > jourcache.xml
459 else
460 JourCache |
461 grep -v DOCTYPE | grep -v ELEMENT | grep -v ATTLIST |
462 transmute -format > jourcache.xml
463 fi
464 fi
465
466 if [ -f "jourcache.xml" ]
467 then
468 cat jourcache.xml |
469 xtract -set Set -pattern Journal \
470 -if Name -and MedAbbr \
471 -NAME Name -ABRV MedAbbr -ACTV ActivityFlag \
472 -group Name -pkg Rec \
473 -wrp Key -jour Name -wrp Abrv -jour "&ABRV" \
474 -wrp Indx -jour "&NAME" -wrp Name -element "&NAME" \
475 -wrp Type -lbl "1" -wrp Flag -element "&ACTV" \
476 -group MedAbbr -pkg Rec \
477 -wrp Key -jour MedAbbr -wrp Abrv -jour "&ABRV" \
478 -wrp Indx -jour "&NAME" -wrp Name -element "&NAME" \
479 -wrp Type -lbl "2" -wrp Flag -element "&ACTV" \
480 -group Alias \
481 -block Alias -pkg Rec \
482 -wrp Key -jour Alias -wrp Abrv -jour "&ABRV" \
483 -wrp Indx -jour "&NAME" -wrp Name -element "&NAME" \
484 -wrp Type -lbl "3" -wrp Flag -element "&ACTV" \
485 -group Journal -if "&ABRV" -equals "bioRxiv" \
486 -block Journal -pkg Rec \
487 -wrp Key -lbl "biorxiv.org" -wrp Abrv -jour "&ABRV" \
488 -wrp Indx -jour "&NAME" -wrp Name -element "&NAME" \
489 -wrp Type -lbl "3" -wrp Flag -element "&ACTV" \
490 -block Journal -pkg Rec \
491 -wrp Key -lbl "biorxivorg" -wrp Abrv -jour "&ABRV" \
492 -wrp Indx -jour "&NAME" -wrp Name -element "&NAME" \
493 -wrp Type -lbl "3" -wrp Flag -element "&ACTV" |
494 xtract -set Set -pattern Rec \
495 -group Rec \
496 -block Rec -pkg Rec \
497 -wrp Key -lower Key -wrp Abrv -element Abrv \
498 -wrp Indx -element Indx -wrp Name -element Name \
499 -wrp Type -element Type -wrp Flag -element Flag |
500 xtract -set Set -pattern Rec \
501 -group Rec \
502 -block Rec -pkg Rec \
503 -wrp Key -element Key -wrp Abrv -element Abrv \
504 -wrp Indx -element Indx -wrp Name -element Name \
505 -wrp Type -element Type -wrp Flag -element Flag \
506 -block Rec -if Key -starts-with "journal " -pkg Rec \
507 -wrp Key -pfx "<Key>the " -element Key -wrp Abrv -element Abrv \
508 -wrp Indx -element Indx -wrp Name -element Name \
509 -wrp Type -element Type -wrp Flag -element Flag \
510 -block Rec -if Key -starts-with "the journal " -pkg Rec \
511 -wrp Key -element "Key[5:]" -wrp Abrv -element Abrv \
512 -wrp Indx -element Indx -wrp Name -element Name \
513 -wrp Type -element Type -wrp Flag -element Flag |
514 transmute -format > jourconv.xml
515 fi
516 fi
517
518 if [ -f "jourconv.xml" ]
519 then
520 if [ ! -f "jourabrv.txt" ]
521 then
522 cat jourconv.xml | xtract -pattern Rec -element Key Abrv Type Flag | finish_jtas > jourabrv.txt
523 fi
524 if [ ! -f "jourindx.txt" ]
525 then
526 cat jourconv.xml | xtract -pattern Rec -element Key Indx Type Flag | finish_jtas > jourindx.txt
527 fi
528 if [ ! -f "journame.txt" ]
529 then
530 cat jourconv.xml | xtract -pattern Rec -element Key Name Type Flag | finish_jtas > journame.txt
531 fi
532 if [ ! -f "joursets.txt" ]
533 then
534 cat jourconv.xml | xtract -pattern Rec -element Key Name Type Flag | multi_jtas > joursets.txt
535 fi
536 if [ ! -f "jourmaps.xml" ] && [ -f "jourindx.txt" ]
537 then
538 cat jourindx.txt | tbl2xml -set JournalMaps -rec Journal Key Indx > jourmaps.xml
539 fi
540 fi
541 }
542
543 DoNIHOCC() {
544 base_url=""
545 new_file_date=""
546
547 latest_occ=$(
548 nquire -bulk -get https://api.figshare.com/v2/collections/4586573/articles |
549 xtract -pattern anon -sort-rev published_date |
550 xtract -pattern anon -position first -element "*"
551 )
552 if [ -n "$latest_occ" ]
553 then
554 base_url=$( echo "$latest_occ" | xtract -pattern anon -element url )
555 new_file_date=$( echo "$latest_occ" | xtract -pattern anon -element published_date | cut -c 1-10 )
556 fi
557
558 if [ -f "open_citation_collection.zip" ] && [ -n "$new_file_date" ]
559 then
560 curr_file_date=$( date -r open_citation_collection.zip "+%Y-%m-%d" )
561 if [ -n "$curr_file_date" ]
562 then
563 if [[ "$new_file_date" > "$curr_file_date" ]]
564 then
565 echo "Removing old $curr_file_date download of open_citation_collection.zip"
566 rm -f "open_citation_collection.zip"
567 else
568 echo "Current public $new_file_date version of open_citation_collection.zip is not later than existing $curr_file_date download"
569 fi
570 fi
571 fi
572
573 if [ ! -f "open_citation_collection.zip" ] && [ -n "$base_url" ]
574 then
575 download_url=$(
576 nquire -get "$base_url" |
577 xtract -pattern opt -group files \
578 -if name -equals open_citation_collection.zip \
579 -element download_url
580 )
581 if [ -n "$download_url" ]
582 then
583 orig_name=$( echo "${download_url}" | tr '/' '\n' | tail -n 1 )
584 echo "Downloading new $new_file_date version of open_citation_collection.zip will likely take at least an hour"
585 nquire -get "$download_url" > open_citation_collection.zip
586 if [ -f "open_citation_collection.zip" ]
587 then
588 echo "Downloading open_citation_collection.zip is complete"
589 else
590 echo "Downloading of open_citation_collection.zip failed"
591 fi
592 fi
593 fi
594 }
595
596 prepare_book_list() {
597 echo "<OpenAccessSubset>"
598 while IFS=$'\t' read pth titl pblshr dt accn upd
599 do
600 if [ -n "$accn" ]
601 then
602 echo " <Book>"
603 echo " <Accn>$accn</Accn>"
604 echo " <Path>$pth</Path>"
605 echo " <Title>$titl</Title>"
606 echo " </Book>"
607 fi
608 done
609 echo "</OpenAccessSubset>"
610 }
611
612 case "$cmd" in
613 -h | -help | --help | help )
614 cat <<EOF
615 USAGE: $0
616 bioconcepts | generif | meshtree | taxnames | taxoninfo | serials | journals | nihocc |
617 pmc-oa | pmc-bioc | oa-list | oa-book | carotene | globin | human | smear
618 EOF
619 exit 0
620 ;;
621 pmc-oa | -pmc-oa )
622 DoPMCOA
623 exit 0
624 ;;
625 pmc-bioc | -pmc-bioc )
626 DoPMCBioC
627 exit 0
628 ;;
629 bioconcepts | -bioconcepts )
630 DoBioconcepts
631 exit 0
632 ;;
633 generif | -generif | generifs | -generifs )
634 DoGeneRIFs
635 exit 0
636 ;;
637 meshtree | -meshtree )
638 DoMeSHTree
639 exit 0
640 ;;
641 taxnames | -taxnames | taxonomy | -taxonomy | lineages | -lineages )
642 DoTaxnames
643 exit 0
644 ;;
645 taxoninfo | -taxoninfo )
646 DoTaxonInfo
647 exit 0
648 ;;
649 serials | -serials )
650 DoSerials
651 exit 0
652 ;;
653 journals | -journals )
654 DoJournals
655 exit 0
656 ;;
657 nihocc | -nihocc )
658 DoNIHOCC
659 exit 0
660 ;;
661 oa-list | -oa-list )
662 if [ ! -f "books.xml" ]
663 then
664 if [ "$useFtp" = true ]
665 then
666 nquire -ftp ftp.ncbi.nlm.nih.gov pub/litarch file_list.txt |
667 prepare_book_list > books.xml
668 elif [ "$useHttps" = true ]
669 then
670 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov pub/litarch file_list.txt |
671 prepare_book_list > books.xml
672 fi
673 fi
674 exit 0
675 ;;
676 oa-book | -oa-book )
677 accn="$1"
678 shift
679 if [ ! -f "books.xml" ]
680 then
681 if [ "$useFtp" = true ]
682 then
683 nquire -ftp ftp.ncbi.nlm.nih.gov pub/litarch file_list.txt |
684 prepare_book_list > books.xml
685 elif [ "$useHttps" = true ]
686 then
687 nquire -bulk -get https://ftp.ncbi.nlm.nih.gov pub/litarch file_list.txt |
688 prepare_book_list > books.xml
689 fi
690 fi
691 cat books.xml |
692 xtract -pattern Book -if Accn -equals "$accn" -element Path |
693 while read pth
694 do
695 if [ ! -f "$pth" ]
696 then
697 nquire -dwn ftp.ncbi.nlm.nih.gov "pub/litarch" "$pth"
698 fi
699 done
700 exit 0
701 ;;
702 carotene | -carotene )
703 if [ ! -f "carotene.xml" ]
704 then
705 nquire -asp ftp.ncbi.nlm.nih.gov "entrez/entrezdirect/samples" "carotene.xml.zip"
706 unzip -qq carotene.xml.zip
707 rm carotene.xml.zip
708 fi
709 exit 0
710 ;;
711 globin | -globin )
712 if [ ! -f "globin.xml" ]
713 then
714 nquire -asp ftp.ncbi.nlm.nih.gov "entrez/entrezdirect/samples" "globin.xml.zip"
715 unzip -qq globin.xml.zip
716 rm globin.xml.zip
717 fi
718 exit 0
719 ;;
720 human | -human )
721 if [ ! -f "human.xml" ]
722 then
723 nquire -asp ftp.ncbi.nlm.nih.gov "entrez/entrezdirect/samples" "carhumanotene.xml.zip"
724 unzip -qq human.xml.zip
725 rm human.xml.zip
726 fi
727 exit 0
728 ;;
729 smear | -smear )
730 if [ ! -f "smear.asn" ]
731 then
732 nquire -asp ftp.ncbi.nlm.nih.gov "entrez/entrezdirect/samples" "smear.asn.zip"
733 unzip -qq smear.asn.zip
734 rm smear.asn.zip
735 fi
736 exit 0
737 ;;
738 natural-earth | -natural-earth )
739 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip"
740 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_disputed_areas.zip"
741 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces.zip"
742 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_geography_marine_polys.zip"
743 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_lakes.zip"
744 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_minor_islands.zip"
745 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_reefs.zip"
746 curl -Ls -O "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_rivers_lake_centerlines.zip"
747 exit 0
748 ;;
749 * )
750 echo "ERROR - Unrecognized command '$cmd'" >&2
751 ;;
752 esac