| 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 |
pth=$( dirname "$0" ) |
| 7 |
|
| 8 |
case "$pth" in |
| 9 |
/* ) |
| 10 |
;; # already absolute |
| 11 |
* ) |
| 12 |
pth=$(cd "$pth" && pwd) |
| 13 |
;; |
| 14 |
esac |
| 15 |
|
| 16 |
case ":$PATH:" in |
| 17 |
*:"$pth":* ) |
| 18 |
;; |
| 19 |
* ) |
| 20 |
PATH="$PATH:$pth" |
| 21 |
export PATH |
| 22 |
;; |
| 23 |
esac |
| 24 |
|
| 25 |
# handle common flags - dot command is equivalent of "source" |
| 26 |
|
| 27 |
if [ ! -f "$pth"/xcommon.sh ] |
| 28 |
then |
| 29 |
echo "ERROR: Unable to find '$pth/xcommon.sh' file" >&2 |
| 30 |
exit 1 |
| 31 |
fi |
| 32 |
|
| 33 |
. "$pth"/xcommon.sh |
| 34 |
|
| 35 |
# initialize specific flags |
| 36 |
|
| 37 |
FindArchiveFolder |
| 38 |
|
| 39 |
FindPostingsFolder |
| 40 |
|
| 41 |
FindDataFolder |
| 42 |
|
| 43 |
seconds_start=$(date "+%s") |
| 44 |
|
| 45 |
for i in {1..100} |
| 46 |
do |
| 47 |
echo $(( ( 1 + RANDOM % 30000) * 1000 + ( RANDOM % 1000) )) |
| 48 |
done | |
| 49 |
sort -n | |
| 50 |
uniq | |
| 51 |
xfetch -db pubmed | |
| 52 |
xtract -pattern PubmedArticle -element MedlineCitation/PMID ArticleTitle | |
| 53 |
( while IFS=$'\t' read uid ttl |
| 54 |
do |
| 55 |
if [ "$ttl" = "[Not Available]." ] |
| 56 |
then |
| 57 |
echo "$uid SKIP" |
| 58 |
continue |
| 59 |
fi |
| 60 |
if [ "$ttl" = "Health." ] |
| 61 |
then |
| 62 |
echo "$uid SKIP" |
| 63 |
continue |
| 64 |
fi |
| 65 |
if [ -z "$ttl" ] |
| 66 |
then |
| 67 |
echo "$uid TRIM -- $ttl" |
| 68 |
continue |
| 69 |
fi |
| 70 |
res=$( xsearch -title "$ttl" ) |
| 71 |
report="1" |
| 72 |
if [ -z "$res" ] |
| 73 |
then |
| 74 |
echo "$uid NONE -- $ttl" |
| 75 |
continue |
| 76 |
fi |
| 77 |
num=$( echo "$res" | wc -l | tr -d '[:space:]' ) |
| 78 |
echo "$res" | |
| 79 |
while read pmid |
| 80 |
do |
| 81 |
if [[ $uid =~ $pmid ]] |
| 82 |
then |
| 83 |
if [ "$num" -lt 2 ] |
| 84 |
then |
| 85 |
echo "$uid OKAY -- $ttl" |
| 86 |
else |
| 87 |
echo "$uid MULT ${num## } -- $ttl" |
| 88 |
fi |
| 89 |
report="0" |
| 90 |
break |
| 91 |
fi |
| 92 |
done |
| 93 |
if [ "$report" -lt 1 ] |
| 94 |
then |
| 95 |
echo "$uid FAIL $num -- $ttl" |
| 96 |
fi |
| 97 |
done ) |
| 98 |
|
| 99 |
ascend_mesh_tree() { |
| 100 |
var="${1%\*}" |
| 101 |
while : |
| 102 |
do |
| 103 |
frst=$( xinfo -count "$var* [TREE]" ) |
| 104 |
scnd=$( cat "${dataBase}/meshconv.xml" | |
| 105 |
xtract -pattern Rec -if Tree -equals "$var" -first Code Name ) |
| 106 |
printf "${frst}\t${scnd}\n" |
| 107 |
case "$var" in |
| 108 |
*.* ) var="${var%????}" ;; |
| 109 |
* ) break ;; |
| 110 |
esac |
| 111 |
done | |
| 112 |
align-columns -g 4 |
| 113 |
} |
| 114 |
|
| 115 |
echo "" |
| 116 |
xinfo -fields |
| 117 |
|
| 118 |
echo "" |
| 119 |
xinfo -terms PROP |
| 120 |
|
| 121 |
echo "" |
| 122 |
cit2pmid -local \ |
| 123 |
-title "nucleotide sequences required for tn3 transposition immunity" \ |
| 124 |
-author "Kans JA" -author "Casadaban MJ" \ |
| 125 |
-journal "J Bacteriol" -year 1989 -volume 171 -issue 4 -page "1904-14" |
| 126 |
|
| 127 |
echo "" |
| 128 |
ascend_mesh_tree "C01.925.782.417.415" |
| 129 |
|
| 130 |
echo "" |
| 131 |
|
| 132 |
seconds_end=$(date "+%s") |
| 133 |
seconds=$((seconds_end - seconds_start)) |
| 134 |
echo "$seconds seconds" |