Method: Bio::PubMed#efetch

Defined in:
lib/bio/io/pubmed.rb

#efetch(ids, hash = {}) ⇒ Object

Retrieve PubMed entry by PMID and returns MEDLINE formatted string using entrez efetch. Multiple PubMed IDs can be provided:

Bio::PubMed.efetch(123)
Bio::PubMed.efetch([123,456,789])

Arguments:

  • ids: list of PubMed IDs (required)

  • hash: hash of E-Utils options

    • _“retmode”_: “xml”, “html”, …

    • _“rettype”_: “medline”, …

    • _“retmax”_: integer (default 100)

    • _“retstart”_: integer

    • _“field”_

    • _“reldate”_

    • _“mindate”_

    • _“maxdate”_

    • _“datetype”_

Returns

Array of MEDLINE formatted String



116
117
118
119
120
121
122
123
124
# File 'lib/bio/io/pubmed.rb', line 116

def efetch(ids, hash = {})
  opts = { "db" => "pubmed", "rettype"  => "medline" }
  opts.update(hash)
  result = super(ids, opts)
  if !opts["retmode"] or opts["retmode"] == "text"
    result = result.split(/\n\n+/)
  end
  result
end