| Class | Bio::MEDLINE |
| In: |
lib/bio/db/medline.rb
|
| Parent: | NCBIDB |
| pubmed | [R] |
# 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
AB - Abstract
Abstract.
# File lib/bio/db/medline.rb, line 140
140: def ab
141: @pubmed['AB'].gsub(/\s+/, ' ').strip
142: end
AD - Affiliation
Institutional affiliation and address of the first author, and grant numbers.
# File lib/bio/db/medline.rb, line 188
188: def ad
189: @pubmed['AD'].strip.split(/\n/)
190: end
AU - Author Name
Authors' names.
# File lib/bio/db/medline.rb, line 147
147: def au
148: @pubmed['AU'].strip
149: end
# 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
AID - Article Identifier
Article ID values may include the pii (controlled publisher identifier) or doi (Digital Object Identifier).
# File lib/bio/db/medline.rb, line 196
196: def doi
197: @pubmed['AID'][/(\S+) \[doi\]/, 1]
198: end
DP - Publication Date
The date the article was published.
# File lib/bio/db/medline.rb, line 122
122: def dp
123: @pubmed['DP'].strip
124: end
IP - Issue
The number of the issue, part, or supplement of the journal in which the article was published.
# File lib/bio/db/medline.rb, line 97
97: def ip
98: @pubmed['IP'].strip
99: end
MH - MeSH Terms
NLM's controlled vocabulary.
# File lib/bio/db/medline.rb, line 180
180: def mh
181: @pubmed['MH'].strip.split(/\n/)
182: end
# 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 - Page Number
The full pagination of the article.
# File lib/bio/db/medline.rb, line 104
104: def pg
105: @pubmed['PG'].strip
106: end
# File lib/bio/db/medline.rb, line 200
200: def pii
201: @pubmed['AID'][/(\S+) \[pii\]/, 1]
202: end
PT - Publication Type
The type of material the article represents.
# File lib/bio/db/medline.rb, line 273
273: def pt
274: @pubmed['PT'].strip.split(/\n/)
275: end
returns a Reference object.
# 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 - Source
Composite field containing bibliographic information.
# File lib/bio/db/medline.rb, line 173
173: def so
174: @pubmed['SO'].strip
175: end
TA - Journal Title Abbreviation
Standard journal title abbreviation.
# File lib/bio/db/medline.rb, line 82
82: def ta
83: @pubmed['TA'].gsub(/\s+/, ' ').strip
84: end
TI - Title Words
The title of the article.
# File lib/bio/db/medline.rb, line 133
133: def ti
134: @pubmed['TI'].gsub(/\s+/, ' ').strip
135: end