Debian Codegraph @

test-edirect

raw
1 #!/bin/bash -norc
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-edirect
28 #
29 # Author: Jonathan Kans
30 #
31 # Version Creation Date: 8/5/20
32 #
33 # ==========================================================================
34
35 # Entrez Direct - EDirect
36
37 SECONDS=0
38
39 useTimer=false
40
41 skipTimer=true
42
43 seconds_start=$(date "+%s")
44
45 sec_start=$(date "+%s")
46
47 while [ $# -gt 0 ]
48 do
49 case "$1" in
50 -timer | -timed )
51 useTimer=true
52 shift
53 ;;
54 -test )
55 shift
56 (
57 export EDIRECT_TRACE=true
58 esearch -timer -db biosample -query "package mims metagenome/environmental, water version 6 0 [PROP]" | tee /dev/tty |
59 efilter -query "ncbi [FILT] AND biosample sra [FILT]" | tee /dev/tty |
60 elink -target bioproject -log | tee /dev/tty |
61 xtract -pattern ENTREZ_DIRECT -tab ", " -sfx " seconds" -element Elapsed -sfx " records" -element Count
62 )
63 exit 0
64 ;;
65 -* | * )
66 exec >&2
67 echo "$0: Unrecognized option $1"
68 exit 1
69 ;;
70 esac
71 done
72
73 PrintTimeAndTitle() {
74
75 ttl="$1"
76
77 seconds_end=$(date "+%s")
78 seconds=$((seconds_end - seconds_start))
79
80 if [ "$useTimer" = true ] && [ "$skipTimer" = false ]
81 then
82 echo ""
83 if [ "$seconds" -eq 1 ]
84 then
85 echo "$seconds second"
86 else
87 echo "$seconds seconds"
88 fi
89 fi
90
91 skipTimer=false
92
93 seconds_start=$(date "+%s")
94
95 ttl=$( echo "$ttl" | tr '[:lower:]' '[:upper:]' )
96
97 echo ""
98 echo ""
99 echo "$ttl"
100 if [ ! -t 1 ]
101 then
102 echo "$ttl" >&2
103 fi
104 echo ""
105 }
106
107 PrintStepTime() {
108
109 sec_end=$(date "+%s")
110 sec=$((sec_end - sec_start))
111
112 if [ "$useTimer" = true ]
113 then
114 echo "$sec seconds"
115 fi
116
117 sec_start=$(date "+%s")
118 }
119
120 # skipTimer initial value of true will not print the elapsed time after printing this header
121
122 echo ""
123 einfo -help | head -n 3 | sed 's/einfo /EDirect /g'
124 sleep 2
125
126 # regular tests
127
128 PrintTimeAndTitle "Info Help"
129
130 einfo -help | head -n 13
131
132 PrintTimeAndTitle "Field Example"
133
134 einfo -db pubmed |
135 xtract -pattern Field \
136 -if Name -equals ALL -element "*" |
137 transmute -format
138
139 PrintTimeAndTitle "Link Example"
140
141 einfo -db pubmed |
142 xtract -pattern Link \
143 -if Name -starts-with pubmed_protein -element "*" |
144 transmute -format
145
146 PrintTimeAndTitle "Indexed Fields"
147
148 einfo -db pubmed |
149 xtract -pattern Field \
150 -if IsDate -equals Y -and IsHidden -equals N \
151 -pfx "[" -sep "]\t" -element Name,FullName |
152 sort -t $'\t' -k 2f
153
154 PrintTimeAndTitle "First Authors"
155
156 efetch -db pubmed -id 6271474,5685784,4882854,6243420 -format xml |
157 xtract -pattern PubmedArticle -element MedlineCitation/PMID "#Author" \
158 -block Author -position first -sep " " -element Initials,LastName \
159 -block Article -element ArticleTitle
160
161 PrintTimeAndTitle "Formatted Authors"
162
163 efetch -db pubmed -id 1413997,6301692,781293 -format xml |
164 xtract -pattern PubmedArticle -element MedlineCitation/PMID \
165 -block PubDate -sep "-" -element Year,Month,MedlineDate \
166 -block Author -sep " " -tab "" \
167 -element "&COM" Initials,LastName -COM "(|)" |
168 perl -pe 's/(\t[^\t|]*)\|([^\t|]*)$/$1 and $2/; s/\|([^|]*)$/, and $1/; s/\|/, /g'
169
170 PrintTimeAndTitle "PMID in Variable"
171
172 efetch -db pubmed -id 3201829,6301692,781293 -format xml |
173 xtract -pattern PubmedArticle -PMID MedlineCitation/PMID \
174 -block Author -element "&PMID" \
175 -sep " " -tab "\n" -element Initials,LastName
176
177 PrintTimeAndTitle "Medical Subject Headings"
178
179 efetch -db pubmed -id 6092233,2539356,1937004 -format xml |
180 xtract -pattern PubmedArticle -element MedlineCitation/PMID \
181 -block MeshHeading \
182 -subset DescriptorName -pfc "\n" -sep "|" -element @MajorTopicYN,DescriptorName \
183 -subset QualifierName -pfc " / " -sep "|" -element @MajorTopicYN,QualifierName |
184 sed -e 's/N|//g' -e 's/Y|/*/g'
185
186 PrintTimeAndTitle "Book Authors and Editors"
187
188 efetch -db pubmed -id 21433338 -format xml |
189 xtract -pattern PubmedBookArticle \
190 -path BookDocument.AuthorList.Author -element LastName \
191 -path BookDocument.Book.AuthorList.Author -element LastName
192
193 PrintTimeAndTitle "Heterogeneous Data"
194
195 efetch -db pubmed -id 21433338,17247418 -format xml |
196 xtract -pattern "PubmedArticleSet/*" \
197 -group "Book/AuthorList" -element LastName \
198 -group "Article/AuthorList" -element LastName
199
200 PrintTimeAndTitle "Multiple Links"
201
202 esearch -db pubmed -query "conotoxin AND dopamine [MAJR]" |
203 efilter -mindate 2011 -maxdate 2018 |
204 elink -target protein -cmd neighbor -name pubmed_protein_refseq |
205 xtract -pattern LinkSet -if Link/Id -element IdList/Id Link/Id
206
207 PrintTimeAndTitle "Link Counts"
208
209 elink -db protein -id NP_000509 -target pubmed |
210 elink -target protein -cmd neighbor -name pubmed_protein |
211 xtract -wrp "Set,Rec" -pattern LinkSet \
212 -wrp "Uid" -element IdList/Id -wrp "Count" -num Link/Id |
213 xtract -pattern Rec -if Count -ge 50 -element Uid Count
214
215 PrintTimeAndTitle "Markup Correction"
216
217 for id in 8475897 8988608 9698410 10194376 15949988 16271163 17282049 \
218 19793852 20968289 21505190 21892341 22106757 22360335 22472775 22785267 \
219 23095895 23095897 25435818 26433210 27672066 28635620 28940123 29547395 \
220 29869631 29869640 29944225
221 do
222 efetch -db pubmed -format xml -id "$id" |
223 xtract -pattern PubmedArticle -plg "\n\n" -sep "\n\n" -tab "\n\n" \
224 -element MedlineCitation/PMID ArticleTitle Abstract/AbstractText
225 done
226
227 PrintTimeAndTitle "XML Normalization"
228
229 echo "assembly 443538 Stat biosample 3737421 SampleData gene 5053 Summary medgen 1413 Name" |
230 xargs -n 3 sh -c 'efetch -db "$0" -id "$1" -format docsum |
231 xtract -pattern DocumentSummary -sep " | " -tab " - " -ret "\n\n" -lbl "$0" -element Id "$2"'
232
233 PrintTimeAndTitle "Record Counts"
234
235 echo "diphtheria measles pertussis polio tuberculosis" |
236 xargs -n 1 sh -c 'esearch -db pubmed -query "$0 [MESH]" |
237 efilter -days 365 -datetype PDAT |
238 xtract -pattern ENTREZ_DIRECT -lbl "$0" -element Count'
239
240 PrintTimeAndTitle "Citation Lookup"
241
242 esearch -db pubmed -query "Beadle GW [AUTH] AND Tatum EL [AUTH]" |
243 elink -cited |
244 efilter -days 365 |
245 efetch -format abstract -start 3 -stop 5
246
247 PrintTimeAndTitle "Stopwords and Stemming"
248
249 pm=$( efetch -db pubmed -id 2005826 -format xml )
250 echo "$pm" | xtract -pattern PubmedArticle -sep " " -words ArticleTitle
251 echo "$pm" | xtract -stops -pattern PubmedArticle -sep " " -words ArticleTitle
252 echo "$pm" | xtract -stems -pattern PubmedArticle -sep " " -words ArticleTitle
253 echo "$pm" | xtract -stops -stems -pattern PubmedArticle -sep " " -words ArticleTitle
254
255 PrintTimeAndTitle "DOI Extraction"
256
257 esearch -db pubmed -query "Rowley JD [AUTH]" |
258 efetch -format xml |
259 xtract -wrp PubmedArticleSet -pattern PubmedArticle -sort MedlineCitation/PMID |
260 xtract -pattern PubmedArticle \
261 -block ArticleId -if @IdType -equals doi \
262 -doi ArticleId |
263 tail -n 25
264
265 PrintTimeAndTitle "Combining Independent Queries"
266
267 amyl=$(
268 esearch -db protein -query "amyloid* [PROT]" -log | tee /dev/tty |
269 elink -target pubmed |
270 xtract -pattern ENTREZ_DIRECT -sep "\n" -element Id
271 )
272 apoe=$(
273 esearch -db gene -query "apo* [GENE]" -log | tee /dev/tty |
274 elink -target pubmed |
275 xtract -pattern ENTREZ_DIRECT -sep "\n" -element Id
276 )
277 both=$( intersect-uid-lists <( echo "$amyl" ) <( echo "$apoe" ) )
278 echo "$both" |
279 efetch -db pubmed -format docsum |
280 xtract -mixed -pattern DocumentSummary -element Id Title |
281 cat -v
282
283 # esearch -db protein -query "amyloid* [PROT]" -log -timer | tee /dev/tty |
284 # elink -target pubmed -label prot_cit | tee /dev/tty |
285 # esearch -db gene -query "apo* [GENE]" | tee /dev/tty |
286 # elink -target pubmed -label gene_cit | tee /dev/tty |
287 # esearch -query "(#prot_cit) AND (#gene_cit)" | tee /dev/tty |
288 # efetch -format docsum |
289 # xtract -mixed -pattern DocumentSummary -element Id Title |
290 # cat -v
291
292 PrintTimeAndTitle "Formatting Tag Removal"
293
294 efetch -db pmc -id 4729119 -format xml |
295 xtract -mixed -pattern article -group p \
296 -position first -tab "\n\n" -element p -plain p |
297 fold -w 70 -s | awk '{$1=$1};1'
298
299 PrintTimeAndTitle "Peptide Sequences"
300
301 esearch -db protein -query "conotoxin AND mat_peptide [FKEY]" |
302 efetch -format gpc |
303 xtract -insd complete mat_peptide "%peptide" product mol_wt peptide |
304 grep -i conotoxin | sort -t $'\t' -u -k 2,2n | head -n 8
305
306 PrintTimeAndTitle "Vitamin Biosynthesis"
307
308 res=$(
309 esearch -db pubmed -query "lycopene cyclase" -log -timer | tee /dev/tty |
310 elink -related |
311 elink -target protein | tee /dev/tty |
312 efilter -organism rodents -source refseq | tee /dev/tty |
313 efetch -format uid
314 )
315 num=$( echo "$res" | wc -l | tr -d ' ' )
316 if [ -n "$num" ] && [ "$num" -lt 200 ]
317 then
318 echo "$res" |
319 efetch -db protein -format docsum |
320 xtract -pattern DocumentSummary -element AccessionVersion Title |
321 grep -i carotene | sort -V
322 else
323 echo "Too many returns ($num) suggests failure of a step"
324 fi
325
326 PrintTimeAndTitle "BioSample-BioProject Link"
327
328 res=$( esearch -timer -db biosample -query "package mims metagenome/environmental, water version 6 0 [PROP]" | tee /dev/tty |
329 efilter -query "ncbi [FILT] AND biosample sra [FILT]" | tee /dev/tty |
330 elink -target bioproject -cmd uid -log
331 )
332 if [ -n "$res" ]
333 then
334 num=$( echo "$res" | wc -l | tr -d ' ' )
335 if [ "$num" -eq 1 ]
336 then
337 echo "$num record"
338 else
339 echo "$num records"
340 fi
341 fi
342
343 PrintTimeAndTitle "Coding Sequences"
344
345 efetch -db nuccore -id J01636.1 -format gbc |
346 xtract -insd CDS gene sub_sequence
347
348 PrintTimeAndTitle "Sequence Subregion"
349
350 efetch -db nuccore -id U54469 -format gbc |
351 xtract -pattern INSDSeq -nucleic INSDSeq_sequence[2881:1] |
352 fold -w 60
353
354 PrintTimeAndTitle "Gene Spanning Origin"
355
356 echo "NC_003287 II CP023138 CKW46_00005 HQ009529 CvBV-C6_1" |
357 join-into-groups-of 2 |
358 tr ',' '\t' |
359 while IFS=$'\t' read accn gene
360 do
361 efetch -db nuccore -id "$accn" -format gb |
362 xtract -insdx CDS gene locus_tag product feat_location sub_sequence translation |
363 xtract -pattern Rec -select gene -equals "$gene" -or locus_tag -equals "$gene" |
364 xtract -pattern Rec -tab "\n" -element accession -first gene,locus_tag \
365 -element product feat_location translation -cds2prot sub_sequence
366 echo ""
367 done
368
369 PrintTimeAndTitle "Amino Acid Composition"
370
371 abbrev=( Ala Asx Cys Asp Glu Phe Gly His Ile \
372 Xle Lys Leu Met Asn Pyl Pro Gln Arg \
373 Ser Thr Sec Val Trp Xxx Tyr Glx )
374
375 AminoAcidComp() {
376 local count
377 while read num lttr
378 do
379 idx=$(printf %i "'$lttr'")
380 ofs=$((idx-97))
381 count[$ofs]="$num"
382 done <<< "$1"
383 for i in {0..25}
384 do
385 echo -e "${abbrev[$i]}\t${count[$i]-0}"
386 done |
387 sort
388 }
389
390 AminoAcidJoin() {
391 result=""
392 while read acc seq gene
393 do
394 comp="$(echo "$seq" | tr A-Z a-z | sed 's/[^a-z]//g' | fold -w 1 | sort-uniq-count)"
395 current=$(AminoAcidComp "$comp")
396 current=$(echo -e "GENE\t$gene\n$current")
397 if [ -n "$result" ]
398 then
399 result=$(join -t $'\t' <(echo "$result") <(echo "$current"))
400 else
401 result=$current
402 fi
403 done
404 echo "$result" |
405 grep -e "GENE" -e "[1-9]"
406 }
407
408 ids="NP_001172026,NP_000509,NP_004001,NP_001243779"
409 efetch -db protein -id "$ids" -format gpc |
410 xtract -insd INSDSeq_sequence CDS gene |
411 AminoAcidJoin
412
413 PrintTimeAndTitle "Chromosome Assignments"
414
415 esearch -db gene -query "calmodulin * [PFN] AND mammalia [ORGN]" |
416 efetch -format docsum |
417 xtract -pattern DocumentSummary \
418 -def "-" -element Id Name MapLocation ScientificName |
419 head -n 30
420
421 PrintTimeAndTitle "Genome Range"
422
423 esearch -db gene -query "Homo sapiens [ORGN] AND Y [CHR]" |
424 efilter -status alive | efetch -format docsum |
425 xtract -pattern DocumentSummary -NAME Name -DESC Description \
426 -block GenomicInfoType -if ChrLoc -equals Y \
427 -min ChrStart,ChrStop -element "&NAME" "&DESC" |
428 sort -k 1,1n | cut -f 2- |
429 grep -v pseudogene | grep -v uncharacterized | grep -v '^LOC' |
430 between-two-genes ASMT IL3RA |
431 align-columns -g 4
432
433 PrintTimeAndTitle "Centromere Position"
434
435 nquire -ftp ftp.ncbi.nlm.nih.gov pub/gdp ideogram_9606_GCF_000001305.14_850_V1 |
436 grep acen | cut -f 1,2,6,7 | grep "^X"
437
438 PrintTimeAndTitle "Gene Regions"
439
440 esearch -db gene -query "DDT [GENE] AND mouse [ORGN]" |
441 efetch -format docsum |
442 xtract -pattern GenomicInfoType -element ChrAccVer ChrStart ChrStop |
443 xargs -n 3 sh -c 'efetch -db nuccore -format gb \
444 -id "$0" -chr_start "$1" -chr_stop "$2"'
445
446 PrintTimeAndTitle "Recursive Data"
447
448 esearch -db gene -query "rbcL [GENE] AND maize [ORGN]" |
449 efetch -format xml |
450 xtract -pattern Entrezgene -block "**/Gene-commentary" \
451 -if Gene-commentary_type@value -equals genomic \
452 -tab "\n" -element Gene-commentary_accession |
453 sort | uniq
454
455 PrintTimeAndTitle "Gene Products"
456
457 for sym in HBB BRCA2 CFTR RAG1
458 do
459 esearch -db gene -query "$sym [GENE] AND human [ORGN]" |
460 efilter -query "alive [PROP]" | efetch -format docsum |
461 xtract -pattern GenomicInfoType \
462 -element ChrAccVer ChrStart ChrStop |
463 while read acc str stp
464 do
465 efetch -db nuccore -format gbc \
466 -id "$acc" -chr_start "$str" -chr_stop "$stp" |
467 xtract -insd CDS,mRNA INSDFeature_key "#INSDInterval" \
468 gene "%transcription" "%translation" \
469 product transcription translation |
470 cut -c 1-250 |
471 grep -i $'\t'"$sym"$'\t'
472 done
473 done
474
475 PrintTimeAndTitle "Unfiltered Gene Lookup"
476
477 for sym in ATP6 ATP7B CBD DMD HFE PAH PRNP TTN
478 do
479 fst=$( esearch -db gene -query "$sym [GENE]" -organism human )
480 if [ -z "$fst" ]
481 then
482 echo "ESEARCH FAILURE FOR $sym"
483 continue
484 fi
485 scd=$( echo "$fst" | efetch -raw -format docsum )
486 if [ -z "$scd" ]
487 then
488 echo "EFETCH FAILURE FOR $sym, ESEARCH RESULT IS"
489 echo "$fst"
490 continue
491 fi
492 thd=$( echo "$scd" |
493 xtract -pattern DocumentSummary -def "-" -lbl "${sym}" \
494 -element NomenclatureSymbol Id,DocumentSummary@uid Description CommonName )
495 if [ -z "$thd" ]
496 then
497 echo "XTRACT FAILURE FOR $sym, EFETCH RESULT IS"
498 echo "$scd"
499 continue
500 fi
501 echo "$thd"
502 done
503
504 PrintTimeAndTitle "Protein Coding Genes"
505
506 for sym in MT-ATP6 BRCA2 CFTR HBB HFE IL9R OPN1MW PAH
507 do
508 fst=$( esearch -db gene -query "$sym [PREF]" -organism human )
509 if [ -z "$fst" ]
510 then
511 echo "ESEARCH FAILURE FOR $sym"
512 continue
513 fi
514 scd=$( echo "$fst" | efetch -raw -format docsum )
515 if [ -z "$scd" ]
516 then
517 echo "EFETCH FAILURE FOR $sym, ESEARCH RESULT IS"
518 echo "$fst"
519 continue
520 fi
521 thd=$( echo "$scd" |
522 xtract -pattern DocumentSummary -def "-" \
523 -lbl "${sym}" -element Id,DocumentSummary@uid Chromosome Description )
524 if [ -z "$thd" ]
525 then
526 echo "XTRACT FAILURE FOR $sym, EFETCH RESULT IS"
527 echo "$scd"
528 continue
529 fi
530 echo "$thd"
531 done
532
533 PrintTimeAndTitle "Taxonomic Names"
534
535 esearch -db taxonomy -query "txid10090 [SBTR] OR camel [COMN]" |
536 efetch -format docsum |
537 xtract -pattern DocumentSummary -if CommonName \
538 -element Id ScientificName CommonName
539
540 PrintTimeAndTitle "Structural Similarity"
541
542 res=$(
543 esearch -db structure -query "crotalus [ORGN] AND phospholipase A2" | tee /dev/tty |
544 elink -related | tee /dev/tty |
545 efilter -query "archaea [ORGN]" | tee /dev/tty
546 )
547 num=$( echo "$res" | xtract -pattern ENTREZ_DIRECT -element Count )
548 if [ -n "$res" ] && [ -n "$num" ] && [ "$num" -lt 200 ]
549 then
550 echo "$res" |
551 efetch -format docsum |
552 xtract -pattern DocumentSummary \
553 -if PdbClass -equals Hydrolase \
554 -element PdbAcc PdbDescr
555 else
556 echo "Too many returns ($num) suggests failure of a step"
557 fi
558
559 PrintTimeAndTitle "Underscore Protection"
560
561 esearch -db biosample -query "package metagenome or environmental version 1 0 [PROP]" |
562 xtract -pattern ENTREZ_DIRECT -element Count
563
564 esearch -db assembly -query "algae [ORGN] AND complete genome [FILT]" |
565 efilter -query "refseq has annotation [PROP] NOT anomalous [FILT]" |
566 xtract -pattern ENTREZ_DIRECT -element Count
567
568 PrintTimeAndTitle "Mitochondrial Mistranslation"
569
570 efetch -db nuccore -id NC_012920 -format gb |
571 transmute -g2x |
572 xtract -insd CDS gene product protein_id translation sub_sequence |
573 while IFS=$'\t' read acc gene prod prid prot seq
574 do
575 mito=$( echo "$seq" | transmute -cds2prot -gcode 2 -stop )
576 norm=$( echo "$seq" | transmute -cds2prot -gcode 1 -stop )
577 if [ "$mito" != "$norm" ]
578 then
579 echo ">$acc $gene $prid $prod"
580 transmute -diff <( echo "$mito" ) <( echo "$norm" ) < /dev/null
581 echo ""
582 fi
583 done
584
585 PrintTimeAndTitle "Variation Extraction"
586
587 echo "NP_000504.1:p.Glu41Lys,NP_000504.1:p.P43Leu,NP_000504.1:p.Trp142Ter" |
588 transmute -hgvs | transmute -format
589
590 PrintTimeAndTitle "Amino Acid Substitutions"
591
592 esearch -db gene -query "OPN1MW [PREF] AND human [ORGN]" |
593 elink -target snp | efilter -class missense |
594 efetch -format docsum |
595 xtract -rec HGVS -pattern DocumentSummary \
596 -wrp Id -element Id -rst -hgvs DOCSUM |
597 hgvs2spdi |
598 xtract -pattern SPDI -pfx "rs" -RSID Id \
599 -group Variant -if Class -equals Protein -and Type -equals Missense \
600 -element "&RSID" Accession Deleted Inserted Position -deq "\n" |
601 sort-table -k 2,2 -k 5,5n -k 4,4f -k 1.3n | uniq |
602 while read rsid accn del ins ofs
603 do
604 if [ "$accn" != "$last" ]
605 then
606 seq=$( efetch -db protein -id "$accn" -format gpc < /dev/null |
607 xtract -pattern INSDSeq -lower INSDSeq_sequence )
608 last="$accn"
609 fi
610 pos=$((ofs + 1))
611 echo ">$rsid [$accn $ins@$pos]"
612 echo "$seq" |
613 transmute -replace -offset "$ofs" -delete "$del" -insert "$ins" -lower |
614 fold -w 50
615 done |
616 head -n 20
617
618 PrintTimeAndTitle "JSON Nested Array Expansion"
619
620 JS=$( nquire -get "http://mygene.info/v3" gene 3043 )
621 echo "$JS" | transmute -j2p | grep '"position":' -A 14 | head -n 15
622 for ns in flat recurse plural depth element
623 do
624 echo
625 echo " $ns"
626 echo
627 echo "$JS" |
628 transmute -j2x -nest "$ns" |
629 grep position | head -n 4
630 done
631
632 PrintTimeAndTitle "Heterogeneous Object Names"
633
634 JS=$( nquire -get "http://mygene.info/v3" gene 2652 )
635 PW=$( echo "$JS" |
636 xtract -pattern opt -group pathway -element "*" |
637 transmute -format | grep -v xml | grep -v DOCTYPE )
638 echo "$PW" | head -n 5
639 echo
640 echo "$PW" | tail -n 5
641 echo
642 echo "$JS" |
643 xtract -pattern opt -group "pathway/*" -deq "\n" -element "?,name,id" |
644 align-columns -
645
646 # calculate total elapsed time
647
648 seconds_end=$(date "+%s")
649 seconds=$((seconds_end - seconds_start))
650
651 if [ "$useTimer" = true ]
652 then
653 echo ""
654 if [ "$seconds" -eq 1 ]
655 then
656 echo "$seconds second"
657 else
658 echo "$seconds seconds"
659 fi
660 fi
661
662 echo ""
663 echo "Total $SECONDS seconds"
664 echo ""