| 1 |
Processing Flags |
| 2 |
|
| 3 |
-strict Remove HTML and MathML tags |
| 4 |
-mixed Allow mixed content XML |
| 5 |
|
| 6 |
Data Source |
| 7 |
|
| 8 |
-input Read XML from file instead of stdin |
| 9 |
|
| 10 |
Local Record Cache |
| 11 |
|
| 12 |
-archive Base path for saving individual XML files, plus paths |
| 13 |
for first- and second-level inverted index caches |
| 14 |
-delete Same paths as -archive, for deleting inverted caches |
| 15 |
-index Use [parent/element@attribute^version] for identifier |
| 16 |
|
| 17 |
-fetch Base path for retrieving XML files |
| 18 |
-stream Path for retrieving compressed XML |
| 19 |
|
| 20 |
-flag [strict|mixed|none] |
| 21 |
-gzip Use compression for local XML files |
| 22 |
-hash Print UIDs and checksum values to stdout |
| 23 |
|
| 24 |
-trie Print archive, indices, increment, or postings file path |
| 25 |
-padz Pad PMIDs with leading zeros to 8 characters |
| 26 |
|
| 27 |
Local Record Index |
| 28 |
|
| 29 |
-e2index Create Entrez index XML |
| 30 |
-e2invert Generate inverted index |
| 31 |
-join Collect subsets of inverted index files |
| 32 |
-fuse Combine subsets of inverted index files |
| 33 |
-merge Combine inverted indices, divide by term prefix |
| 34 |
-promote Create term lists and posting files |
| 35 |
|
| 36 |
-path Path to postings directory |
| 37 |
|
| 38 |
-query Search on words or phrases in Boolean formulas |
| 39 |
-exact Strict search for article round-tripping |
| 40 |
-title Exact search limited to indexed title field |
| 41 |
|
| 42 |
-count Print terms and counts, merging wildcards |
| 43 |
-counts Expand wildcards, print individual term counts |
| 44 |
|
| 45 |
Documentation |
| 46 |
|
| 47 |
-help Print this document |
| 48 |
-version Print version number |
| 49 |
|
| 50 |
Sample File Download |
| 51 |
|
| 52 |
nquire -dwn ftp.ncbi.nlm.nih.gov /entrez/entrezdirect/samples carotene.xml.zip |
| 53 |
unzip carotene.xml.zip |
| 54 |
rm carotene.xml.zip |
| 55 |
|
| 56 |
Mammalian Sequence Download |
| 57 |
|
| 58 |
download-sequence gbmam gbpri gbrod |
| 59 |
|
| 60 |
Human Subset Extraction |
| 61 |
|
| 62 |
#!/bin/sh |
| 63 |
|
| 64 |
for fl in gbpri?.aso.gz gbpri??.aso.gz |
| 65 |
do |
| 66 |
run-ncbi-converter asn2all -i "$fl" -a t -b -c -O 9606 -f s > ${fl%.aso.gz}.xml |
| 67 |
done |
| 68 |
|
| 69 |
Populate PubMed Archive and Positional Term Index |
| 70 |
|
| 71 |
export EDIRECT_PUBMED_MASTER=/Volumes/cachet |
| 72 |
export EDIRECT_PUBMED_WORKING=/Volumes/scratch |
| 73 |
|
| 74 |
archive-pubmed |
| 75 |
|
| 76 |
index-pubmed |
| 77 |
|
| 78 |
Retrieve from PubMed Archive |
| 79 |
|
| 80 |
cat subset.uid | fetch-pubmed > subset.xml |
| 81 |
|
| 82 |
Entrez Indexing |
| 83 |
|
| 84 |
cat carotene.xml | rchive -strict -e2index > carotene.e2x |
| 85 |
|
| 86 |
Index Inversion |
| 87 |
|
| 88 |
cat carotene.e2x | rchive -invert > carotene.inv |
| 89 |
|
| 90 |
Merge Indices |
| 91 |
|
| 92 |
rchive -merge "$MASTER/Merged" carotene.inv |
| 93 |
|
| 94 |
Create Postings |
| 95 |
|
| 96 |
rchive -promote "$MASTER/Postings" TIAB carotene.mrg |
| 97 |
|
| 98 |
Record Counts |
| 99 |
|
| 100 |
phrase-search -count "catabolite repress*" |
| 101 |
|
| 102 |
Wildcard Expansion |
| 103 |
|
| 104 |
phrase-search -counts "catabolite repress*" |
| 105 |
|
| 106 |
Query Processing |
| 107 |
|
| 108 |
phrase-search -query "(literacy AND numeracy) NOT (adolescent OR child)" |
| 109 |
|
| 110 |
phrase-search -query "vitamin c + + common cold" |
| 111 |
|
| 112 |
phrase-search -query "vitamin c ~ ~ common cold" |
| 113 |
|
| 114 |
phrase-search -title "Genetic Control of Biochemical Reactions in Neurospora." |
| 115 |
|
| 116 |
Citation Match Preparation |
| 117 |
|
| 118 |
for fl in *.seq |
| 119 |
do |
| 120 |
base=${fl%.seq} |
| 121 |
echo "$base" >&2 |
| 122 |
cat "$fl" | |
| 123 |
gbf2ref | |
| 124 |
transmute -pattern "CITATION" -format compact | |
| 125 |
grep '<CITATION>' > "$base.xml" |
| 126 |
done |
| 127 |
|
| 128 |
Citation Match Filtering |
| 129 |
|
| 130 |
cat *.xml | |
| 131 |
xtract -pattern CITATION -select STAT -equals inpress > inpress.xml |
| 132 |
|
| 133 |
cat *.xml | |
| 134 |
xtract -pattern CITATION -select STAT -equals unpub > unpub.xml |
| 135 |
|
| 136 |
Citation Match Processing |
| 137 |
|
| 138 |
cat inpress.xml | ref2pmid > frominpress.xml |
| 139 |
|
| 140 |
cat unpub.xml | ref2pmid > fromunpub.xml |
| 141 |
|
| 142 |
Citation Match Candidates |
| 143 |
|
| 144 |
cat *.xml | |
| 145 |
xtract -pattern CITATION -histogram STAT | |
| 146 |
align-columns -a rl |
| 147 |
|
| 148 |
Large-Scale Record Retrieval |
| 149 |
|
| 150 |
esearch -db pubmed -query "DNA Repair [MESH]" | |
| 151 |
efetch -format uid | |
| 152 |
fetch-pubmed | |
| 153 |
xtract -pattern PubmedArticle -num Author | |
| 154 |
sort-uniq-count -n | |
| 155 |
reorder-columns 2 1 | |
| 156 |
head -n 25 | |
| 157 |
tee /dev/tty | |
| 158 |
xy-plot auth.png |
| 159 |
|
| 160 |
XML Data Transformation |
| 161 |
|
| 162 |
seconds_start=$(date "+%s") |
| 163 |
esearch -db pubmed -query "PNAS [JOUR]" -pub abstract | |
| 164 |
efetch -format uid | stream-pubmed | gunzip -c | |
| 165 |
xtract -stops -wrp Set,Rec -pattern PubmedArticle \ |
| 166 |
-wrp "Year" -year "PubDate/*" \ |
| 167 |
-wrp "Abst" -words Abstract/AbstractText | |
| 168 |
xtract -wrp Set,Pub -pattern Rec \ |
| 169 |
-wrp "Year" -element Year \ |
| 170 |
-wrp "Num" -num Abst > countsByYear.xml |
| 171 |
for yr in {1960..2020} |
| 172 |
do |
| 173 |
cat countsByYear.xml | |
| 174 |
xtract -wrp Raw -pattern Pub -select Year -eq "$yr" | |
| 175 |
xtract -pattern Raw -lbl "$yr" -avg Num |
| 176 |
done | |
| 177 |
tee /dev/tty | |
| 178 |
xy-plot verbosity.png |
| 179 |
rm countsByYear.xml |
| 180 |
seconds_end=$(date "+%s") |
| 181 |
seconds=$((seconds_end - seconds_start)) |
| 182 |
echo "$seconds seconds" |
| 183 |
|
| 184 |
Annotation Timeline |
| 185 |
|
| 186 |
cat $EDIRECT_PUBMED_MASTER/Current/*.xml | |
| 187 |
xtract -wrp Set,Rec -pattern PubmedArticle \ |
| 188 |
-if PubDate/Month -wrp YR -year "PubDate/*" -wrp MN -len PubDate/Month | |
| 189 |
xtract -wrp Set,Rec -pattern Rec \ |
| 190 |
-pfx "<DT>" -sep "+-" -sfx "-</DT>" -element YR,MN | |
| 191 |
xtract -pattern Rec -histogram DT | |
| 192 |
reorder-columns 2 1 | tr '+' '\t' | |
| 193 |
sed -e 's/-3-/1/g' -e 's/-2-/2/g' -e 's/-1-/3/g' -e 's/-[0-9]-/4/g' | |
| 194 |
sort -k 1,1n -k 2,2n > rawMonthCounts.txt |
| 195 |
|
| 196 |
result=$( cat rawMonthCounts.txt | cut -f 1 | uniq ) |
| 197 |
for i in {1..4} |
| 198 |
do |
| 199 |
current=$( cat rawMonthCounts.txt | grep "\t$i\t" | cut -f 1,3 ) |
| 200 |
result=$(join -a 1 -t $'\t' <(echo "$result") <(echo "$current")) |
| 201 |
done |
| 202 |
echo "$result" > plotme.txt |
| 203 |
|
| 204 |
Query Automation |
| 205 |
|
| 206 |
ascend_mesh_tree() { |
| 207 |
var="${1%\*}" |
| 208 |
target="" |
| 209 |
ev=$( rchive -local pubmed ) |
| 210 |
if [ -n "$ev" ] |
| 211 |
then |
| 212 |
# only care about master volume and its Data subfolder |
| 213 |
target="${ev%:*}" |
| 214 |
target=${target%/} |
| 215 |
fi |
| 216 |
while : |
| 217 |
do |
| 218 |
frst=$( phrase-search -count "$var* [TREE]" ) |
| 219 |
scnd=$( cat "${target}/Data/meshconv.xml" | |
| 220 |
xtract -pattern Rec -if Tree -equals "$var" -first Code Name ) |
| 221 |
printf "${frst}\t${scnd}\n" |
| 222 |
case "$var" in |
| 223 |
*.* ) var="${var%????}" ;; |
| 224 |
* ) break ;; |
| 225 |
esac |
| 226 |
done | |
| 227 |
align-columns -g 4 |
| 228 |
} |
| 229 |
|
| 230 |
ascend_mesh_tree "C14.907.617.812" |
| 231 |
|
| 232 |
6584 c14 907 617 812* |
| 233 |
50722 c14 907 617* |
| 234 |
1567114 c14 907* |
| 235 |
2232414 c14* |
| 236 |
|
| 237 |
Medical Subject Heading Code Viewer |
| 238 |
|
| 239 |
https://meshb.nlm.nih.gov/treeView |
| 240 |
|
| 241 |
DISABLE ANTI-VIRUS FILE SCANNING FOR LOCAL ARCHIVES OR DESIGNATE AS TRUSTED FILES |
| 242 |
|
| 243 |
DISABLE SPOTLIGHT INDEXING FOR EXTERNAL DISKS CONTAINING LOCAL ARCHIVES |