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 145 145: def ab 146: @pubmed['AB'].gsub(/\s+/, ' ').strip 147: end
AD - Affiliation
Institutional affiliation and address of the first author, and grant numbers.
# File lib/bio/db/medline.rb, line 193 193: def ad 194: @pubmed['AD'].strip.split(/\n/) 195: end
AU - Author Name
Authors' names.
# File lib/bio/db/medline.rb, line 152 152: def au 153: @pubmed['AU'].strip 154: end
# File lib/bio/db/medline.rb, line 156 156: def authors 157: authors = [] 158: au.split(/\n/).each do |author| 159: if author =~ / / 160: name = author.split(/\s+/) 161: suffix = nil 162: if name.length > 2 && name[-2] =~ /^[A-Z]+$/ # second to last are the initials 163: suffix = name.pop 164: end 165: initial = name.pop.split(//).join('. ') 166: author = "#{name.join(' ')}, #{initial}." 167: end 168: if suffix 169: author << " " + suffix 170: end 171: authors.push(author) 172: end 173: return authors 174: 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 201 201: def doi 202: @pubmed['AID'][/(\S+) \[doi\]/, 1] 203: end
DP - Publication Date
The date the article was published.
# File lib/bio/db/medline.rb, line 127 127: def dp 128: @pubmed['DP'].strip 129: 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 102 102: def ip 103: @pubmed['IP'].strip 104: end
MH - MeSH Terms
NLM's controlled vocabulary.
# File lib/bio/db/medline.rb, line 185 185: def mh 186: @pubmed['MH'].strip.split(/\n/) 187: end
# File lib/bio/db/medline.rb, line 113 113: def pages 114: pages = pg 115: if pages =~ /-/ 116: from, to = pages.split('-') 117: if (len = from.length - to.length) > 0 118: to = from[0,len] + to 119: end 120: pages = "#{from}-#{to}" 121: end 122: return pages 123: end
PG - Page Number
The full pagination of the article.
# File lib/bio/db/medline.rb, line 109 109: def pg 110: @pubmed['PG'].strip 111: end
# File lib/bio/db/medline.rb, line 205 205: def pii 206: @pubmed['AID'][/(\S+) \[pii\]/, 1] 207: end
PT - Publication Type
The type of material the article represents.
# File lib/bio/db/medline.rb, line 278 278: def pt 279: @pubmed['PT'].strip.split(/\n/) 280: 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['doi'] = doi 62: hash['affiliations'] = affiliations 63: 64: hash.delete_if { |k, v| v.nil? or v.empty? } 65: 66: return Reference.new(hash) 67: end
SO - Source
Composite field containing bibliographic information.
# File lib/bio/db/medline.rb, line 178 178: def so 179: @pubmed['SO'].strip 180: end
TA - Journal Title Abbreviation
Standard journal title abbreviation.
# File lib/bio/db/medline.rb, line 87 87: def ta 88: @pubmed['TA'].gsub(/\s+/, ' ').strip 89: end
TI - Title Words
The title of the article.
# File lib/bio/db/medline.rb, line 138 138: def ti 139: @pubmed['TI'].gsub(/\s+/, ' ').strip 140: end