0

RefManageR と PubMed ID (pmids) を使用して、PubMed から引用情報を取得しようとしています。

RefManageR を選択したのは、出力を data.frame 形式で貼り付けるのが非常に簡単だからです。そして私にとって、PubMed API を自分で理解して使用することは依然として困難です。

「PMIds の文字列」を入力として使用してデータを取得するコードを作成できました。

require(RCurl)
urli <- getURL("https://gist.githubusercontent.com/aurora-mareviv/3840512f6777d5293218/raw/dfd6b76ceb22c52aa073fc05211dcea986406914/pmids.csv", ssl.verifypeer = FALSE)
pmids <- read.csv(textConnection(urli))
head(pmids)
index10 <- pmids$pmId[1:10]
indice10 <- paste(pmids$pmId[1:10], collapse=" ")

# install.packages("RefManageR")
library(RefManageR)
auth.pm10 <- ReadPubMed(indice10, database = "PubMed", mindate = 1950)
auth.pm10d <- data.frame(auth.pm10)
View(auth.pm10)

ただし、500 pmids から引用を取得したい場合は、PubMed サーバーで長いクエリを避ける必要があると思います。私の考えは、次のindex10ように、 vector 内のすべての要素をループする関数を作成することです。

extract.pub <-
  function(id=indice, dbase=d.base, mindat=1950){
    require(RefManageR)
    indice <- id # Author
    d.base <- dbase # like PubMed, etc
    min.dat <- mindat # Date from...
    auth.pm <- NULL
    for(i in indice){
      auth.pm <-  ReadPubMed(indice, database = d.base, mindate = min.dat)
      }
    auth.pm <- data.frame(auth.pm)
    auth.pm
   }

cites <- extract.pub(index10, dbase="PubMed")
View(cites)

次のエラーが発生しますError : Internal server error

ただし、 (ベクター)indice10の代わりに (文字列)を挿入すると、次のように機能します。index10

cites <- extract.pub(indice10, dbase="PubMed")
View(cites)

このループを機能させるにはどうすればよいですか? それとも、このアプローチは私の目的には最適ではないでしょうか?

4

1 に答える 1

1

ReadPubMEd関数呼び出しごとに 1 つの pmid またはクエリのみを受け入れます。試す:

lapply(pmids[1:3], ReadPubMed, database = "PubMed", mindate = 1950)

与える

[[1]]
[1] P. M. Zeltzer, B. Bodey, A. Marlin, et al. “Immunophenotype profile of childhood
medulloblastomas and supratentorial primitive neuroectodermal tumors using 16 monoclonal
antibodies”. Eng. In: _Cancer_ 66.2 (1990), pp. 273-83. PMID: 2196109.

[[2]]
[1] L. C. Rome, R. P. Funke and R. M. Alexander. “The influence of temperature on muscle
velocity and sustained performance in swimming carp”. Eng. In: _The Journal of
experimental biology_ 154 (1990), pp. 163-78. PMID: 2277258.

[[3]]
[1] P. Henry. “[Headache, facial neuralgia. Diagnostic orientation and management]”. Fre.
In: _La Revue du praticien_ 40.7 (1990), pp. 677-81. PMID: 2326596.

クラスの要素をBibEntrydata.frame に入れ、オーサリングを適切にフォーマットすることができます

lapply(pmids[1:3], function(x){
 tmp <- unlist(ReadPubMed(x, database = "PubMed", mindate = 1950))
 tmp <- lapply(tmp, function(z) if(is(z, "person")) paste0(z, collapse = ",") else z)
 data.frame(tmp, stringsAsFactors = FALSE)
})

与える

                                                                                                                                    title
1 Immunophenotype profile of childhood medulloblastomas and supratentorial primitive neuroectodermal tumors using 16 monoclonal antibodies
2                                               The influence of temperature on muscle velocity and sustained performance in swimming carp
3                                                                      [Headache, facial neuralgia. Diagnostic orientation and management]
                                   author year                             journal volume number  pages  eprint language eprinttype bibtype
1 P M Zeltzer,B Bodey,A Marlin,J Kemshead 1990                              Cancer     66      2 273-83 2196109      eng     pubmed Article
2        L C Rome,R P Funke,R M Alexander 1990 The Journal of experimental biology    154   <NA> 163-78 2277258      eng     pubmed Article
3                                 P Henry 1990               La Revue du praticien     40      7 677-81 2326596      fre     pubmed Article
     dateobj                        key
1 1990-01-01 zeltzer1990immunophenotype
2 1990-01-01          rome1990influence
3 1990-01-01          henry1990headache
于 2014-10-16T13:40:52.437 に答える