| 1 |
#!/bin/sh |
| 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 |
# Converts PMC article XML to BioC collection XML - WORK IN PROGRESS |
| 7 |
|
| 8 |
# efetch -db pmc -id 6260607,9205847 -format xml | pmc2bioc |
| 9 |
# OR |
| 10 |
# tar -xOzf oa_..._xml.PMC...tar.gz --to-stdout | pmc2bioc |
| 11 |
|
| 12 |
xtract -mixed -set Set -rec Rec -pattern article \ |
| 13 |
-division article/front -pkg UI \ |
| 14 |
-group article-id -if "@pub-id-type" -equals pmc \ |
| 15 |
-branch article-id -if article-id -starts-with PMC -element "article-id[PMC|]" \ |
| 16 |
-branch article-id -unless article-id -starts-with PMC -element "article-id" \ |
| 17 |
-division article/front -pkg ID \ |
| 18 |
-group article-meta \ |
| 19 |
-branch article-id -pfx "article-id_" -AIDKY "@pub-id-type" \ |
| 20 |
-subset article-id -if article-id -starts-with PMC \ |
| 21 |
-tag infon -atr key "&AIDKY" -cls -element "article-id[PMC|]" -end infon \ |
| 22 |
-subset article-id -unless article-id -starts-with PMC \ |
| 23 |
-tag infon -atr key "&AIDKY" -cls -element article-id -end infon \ |
| 24 |
-division article/front -pkg JR \ |
| 25 |
-branch journal-meta \ |
| 26 |
-block journal-title \ |
| 27 |
-subset journal-title -tag infon -att key journal -cls -plain journal-title -end infon \ |
| 28 |
-division article/front -pkg CT \ |
| 29 |
-branch article-meta \ |
| 30 |
-subset article-meta -if year -tag infon -att key year -cls -min year -end infon \ |
| 31 |
-subset volume -tag infon -att key volume -cls -element volume -end infon \ |
| 32 |
-subset issue -tag infon -att key issue -cls -element issue -end infon \ |
| 33 |
-subset fpage -tag infon -att key fpage -cls -element fpage -end infon \ |
| 34 |
-subset lpage -tag infon -att key lpage -cls -element lpage -end infon \ |
| 35 |
-division article/front -pkg NM \ |
| 36 |
-group contrib-group/contrib -if "@contrib-type" -equals author \ |
| 37 |
-branch name -pkg Name -AUTH surname -GIVN given-names \ |
| 38 |
-section name \ |
| 39 |
-wrp Last -author "&AUTH" -wrp Initials -initials "&GIVN" -wrp Given -author "&GIVN" \ |
| 40 |
-rst -pfx "surname:" -SURNM "&AUTH" -pfx ";given-names:" -GIVNM "&GIVN" \ |
| 41 |
-rst -sep "" -SRGV "&SURNM,&GIVNM" -wrp Infon -author "&SRGV" \ |
| 42 |
-division article/front -pkg KY \ |
| 43 |
-branch article-meta -sep " " --KYWDS kwd \ |
| 44 |
-subset article-meta -tag infon -att key kwd -cls -plain "&KYWDS" -end infon \ |
| 45 |
-division article/front -pkg LI \ |
| 46 |
-branch permissions/license \ |
| 47 |
-subset license-p -tag infon -att key license -cls -prose license-p -end infon \ |
| 48 |
-division article/front -pkg TI \ |
| 49 |
-branch title-group \ |
| 50 |
-subset article-title -wrp text -prose article-title \ |
| 51 |
-division article/front -pkg AB \ |
| 52 |
-group "abstract/*" \ |
| 53 |
-section "*" -pkg passage \ |
| 54 |
-subset p -tag infon -att key section_type -cls -lbl ABSTRACT -end infon \ |
| 55 |
-subset p -tag infon -att key type -cls -lbl abstract -end infon \ |
| 56 |
-subset p -wrp text -prose p \ |
| 57 |
-division body -pkg BD \ |
| 58 |
-element "*" | |
| 59 |
xtract -mixed -set collection -rec document -pattern Rec \ |
| 60 |
-division UI -wrp id -element UI \ |
| 61 |
-division Rec -pkg passage \ |
| 62 |
-subset Rec -tag infon -att key section_type -cls -lbl TITLE -end infon \ |
| 63 |
-subset Rec -tag infon -att key type -cls -lbl front -end infon \ |
| 64 |
-group "ID/*" -element "*" \ |
| 65 |
-group "JR/*" -element "*" \ |
| 66 |
-group "CT/*" -element "*" \ |
| 67 |
-group NM \ |
| 68 |
-branch Name -pfx "name_" -ANUM "+" \ |
| 69 |
-subset Name -tag infon -atr key "&ANUM" -cls -element Infon -end infon \ |
| 70 |
-group NM \ |
| 71 |
-branch Name -sep " " -AUTH Last,Initials -sep ", " --ATHRS "&AUTH" \ |
| 72 |
-branch NM \ |
| 73 |
-subset NM -tag infon -att key authors -cls -author "&ATHRS" -end infon \ |
| 74 |
-group "KY/*" -element "*" \ |
| 75 |
-group "LI/*" -element "*" \ |
| 76 |
-group "TI/*" -element "*" \ |
| 77 |
-division Rec \ |
| 78 |
-group "AB/*" -element "*" \ |
| 79 |
-division BD/body \ |
| 80 |
-group "sec/*" \ |
| 81 |
-branch sec/title \ |
| 82 |
-section title -pkg passage \ |
| 83 |
-subset title -tag infon -att key type -cls -lbl title -end infon \ |
| 84 |
-subset title -wrp text -prose title \ |
| 85 |
-branch sec/p \ |
| 86 |
-section p -pkg passage \ |
| 87 |
-subset p -tag infon -att key type -cls -lbl paragraph -end infon \ |
| 88 |
-subset p -wrp text -prose p | |
| 89 |
transmute -mixed -format |