| 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 |
# pmc2info |
| 7 |
|
| 8 |
# Converts PMC article XML to PMCInfo XML for local archive |
| 9 |
|
| 10 |
# efetch -db pmc -id 6260607,9205847 -format xml | pmc2info |
| 11 |
# OR |
| 12 |
# tar -xOzf oa_..._xml.PMC...tar.gz --to-stdout | pmc2info |
| 13 |
|
| 14 |
# HERE document for mapping most common title strings |
| 15 |
IFS='' read -r -d '' TYPEMAP <<'EOF' |
| 16 |
introduction INTRODUCTION |
| 17 |
results RESULTS |
| 18 |
results and discussion RESULTS_AND_DISCUSSION |
| 19 |
discussion DISCUSSION |
| 20 |
conclusions CONCLUSION |
| 21 |
conclusion CONCLUSION |
| 22 |
experimental design EXPERIMENTAL |
| 23 |
experimental section EXPERIMENTAL |
| 24 |
experiment EXPERIMENTAL |
| 25 |
experimental EXPERIMENTAL |
| 26 |
experimental setup EXPERIMENTAL |
| 27 |
experimental procedures EXPERIMENTAL |
| 28 |
materials MATERIALS |
| 29 |
methods METHODS |
| 30 |
materials and methods MATERIALS_AND_METHODS |
| 31 |
material and methods MATERIALS_AND_METHODS |
| 32 |
statistical analysis DESIGN_OR_ANALYSIS |
| 33 |
data analysis DESIGN_OR_ANALYSIS |
| 34 |
study design DESIGN_OR_ANALYSIS |
| 35 |
statistical analyses DESIGN_OR_ANALYSIS |
| 36 |
abbreviations ABBREVIATIONS |
| 37 |
list of abbreviations ABBREVIATIONS |
| 38 |
EOF |
| 39 |
|
| 40 |
xtract -mixed -pattern article -mask "table-wrap,alternatives,inline-formula,disp-formula" -element "*" | |
| 41 |
xtract -mixed -set Set -rec Rec -pattern article \ |
| 42 |
-division article/front -pkg UI \ |
| 43 |
-group article-id -if "@pub-id-type" -equals pmc \ |
| 44 |
-branch article-id -if article-id -starts-with PMC -element "article-id[PMC|]" \ |
| 45 |
-branch article-id -unless article-id -starts-with PMC -element "article-id" \ |
| 46 |
-division article/front -pkg ID \ |
| 47 |
-group article-meta \ |
| 48 |
-branch article-id -pfx "article-id_" -AIDKY "@pub-id-type" \ |
| 49 |
-subset article-id -if article-id -starts-with PMC \ |
| 50 |
-tag infon -atr key "&AIDKY" -cls -element "article-id[PMC|]" -end infon \ |
| 51 |
-subset article-id -unless article-id -starts-with PMC \ |
| 52 |
-tag infon -atr key "&AIDKY" -cls -element article-id -end infon \ |
| 53 |
-division article/front -pkg JR \ |
| 54 |
-group journal-meta \ |
| 55 |
-branch journal-id -pfx "journal_id_" -JIDKY "@journal-id-type" \ |
| 56 |
-subset journal-id \ |
| 57 |
-tag infon -atr key "&JIDKY" -cls -element journal-id -end infon \ |
| 58 |
-branch journal-title \ |
| 59 |
-subset journal-title -tag infon -att key journal -cls -plain journal-title -end infon \ |
| 60 |
-division article/front -pkg CT \ |
| 61 |
-branch article-meta \ |
| 62 |
-subset article-meta -if year -tag infon -att key year -cls -min year -end infon \ |
| 63 |
-subset volume -tag infon -att key volume -cls -element volume -end infon \ |
| 64 |
-subset issue -tag infon -att key issue -cls -element issue -end infon \ |
| 65 |
-subset fpage -tag infon -att key fpage -cls -element fpage -end infon \ |
| 66 |
-subset lpage -tag infon -att key lpage -cls -element lpage -end infon \ |
| 67 |
-division article/front -pkg NM -MIN "()" \ |
| 68 |
-group contrib-group/contrib -if "@contrib-type" -equals author \ |
| 69 |
-branch name -LEVL "^surname" -MIN -min "&LEVL,&MIN" \ |
| 70 |
-group contrib-group/contrib -if "@contrib-type" -equals author \ |
| 71 |
-branch name -AUTH surname -GIVN given-names -LEVL "^surname" \ |
| 72 |
-section name -if "&LEVL" -eq "&MIN" -pkg AUTH \ |
| 73 |
-wrp LastName -author "&AUTH" -wrp Given -author "&GIVN" \ |
| 74 |
-wrp Initials -initials "&GIVN" \ |
| 75 |
-division article/front -pkg KY \ |
| 76 |
-branch article-meta -sep " " --KYWDS kwd \ |
| 77 |
-subset article-meta -tag infon -att key kwd -cls -plain "&KYWDS" -end infon \ |
| 78 |
-division article/front -pkg LI \ |
| 79 |
-branch permissions/license \ |
| 80 |
-subset license-p -tag infon -att key license -cls -prose license-p -end infon \ |
| 81 |
-division article/front \ |
| 82 |
-branch title-group \ |
| 83 |
-section "*" -pkg TI \ |
| 84 |
-subset article-title -wrp text -prose article-title \ |
| 85 |
-division article/front \ |
| 86 |
-group "abstract/*" \ |
| 87 |
-section "*" -pkg AB \ |
| 88 |
-subset p -wrp text -prose p \ |
| 89 |
-division body -pkg BD -MIN "()" \ |
| 90 |
-group "sec/*" \ |
| 91 |
-branch sec/title -LEVL "^title" -MIN -min "&LEVL,&MIN" \ |
| 92 |
-group "sec/*" \ |
| 93 |
-branch sec/title -LEVL "^title" \ |
| 94 |
-section title -if "&LEVL" -eq "&MIN" -pkg passage \ |
| 95 |
-subset title -wrp title -alpha title \ |
| 96 |
-branch sec/p \ |
| 97 |
-section p -pkg passage \ |
| 98 |
-subset p -wrp text -prose p | |
| 99 |
xtract -mixed -set Set -rec Rec -pattern Rec \ |
| 100 |
-UID UI -wrp UID -element "&UID" \ |
| 101 |
-division Rec -pkg CX \ |
| 102 |
-block Rec -wrp UID -element "&UID" \ |
| 103 |
-block infon -if "@key" -equals "article-id_doi" -wrp DOI -element infon \ |
| 104 |
-block infon -if "@key" -equals "article-id_pmc" -wrp PMCID -element infon \ |
| 105 |
-block infon -if "@key" -equals "article-id_pmid" -wrp PMID -element infon \ |
| 106 |
-block infon -if "@key" -equals "article-id_publisher-id" -wrp PUBID -element infon \ |
| 107 |
-block infon -if "@key" -equals "elocation-id" -wrp ELOCID -element infon \ |
| 108 |
-block infon -if "@key" -equals "source" -wrp SRC -element infon \ |
| 109 |
-block infon -if "@key" -equals "journal_id_nlm-ta" -wrp JOUR -element infon \ |
| 110 |
-block infon -if "@key" -equals "volume" -wrp VOL -element infon \ |
| 111 |
-block infon -if "@key" -equals "issue" -wrp ISS -element infon \ |
| 112 |
-block infon -if "@key" -equals "year" -wrp YEAR -year infon \ |
| 113 |
-division Rec -pkg AX \ |
| 114 |
-block AUTH -element "*" \ |
| 115 |
-division Rec -pkg KL \ |
| 116 |
-block KY -wrp KEYWORDS -element infon \ |
| 117 |
-block LI -wrp LICENSE -element infon \ |
| 118 |
-division TI -enc TITLE \ |
| 119 |
-tag TEXT -att type TITLE -cls -encode text -end TEXT -rst -clr \ |
| 120 |
-division AB -enc ABSTRACT \ |
| 121 |
-tag TEXT -att type ABSTRACT -cls -encode text -end TEXT -rst -clr \ |
| 122 |
-division passage \ |
| 123 |
-group passage -if title \ |
| 124 |
-section passage -enc passage \ |
| 125 |
-wrp title -lower title \ |
| 126 |
-group passage -if text \ |
| 127 |
-section passage -enc passage \ |
| 128 |
-wrp text -element text | |
| 129 |
xtract -mixed -set Set -rec Rec -pattern Rec \ |
| 130 |
-ALVL ALVL -TLVL TLVL -wrp UID -element Rec/UID \ |
| 131 |
-division Rec -pkg CIT \ |
| 132 |
-group "CX/*" -element "*" \ |
| 133 |
-group "AX/*" \ |
| 134 |
-block AUTH -pkg AUTH \ |
| 135 |
-subset AUTH -wrp LastName -element LastName \ |
| 136 |
-wrp Given -element Given -wrp Initials -element Initials \ |
| 137 |
-group "KL/*" -element "*" \ |
| 138 |
-division TITLE -pkg TITLE -block TITLE -wrp TEXT -element TEXT \ |
| 139 |
-division ABSTRACT -group ABSTRACT -pkg ABSTRACT -block ABSTRACT -wrp TEXT -element TEXT \ |
| 140 |
-division passage \ |
| 141 |
-group passage -if title \ |
| 142 |
-section passage -enc passage \ |
| 143 |
-wrp title -lower title \ |
| 144 |
-group passage -if text \ |
| 145 |
-section passage -enc passage \ |
| 146 |
-wrp text -element text | |
| 147 |
xtract -mixed -transform <( echo -e "$TYPEMAP" ) -set Set -rec Rec -pattern Rec \ |
| 148 |
-wrp UID -element Rec/UID \ |
| 149 |
-division Rec -pkg CIT \ |
| 150 |
-group "CIT/*" -element "*" \ |
| 151 |
-division TITLE -pkg TITLE -block TITLE -wrp TEXT -element TEXT \ |
| 152 |
-division ABSTRACT -group ABSTRACT -pkg ABSTRACT -block ABSTRACT -wrp TEXT -element TEXT \ |
| 153 |
-division passage \ |
| 154 |
-group passage -if title \ |
| 155 |
-section passage -enc passage \ |
| 156 |
-wrp title -translate title -wrp default -lbl PARAGRAPH \ |
| 157 |
-group passage -if text \ |
| 158 |
-section passage -enc passage \ |
| 159 |
-wrp text -element text | |
| 160 |
xtract -mixed -rec PMCInfo -pattern Rec -SECT "(PARAGRAPH)" \ |
| 161 |
-wrp UID -element Rec/UID \ |
| 162 |
-division Rec -pkg CIT \ |
| 163 |
-group "CIT/*" -element "*" \ |
| 164 |
-division TITLE -pkg TITLE -block TITLE -wrp TEXT -element TEXT \ |
| 165 |
-division ABSTRACT -group ABSTRACT -pkg ABSTRACT -block ABSTRACT -wrp TEXT -element TEXT \ |
| 166 |
-division passage \ |
| 167 |
-group passage -if default -SECT default \ |
| 168 |
-group passage -if title -SECT title \ |
| 169 |
-group passage -if text \ |
| 170 |
-section passage -enc "&SECT" \ |
| 171 |
-wrp TEXT -element text | |
| 172 |
transmute -mixed -format |