Class | Bio::MEDLINE
In: | lib/bio/db/medline.rb
Parent: | NCBIDB

## Description

NCBI PubMed/MEDLINE database class.

## Examples

      medline = Bio::MEDLINE.new(txt)
      medline.reference
      medline.pmid == medline.entry_id
      medilne.mesh

### Methods

ab abstract ad affiliations au authors date doi dp entry_id ip issue journal mesh mh new pages pg pii pmid pt publication_type reference so source ta ti title ui vi volume year

### Attributes

pubmed | [R] |

### Public Class methods

new(entry)

[Source]

        # File lib/bio/db/medline.rb, line 28
    28:   def initialize(entry)
    29:     @pubmed = Hash.new('')
    30:
    31:     tag = ''
    32:     entry.each_line do |line|
    33:       if line =~ /^\w/
    34:         tag = line[0,4].strip
    35:       end
    36:       @pubmed[tag] += line[6..-1] if line.length > 6
    37:     end
    38:   end

### Public Instance methods

ab()

AB - Abstract

      Abstract.

[Source]

         # File lib/bio/db/medline.rb, line 140
    140:   def ab
    141:     @pubmed['AB'].gsub(/\s+/, ' ').strip
    142:   end

abstract()

Alias for ab

ad()

AD - Affiliation

      Institutional affiliation and address of the first author, and grant
      numbers.

[Source]

         # File lib/bio/db/medline.rb, line 188
    188:   def ad
    189:     @pubmed['AD'].strip.split(/\n/)
    190:   end

affiliations()

Alias for ad

au()

AU - Author Name

      Authors' names.

[Source]

         # File lib/bio/db/medline.rb, line 147
    147:   def au
    148:     @pubmed['AU'].strip
    149:   end

authors()

[Source]

         # File lib/bio/db/medline.rb, line 151
    151:   def authors
    152:     authors = []
    153:     au.split(/\n/).each do |author|
    154:       if author =~ / /
    155:         name = author.split(/\s+/)
    156:         suffix = nil
    157:         if name.length > 2 && name[-2] =~ /^[A-Z]+$/ # second to last are the initials
    158:           suffix = name.pop
    159:         end
    160:         initial = name.pop.split(//).join('. ')
    161:         author = "#{name.join(' ')}, #{initial}."
    162:       end
    163:       if suffix
    164:         author << " " + suffix
    165:       end
    166:       authors.push(author)
    167:     end
    168:     return authors
    169:   end

date()

Alias for dp

doi()

AID - Article Identifier

      Article ID values may include the pii (controlled publisher identifier)
      or doi (Digital Object Identifier).

[Source]

         # File lib/bio/db/medline.rb, line 196
    196:   def doi
    197:     @pubmed['AID'][/(\S+) \[doi\]/, 1]
    198:   end

dp()

DP - Publication Date

      The date the article was published.

[Source]

         # File lib/bio/db/medline.rb, line 122
    122:   def dp
    123:     @pubmed['DP'].strip
    124:   end

entry_id()

Alias for pmid

ip()

IP - Issue

      The number of the issue, part, or supplement of the journal in which
      the article was published.

[Source]

        # File lib/bio/db/medline.rb, line 97
    97:   def ip
    98:     @pubmed['IP'].strip
    99:   end

issue()

Alias for ip

journal()

Alias for ta

mesh()

Alias for mh

mh()

MH - MeSH Terms

      NLM's controlled vocabulary.

[Source]

         # File lib/bio/db/medline.rb, line 180
    180:   def mh
    181:     @pubmed['MH'].strip.split(/\n/)
    182:   end

pages()

[Source]

         # File lib/bio/db/medline.rb, line 108
    108:   def pages
    109:     pages = pg
    110:     if pages =~ /-/
    111:       from, to = pages.split('-')
    112:       if (len = from.length - to.length) > 0
    113:         to = from[0,len] + to
    114:       end
    115:       pages = "#{from}-#{to}"
    116:     end
    117:     return pages
    118:   end

pg()

PG - Page Number

      The full pagination of the article.

[Source]

         # File lib/bio/db/medline.rb, line 104
    104:   def pg
    105:     @pubmed['PG'].strip
    106:   end

pii()

[Source]

         # File lib/bio/db/medline.rb, line 200
    200:   def pii
    201:     @pubmed['AID'][/(\S+) \[pii\]/, 1]
    202:   end

pmid()

PMID - PubMed Unique Identifier

      Unique number assigned to each PubMed citation.

[Source]

        # File lib/bio/db/medline.rb, line 69
    69:   def pmid
    70:     @pubmed['PMID'].strip
    71:   end

pt()

PT - Publication Type

      The type of material the article represents.

[Source]

         # File lib/bio/db/medline.rb, line 273
    273:   def pt
    274:     @pubmed['PT'].strip.split(/\n/)
    275:   end

publication_type()

Alias for pt

reference()

returns a Reference object.

[Source]

        # File lib/bio/db/medline.rb, line 43
    43:   def reference
    44:     hash = Hash.new('')
    45:
    46:     hash['authors']     = authors
    47:     hash['title']       = title
    48:     hash['journal']     = journal
    49:     hash['volume']      = volume
    50:     hash['issue']       = issue
    51:     hash['pages']       = pages
    52:     hash['year']        = year
    53:     hash['pubmed']      = pmid
    54:     hash['medline']     = ui
    55:     hash['abstract']    = abstract
    56:     hash['mesh']        = mesh
    57:     hash['affiliations'] = affiliations
    58:
    59:     hash.delete_if { |k, v| v.nil? or v.empty? }
    60:
    61:     return Reference.new(hash)
    62:   end

so()

SO - Source

      Composite field containing bibliographic information.

[Source]

         # File lib/bio/db/medline.rb, line 173
    173:   def so
    174:     @pubmed['SO'].strip
    175:   end

source()

Alias for so

ta()

TA - Journal Title Abbreviation

      Standard journal title abbreviation.

[Source]

        # File lib/bio/db/medline.rb, line 82
    82:   def ta
    83:     @pubmed['TA'].gsub(/\s+/, ' ').strip
    84:   end

ti()

TI - Title Words

      The title of the article.

[Source]

         # File lib/bio/db/medline.rb, line 133
    133:   def ti
    134:     @pubmed['TI'].gsub(/\s+/, ' ').strip
    135:   end

title()

Alias for ti

ui()

UI - MEDLINE Unique Identifier

      Unique number assigned to each MEDLINE citation.

[Source]

        # File lib/bio/db/medline.rb, line 76
    76:   def ui
    77:     @pubmed['UI'].strip
    78:   end

vi()

VI - Volume

      Journal volume.

[Source]

        # File lib/bio/db/medline.rb, line 89
    89:   def vi
    90:     @pubmed['VI'].strip
    91:   end

volume()

Alias for vi

year()

[Source]

         # File lib/bio/db/medline.rb, line 127
    127:   def year
    128:     dp[0,4]
    129:   end

[Validate]