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: else 36: # continuation from previous lines 37: @pubmed[tag] = @pubmed[tag].sub(/(?:\r|\r\n|\n)\z/, ' ') 38: end 39: value = line[6..-1] 40: @pubmed[tag] += value if value 41: end 42: end
AB - Abstract
Abstract.
# File lib/bio/db/medline.rb, line 144 144: def ab 145: @pubmed['AB'].gsub(/\s+/, ' ').strip 146: end
AD - Affiliation
Institutional affiliation and address of the first author, and grant numbers.
# File lib/bio/db/medline.rb, line 192 192: def ad 193: @pubmed['AD'].strip.split(/\n/) 194: end
AU - Author Name
Authors' names.
# File lib/bio/db/medline.rb, line 151 151: def au 152: @pubmed['AU'].strip 153: end
# File lib/bio/db/medline.rb, line 155 155: def authors 156: authors = [] 157: au.split(/\n/).each do |author| 158: if author =~ / / 159: name = author.split(/\s+/) 160: suffix = nil 161: if name.length > 2 && name[-2] =~ /^[A-Z]+$/ # second to last are the initials 162: suffix = name.pop 163: end 164: initial = name.pop.split(//).join('. ') 165: author = "#{name.join(' ')}, #{initial}." 166: end 167: if suffix 168: author << " " + suffix 169: end 170: authors.push(author) 171: end 172: return authors 173: 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 200 200: def doi 201: @pubmed['AID'][/(\S+) \[doi\]/, 1] 202: end
DP - Publication Date
The date the article was published.
# File lib/bio/db/medline.rb, line 126 126: def dp 127: @pubmed['DP'].strip 128: 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 101 101: def ip 102: @pubmed['IP'].strip 103: end
MH - MeSH Terms
NLM's controlled vocabulary.
# File lib/bio/db/medline.rb, line 184 184: def mh 185: @pubmed['MH'].strip.split(/\n/) 186: end
# File lib/bio/db/medline.rb, line 112 112: def pages 113: pages = pg 114: if pages =~ /-/ 115: from, to = pages.split('-') 116: if (len = from.length - to.length) > 0 117: to = from[0,len] + to 118: end 119: pages = "#{from}-#{to}" 120: end 121: return pages 122: end
PG - Page Number
The full pagination of the article.
# File lib/bio/db/medline.rb, line 108 108: def pg 109: @pubmed['PG'].strip 110: end
# File lib/bio/db/medline.rb, line 204 204: def pii 205: @pubmed['AID'][/(\S+) \[pii\]/, 1] 206: end
PT - Publication Type
The type of material the article represents.
# File lib/bio/db/medline.rb, line 277 277: def pt 278: @pubmed['PT'].strip.split(/\n/) 279: end
returns a Reference object.
# File lib/bio/db/medline.rb, line 47 47: def reference 48: hash = Hash.new 49: 50: hash['authors'] = authors 51: hash['title'] = title 52: hash['journal'] = journal 53: hash['volume'] = volume 54: hash['issue'] = issue 55: hash['pages'] = pages 56: hash['year'] = year 57: hash['pubmed'] = pmid 58: hash['medline'] = ui 59: hash['abstract'] = abstract 60: hash['mesh'] = mesh 61: hash['affiliations'] = affiliations 62: 63: hash.delete_if { |k, v| v.nil? or v.empty? } 64: 65: return Reference.new(hash) 66: end
SO - Source
Composite field containing bibliographic information.
# File lib/bio/db/medline.rb, line 177 177: def so 178: @pubmed['SO'].strip 179: end
TA - Journal Title Abbreviation
Standard journal title abbreviation.
# File lib/bio/db/medline.rb, line 86 86: def ta 87: @pubmed['TA'].gsub(/\s+/, ' ').strip 88: end
TI - Title Words
The title of the article.
# File lib/bio/db/medline.rb, line 137 137: def ti 138: @pubmed['TI'].gsub(/\s+/, ' ').strip 139: end