bio 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. data/bin/bioruby +107 -0
  2. data/bin/br_biofetch.rb +59 -0
  3. data/bin/br_bioflat.rb +294 -0
  4. data/bin/br_biogetseq.rb +57 -0
  5. data/bin/br_pmfetch.rb +431 -0
  6. data/doc/BioRuby.rd.ja +225 -0
  7. data/doc/Changes-0.7.rd +236 -0
  8. data/doc/Design.rd.ja +341 -0
  9. data/doc/KEGG_API.rd +1437 -0
  10. data/doc/KEGG_API.rd.ja +1399 -0
  11. data/doc/TODO.rd.ja +138 -0
  12. data/doc/Tutorial.rd +1138 -0
  13. data/doc/Tutorial.rd.ja +2110 -0
  14. data/etc/bioinformatics/seqdatabase.ini +210 -0
  15. data/lib/bio.rb +256 -0
  16. data/lib/bio/alignment.rb +1906 -0
  17. data/lib/bio/appl/bl2seq/report.rb +350 -0
  18. data/lib/bio/appl/blast.rb +269 -0
  19. data/lib/bio/appl/blast/format0.rb +1402 -0
  20. data/lib/bio/appl/blast/format8.rb +95 -0
  21. data/lib/bio/appl/blast/report.rb +652 -0
  22. data/lib/bio/appl/blast/rexml.rb +151 -0
  23. data/lib/bio/appl/blast/wublast.rb +553 -0
  24. data/lib/bio/appl/blast/xmlparser.rb +222 -0
  25. data/lib/bio/appl/blat/report.rb +392 -0
  26. data/lib/bio/appl/clustalw.rb +191 -0
  27. data/lib/bio/appl/clustalw/report.rb +154 -0
  28. data/lib/bio/appl/emboss.rb +68 -0
  29. data/lib/bio/appl/fasta.rb +262 -0
  30. data/lib/bio/appl/fasta/format10.rb +428 -0
  31. data/lib/bio/appl/fasta/format6.rb +37 -0
  32. data/lib/bio/appl/genscan/report.rb +570 -0
  33. data/lib/bio/appl/hmmer.rb +129 -0
  34. data/lib/bio/appl/hmmer/report.rb +556 -0
  35. data/lib/bio/appl/mafft.rb +222 -0
  36. data/lib/bio/appl/mafft/report.rb +119 -0
  37. data/lib/bio/appl/psort.rb +555 -0
  38. data/lib/bio/appl/psort/report.rb +473 -0
  39. data/lib/bio/appl/sim4.rb +134 -0
  40. data/lib/bio/appl/sim4/report.rb +501 -0
  41. data/lib/bio/appl/sosui/report.rb +166 -0
  42. data/lib/bio/appl/spidey/report.rb +604 -0
  43. data/lib/bio/appl/targetp/report.rb +283 -0
  44. data/lib/bio/appl/tmhmm/report.rb +238 -0
  45. data/lib/bio/command.rb +166 -0
  46. data/lib/bio/data/aa.rb +354 -0
  47. data/lib/bio/data/codontable.rb +740 -0
  48. data/lib/bio/data/na.rb +226 -0
  49. data/lib/bio/db.rb +340 -0
  50. data/lib/bio/db/aaindex.rb +280 -0
  51. data/lib/bio/db/embl/common.rb +332 -0
  52. data/lib/bio/db/embl/embl.rb +446 -0
  53. data/lib/bio/db/embl/sptr.rb +954 -0
  54. data/lib/bio/db/embl/swissprot.rb +32 -0
  55. data/lib/bio/db/embl/trembl.rb +31 -0
  56. data/lib/bio/db/embl/uniprot.rb +32 -0
  57. data/lib/bio/db/fantom.rb +604 -0
  58. data/lib/bio/db/fasta.rb +869 -0
  59. data/lib/bio/db/genbank/common.rb +299 -0
  60. data/lib/bio/db/genbank/ddbj.rb +34 -0
  61. data/lib/bio/db/genbank/genbank.rb +354 -0
  62. data/lib/bio/db/genbank/genpept.rb +73 -0
  63. data/lib/bio/db/genbank/refseq.rb +31 -0
  64. data/lib/bio/db/gff.rb +106 -0
  65. data/lib/bio/db/go.rb +497 -0
  66. data/lib/bio/db/kegg/brite.rb +51 -0
  67. data/lib/bio/db/kegg/cell.rb +88 -0
  68. data/lib/bio/db/kegg/compound.rb +130 -0
  69. data/lib/bio/db/kegg/enzyme.rb +125 -0
  70. data/lib/bio/db/kegg/expression.rb +173 -0
  71. data/lib/bio/db/kegg/genes.rb +293 -0
  72. data/lib/bio/db/kegg/genome.rb +362 -0
  73. data/lib/bio/db/kegg/glycan.rb +213 -0
  74. data/lib/bio/db/kegg/keggtab.rb +418 -0
  75. data/lib/bio/db/kegg/kgml.rb +299 -0
  76. data/lib/bio/db/kegg/ko.rb +178 -0
  77. data/lib/bio/db/kegg/reaction.rb +97 -0
  78. data/lib/bio/db/litdb.rb +131 -0
  79. data/lib/bio/db/medline.rb +317 -0
  80. data/lib/bio/db/nbrf.rb +199 -0
  81. data/lib/bio/db/pdb.rb +38 -0
  82. data/lib/bio/db/pdb/atom.rb +60 -0
  83. data/lib/bio/db/pdb/chain.rb +117 -0
  84. data/lib/bio/db/pdb/model.rb +106 -0
  85. data/lib/bio/db/pdb/pdb.rb +1682 -0
  86. data/lib/bio/db/pdb/residue.rb +122 -0
  87. data/lib/bio/db/pdb/utils.rb +234 -0
  88. data/lib/bio/db/prosite.rb +616 -0
  89. data/lib/bio/db/rebase.rb +417 -0
  90. data/lib/bio/db/transfac.rb +387 -0
  91. data/lib/bio/feature.rb +201 -0
  92. data/lib/bio/io/brdb.rb +103 -0
  93. data/lib/bio/io/das.rb +471 -0
  94. data/lib/bio/io/dbget.rb +212 -0
  95. data/lib/bio/io/ddbjxml.rb +614 -0
  96. data/lib/bio/io/fastacmd.rb +123 -0
  97. data/lib/bio/io/fetch.rb +114 -0
  98. data/lib/bio/io/flatfile.rb +496 -0
  99. data/lib/bio/io/flatfile/bdb.rb +266 -0
  100. data/lib/bio/io/flatfile/index.rb +1308 -0
  101. data/lib/bio/io/flatfile/indexer.rb +778 -0
  102. data/lib/bio/io/higet.rb +92 -0
  103. data/lib/bio/io/keggapi.rb +863 -0
  104. data/lib/bio/io/pubmed.rb +189 -0
  105. data/lib/bio/io/registry.rb +308 -0
  106. data/lib/bio/io/soapwsdl.rb +114 -0
  107. data/lib/bio/io/sql.rb +428 -0
  108. data/lib/bio/location.rb +650 -0
  109. data/lib/bio/pathway.rb +991 -0
  110. data/lib/bio/reference.rb +308 -0
  111. data/lib/bio/sequence.rb +593 -0
  112. data/lib/bio/shell.rb +51 -0
  113. data/lib/bio/shell/core.rb +512 -0
  114. data/lib/bio/shell/plugin/codon.rb +228 -0
  115. data/lib/bio/shell/plugin/entry.rb +85 -0
  116. data/lib/bio/shell/plugin/flatfile.rb +119 -0
  117. data/lib/bio/shell/plugin/keggapi.rb +187 -0
  118. data/lib/bio/shell/plugin/midi.rb +448 -0
  119. data/lib/bio/shell/plugin/obda.rb +63 -0
  120. data/lib/bio/shell/plugin/seq.rb +238 -0
  121. data/lib/bio/shell/session.rb +214 -0
  122. data/lib/bio/util/color_scheme.rb +214 -0
  123. data/lib/bio/util/color_scheme/buried.rb +78 -0
  124. data/lib/bio/util/color_scheme/helix.rb +78 -0
  125. data/lib/bio/util/color_scheme/hydropathy.rb +83 -0
  126. data/lib/bio/util/color_scheme/nucleotide.rb +50 -0
  127. data/lib/bio/util/color_scheme/strand.rb +78 -0
  128. data/lib/bio/util/color_scheme/taylor.rb +69 -0
  129. data/lib/bio/util/color_scheme/turn.rb +78 -0
  130. data/lib/bio/util/color_scheme/zappo.rb +69 -0
  131. data/lib/bio/util/contingency_table.rb +337 -0
  132. data/lib/bio/util/sirna.rb +306 -0
  133. data/lib/bioruby.rb +34 -0
  134. data/sample/biofetch.rb +475 -0
  135. data/sample/color_scheme_na.rb +99 -0
  136. data/sample/dbget +37 -0
  137. data/sample/fasta2tab.rb +99 -0
  138. data/sample/fsplit.rb +51 -0
  139. data/sample/gb2fasta.rb +31 -0
  140. data/sample/gb2tab.rb +325 -0
  141. data/sample/gbtab2mysql.rb +161 -0
  142. data/sample/genes2nuc.rb +33 -0
  143. data/sample/genes2pep.rb +33 -0
  144. data/sample/genes2tab.rb +81 -0
  145. data/sample/genome2rb.rb +29 -0
  146. data/sample/genome2tab.rb +76 -0
  147. data/sample/goslim.rb +311 -0
  148. data/sample/gt2fasta.rb +47 -0
  149. data/sample/pmfetch.rb +42 -0
  150. data/sample/pmsearch.rb +42 -0
  151. data/sample/psortplot_html.rb +222 -0
  152. data/sample/ssearch2tab.rb +96 -0
  153. data/sample/tdiary.rb +158 -0
  154. data/sample/tfastx2tab.rb +100 -0
  155. data/sample/vs-genes.rb +212 -0
  156. data/test/data/SOSUI/sample.report +11 -0
  157. data/test/data/TMHMM/sample.report +21 -0
  158. data/test/data/blast/eco:b0002.faa +15 -0
  159. data/test/data/blast/eco:b0002.faa.m0 +128 -0
  160. data/test/data/blast/eco:b0002.faa.m7 +65 -0
  161. data/test/data/blast/eco:b0002.faa.m8 +1 -0
  162. data/test/data/embl/AB090716.embl +65 -0
  163. data/test/data/genscan/sample.report +63 -0
  164. data/test/data/prosite/prosite.dat +2233 -0
  165. data/test/data/refseq/nm_126355.entret +64 -0
  166. data/test/data/uniprot/p53_human.uniprot +1456 -0
  167. data/test/runner.rb +10 -0
  168. data/test/unit/bio/appl/blast/test_report.rb +427 -0
  169. data/test/unit/bio/appl/blast/test_xmlparser.rb +400 -0
  170. data/test/unit/bio/appl/genscan/test_report.rb +195 -0
  171. data/test/unit/bio/appl/sosui/test_report.rb +94 -0
  172. data/test/unit/bio/appl/targetp/test_report.rb +159 -0
  173. data/test/unit/bio/appl/test_blast.rb +159 -0
  174. data/test/unit/bio/appl/test_fasta.rb +142 -0
  175. data/test/unit/bio/appl/tmhmm/test_report.rb +139 -0
  176. data/test/unit/bio/data/test_aa.rb +103 -0
  177. data/test/unit/bio/data/test_codontable.rb +120 -0
  178. data/test/unit/bio/data/test_na.rb +89 -0
  179. data/test/unit/bio/db/embl/test_common.rb +130 -0
  180. data/test/unit/bio/db/embl/test_embl.rb +227 -0
  181. data/test/unit/bio/db/embl/test_sptr.rb +268 -0
  182. data/test/unit/bio/db/embl/test_uniprot.rb +44 -0
  183. data/test/unit/bio/db/kegg/test_genes.rb +58 -0
  184. data/test/unit/bio/db/test_fasta.rb +263 -0
  185. data/test/unit/bio/db/test_gff.rb +140 -0
  186. data/test/unit/bio/db/test_prosite.rb +1450 -0
  187. data/test/unit/bio/io/test_ddbjxml.rb +87 -0
  188. data/test/unit/bio/io/test_soapwsdl.rb +45 -0
  189. data/test/unit/bio/shell/plugin/test_seq.rb +175 -0
  190. data/test/unit/bio/test_alignment.rb +1028 -0
  191. data/test/unit/bio/test_command.rb +71 -0
  192. data/test/unit/bio/test_db.rb +109 -0
  193. data/test/unit/bio/test_feature.rb +128 -0
  194. data/test/unit/bio/test_location.rb +51 -0
  195. data/test/unit/bio/test_pathway.rb +485 -0
  196. data/test/unit/bio/test_sequence.rb +386 -0
  197. data/test/unit/bio/test_shell.rb +31 -0
  198. data/test/unit/bio/util/test_color_scheme.rb +45 -0
  199. data/test/unit/bio/util/test_contingency_table.rb +106 -0
  200. data/test/unit/bio/util/test_sirna.rb +258 -0
  201. metadata +295 -0
@@ -0,0 +1,97 @@
1
+ #
2
+ # bio/db/kegg/reaction.rb - KEGG REACTION database class
3
+ #
4
+ # Copyright (C) 2004 KATAYAMA Toshiaki <k@bioruby.org>
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ # $Id: reaction.rb,v 1.3 2005/09/08 01:22:11 k Exp $
21
+ #
22
+
23
+ require 'bio/db'
24
+
25
+ module Bio
26
+
27
+ class KEGG
28
+
29
+ class REACTION < KEGGDB
30
+
31
+ DELIMITER = RS = "\n///\n"
32
+ TAGSIZE = 12
33
+
34
+ def initialize(entry)
35
+ super(entry, TAGSIZE)
36
+ end
37
+
38
+ # ENTRY
39
+ def entry_id
40
+ field_fetch('ENTRY')
41
+ end
42
+
43
+ # NAME
44
+ def name
45
+ field_fetch('NAME')
46
+ end
47
+
48
+ # DEFINITION
49
+ def definition
50
+ field_fetch('DEFINITION')
51
+ end
52
+
53
+ # EQUATION
54
+ def equation
55
+ field_fetch('EQUATION')
56
+ end
57
+
58
+ # RPAIR
59
+ def rpairs
60
+ unless @data['RPAIR']
61
+ @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
62
+ end
63
+ @data['RPAIR']
64
+ end
65
+
66
+ # PATHWAY
67
+ def pathways
68
+ lines_fetch('PATHWAY')
69
+ end
70
+
71
+ # ENZYME
72
+ def enzymes
73
+ unless @data['ENZYME']
74
+ @data['ENZYME'] = fetch('ENZYME').scan(/\S+/)
75
+ end
76
+ @data['ENZYME']
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+
83
+ end
84
+
85
+
86
+ if __FILE__ == $0
87
+ entry = ARGF.read
88
+ rn = Bio::KEGG::REACTION.new(entry)
89
+ p rn.entry_id
90
+ p rn.name
91
+ p rn.definition
92
+ p rn.equation
93
+ p rn.rpairs
94
+ p rn.pathways
95
+ p rn.enzymes
96
+ end
97
+
@@ -0,0 +1,131 @@
1
+ #
2
+ # = bio/db/litdb.rb - LITDB database class
3
+ #
4
+ # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k@bioruby.org>
5
+ # License:: LGPL
6
+ #
7
+ # $Id: litdb.rb,v 0.7 2005/12/18 15:58:41 k Exp $
8
+ #
9
+ # == Description
10
+ #
11
+ #
12
+ # == Example
13
+ # == References
14
+ #
15
+ #--
16
+ #
17
+ # This library is free software; you can redistribute it and/or
18
+ # modify it under the terms of the GNU Lesser General Public
19
+ # License as published by the Free Software Foundation; either
20
+ # version 2 of the License, or (at your option) any later version.
21
+ #
22
+ # This library is distributed in the hope that it will be useful,
23
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ # Lesser General Public License for more details.
26
+ #
27
+ # You should have received a copy of the GNU Lesser General Public
28
+ # License along with this library; if not, write to the Free Software
29
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
+ #
31
+ #++
32
+ #
33
+
34
+ require 'bio/db'
35
+
36
+ module Bio
37
+
38
+ # = LITDB class
39
+ class LITDB < NCBIDB
40
+
41
+ # Delimiter
42
+ DELIMITER = "\nEND\n"
43
+
44
+ # Delimiter
45
+ RS = DELIMITER
46
+
47
+ #
48
+ TAGSIZE = 12
49
+
50
+ #
51
+ def initialize(entry)
52
+ super(entry, TAGSIZE)
53
+ end
54
+
55
+ # Returns
56
+ def reference
57
+ hash = Hash.new('')
58
+
59
+ hash['authors'] = author.split(/;/).map {|x| x.sub(/,/, ', ')}
60
+ hash['title'] = title
61
+ hash['journal'] = journal.gsub(/\./, '. ').strip
62
+
63
+ vol = volume.split(/,\s+/)
64
+ if vol.size > 1
65
+ hash['volume'] = vol.shift.sub(/Vol\./, '')
66
+ hash['pages'],
67
+ hash['year'] = vol.pop.split(' ')
68
+ hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty?
69
+ end
70
+
71
+ return Reference.new(hash)
72
+ end
73
+
74
+ # CODE
75
+ def entry_id
76
+ field_fetch('CODE')
77
+ end
78
+
79
+ # TITLE
80
+ def title
81
+ field_fetch('TITLE')
82
+ end
83
+
84
+ # FIELD
85
+ def field
86
+ field_fetch('FIELD')
87
+ end
88
+
89
+ # JOURNAL
90
+ def journal
91
+ field_fetch('JOURNAL')
92
+ end
93
+
94
+ # VOLUME
95
+ def volume
96
+ field_fetch('VOLUME')
97
+ end
98
+
99
+ # KEYWORD ';;'
100
+ def keyword
101
+ unless @data['KEYWORD']
102
+ @data['KEYWORD'] = fetch('KEYWORD').split(/;;\s*/)
103
+ end
104
+ @data['KEYWORD']
105
+ end
106
+
107
+ # AUTHOR
108
+ def author
109
+ field_fetch('AUTHOR')
110
+ end
111
+
112
+ end
113
+
114
+ end
115
+
116
+
117
+ if __FILE__ == $0
118
+ require 'bio/io/fetch'
119
+
120
+ entry = Bio::Fetch.query('litdb', '0308004')
121
+ puts entry
122
+ p Bio::LITDB.new(entry).reference
123
+
124
+ entry = Bio::Fetch.query('litdb', '0309094')
125
+ puts entry
126
+ p Bio::LITDB.new(entry).reference
127
+
128
+ entry = Bio::Fetch.query('litdb', '0309093')
129
+ puts entry
130
+ p Bio::LITDB.new(entry).reference
131
+ end
@@ -0,0 +1,317 @@
1
+ #
2
+ # bio/db/medline.rb - NCBI PubMed/MEDLINE database class
3
+ #
4
+ # Copyright (C) 2001, 2005 KATAYAMA Toshiaki <k@bioruby.org>
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ # $Id: medline.rb,v 1.12 2005/09/08 01:22:11 k Exp $
21
+ #
22
+
23
+ require 'bio/db'
24
+
25
+ module Bio
26
+
27
+ class MEDLINE < NCBIDB
28
+
29
+ def initialize(entry)
30
+ @pubmed = Hash.new('')
31
+
32
+ tag = ''
33
+ entry.each_line do |line|
34
+ if line =~ /^\w/
35
+ tag = line[0,4].strip
36
+ end
37
+ @pubmed[tag] += line[6..-1] if line.length > 6
38
+ end
39
+ end
40
+
41
+
42
+ # Reference object
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
63
+
64
+
65
+ ### Common MEDLINE tags
66
+
67
+ # PMID - PubMed Unique Identifier
68
+ # Unique number assigned to each PubMed citation.
69
+ def pmid
70
+ @pubmed['PMID'].strip
71
+ end
72
+ alias entry_id pmid
73
+
74
+ # UI - MEDLINE Unique Identifier
75
+ # Unique number assigned to each MEDLINE citation.
76
+ def ui
77
+ @pubmed['UI'].strip
78
+ end
79
+
80
+ # TA - Journal Title Abbreviation
81
+ # Standard journal title abbreviation.
82
+ def ta
83
+ @pubmed['TA'].gsub(/\s+/, ' ').strip
84
+ end
85
+ alias journal ta
86
+
87
+ # VI - Volume
88
+ # Journal volume.
89
+ def vi
90
+ @pubmed['VI'].strip
91
+ end
92
+ alias volume vi
93
+
94
+ # IP - Issue
95
+ # The number of the issue, part, or supplement of the journal in which
96
+ # the article was published.
97
+ def ip
98
+ @pubmed['IP'].strip
99
+ end
100
+ alias issue ip
101
+
102
+ # PG - Page Number
103
+ # The full pagination of the article.
104
+ def pg
105
+ @pubmed['PG'].strip
106
+ end
107
+
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
119
+
120
+ # DP - Publication Date
121
+ # The date the article was published.
122
+ def dp
123
+ @pubmed['DP'].strip
124
+ end
125
+ alias date dp
126
+
127
+ def year
128
+ dp[0,4]
129
+ end
130
+
131
+ # TI - Title Words
132
+ # The title of the article.
133
+ def ti
134
+ @pubmed['TI'].gsub(/\s+/, ' ').strip
135
+ end
136
+ alias title ti
137
+
138
+ # AB - Abstract
139
+ # Abstract.
140
+ def ab
141
+ @pubmed['AB'].gsub(/\s+/, ' ').strip
142
+ end
143
+ alias abstract ab
144
+
145
+ # AU - Author Name
146
+ # Authors' names.
147
+ def au
148
+ @pubmed['AU'].strip
149
+ end
150
+
151
+ def authors
152
+ authors = []
153
+ au.split(/\n/).each do |author|
154
+ if author =~ / /
155
+ name = author.split(/\s+/)
156
+ suffix = name[-2] =~ /^[A-Z]+$/ ? name.pop : nil # Jr etc.
157
+ initial = name.pop.split(//).join('. ')
158
+ author = "#{name.join(' ')}, #{initial}."
159
+ end
160
+ if suffix
161
+ author << " " + suffix
162
+ end
163
+ authors.push(author)
164
+ end
165
+ return authors
166
+ end
167
+
168
+ # SO - Source
169
+ # Composite field containing bibliographic information.
170
+ def so
171
+ @pubmed['SO'].strip
172
+ end
173
+ alias source so
174
+
175
+ # MH - MeSH Terms
176
+ # NLM's controlled vocabulary.
177
+ def mh
178
+ @pubmed['MH'].strip.split(/\n/)
179
+ end
180
+ alias mesh mh
181
+
182
+ # AD - Affiliation
183
+ # Institutional affiliation and address of the first author, and grant
184
+ # numbers.
185
+ def ad
186
+ @pubmed['AD'].strip.split(/\n/)
187
+ end
188
+ alias affiliations ad
189
+
190
+
191
+ ### Other MEDLINE tags
192
+
193
+ # AID - Article Identifier
194
+ # Article ID values may include the pii (controlled publisher identifier)
195
+ # or doi (Digital Object Identifier).
196
+
197
+ # CI - Copyright Information
198
+ # Copyright statement.
199
+
200
+ # CIN - Comment In
201
+ # Reference containing a comment about the article.
202
+
203
+ # CN - Collective Name
204
+ # Corporate author or group names with authorship responsibility.
205
+
206
+ # CON - Comment On
207
+ # Reference upon which the article comments.
208
+
209
+ # CY - Country
210
+ # The place of publication of the journal.
211
+
212
+ # DA - Date Created
213
+ # Used for internal processing at NLM.
214
+
215
+ # DCOM - Date Completed
216
+ # Used for internal processing at NLM.
217
+
218
+ # DEP - Date of Electronic Publication
219
+ # Electronic publication date.
220
+
221
+ # EDAT - Entrez Date
222
+ # The date the citation was added to PubMed.
223
+
224
+ # EIN - Erratum In
225
+ # Reference containing a published erratum to the article.
226
+
227
+ # GS - Gene Symbol
228
+ # Abbreviated gene names (used 1991 through 1996).
229
+
230
+ # ID - Identification Number
231
+ # Research grant numbers, contract numbers, or both that designate
232
+ # financial support by any agency of the US PHS (Public Health Service).
233
+
234
+ # IS - ISSN
235
+ # International Standard Serial Number of the journal.
236
+
237
+ # JC - Journal Title Code
238
+ # MEDLINE unique three-character code for the journal.
239
+
240
+ # JID - NLM Unique ID
241
+ # Unique journal ID in NLM's catalog of books, journals, and audiovisuals.
242
+
243
+ # LA - Language
244
+ # The language in which the article was published.
245
+
246
+ # LR - Last Revision Date
247
+ # The date a change was made to the record during a maintenance procedure.
248
+
249
+ # MHDA - MeSH Date
250
+ # The date MeSH terms were added to the citation. The MeSH date is the
251
+ # same as the Entrez date until MeSH are added.
252
+
253
+ # PHST - Publication History Status Date
254
+ # History status date.
255
+
256
+ # PS - Personal Name as Subject
257
+ # Individual is the subject of the article.
258
+
259
+ # PST - Publication Status
260
+ # Publication status.
261
+
262
+ # PT - Publication Type
263
+ # The type of material the article represents.
264
+ def pt
265
+ @pubmed['PT'].strip.split(/\n/)
266
+ end
267
+ alias publication_type pt
268
+
269
+ # RF - Number of References
270
+ # Number of bibliographic references for Review articles.
271
+
272
+ # RIN - Retraction In
273
+ # Retraction of the article
274
+
275
+ # RN - EC/RN Number
276
+ # Number assigned by the Enzyme Commission to designate a particular
277
+ # enzyme or by the Chemical Abstracts Service for Registry Numbers.
278
+
279
+ # ROF - Retraction Of
280
+ # Article being retracted.
281
+
282
+ # RPF - Republished From
283
+ # Original article.
284
+
285
+ # SB - Journal Subset
286
+ # Code for a specific set of journals.
287
+
288
+ # SI - Secondary Source Identifier
289
+ # Identifies a secondary source that supplies information, e.g., other
290
+ # data sources, databanks and accession numbers of molecular sequences
291
+ # discussed in articles.
292
+
293
+ # TT - Transliterated / Vernacular Title
294
+ # Non-Roman alphabet language titles are transliterated.
295
+
296
+ # UIN - Update In
297
+ # Update to the article.
298
+
299
+ # UOF - Update Of
300
+ # The article being updated.
301
+
302
+ # URLF - URL Full-Text
303
+ # Link to the full-text of article at provider's website. Links are
304
+ # incomplete. Use PmLink for the complete set of available links.
305
+ # [PmLink] http://www.ncbi.nlm.nih.gov/entrez/utils/pmlink_help.html
306
+
307
+ # URLS - URL Summary
308
+ # Link to the article summary at provider's website. Links are
309
+ # incomplete. Use PmLink for the complete set of available links.
310
+ # [PmLink] http://www.ncbi.nlm.nih.gov/entrez/utils/pmlink_help.html
311
+
312
+ end
313
+
314
+ end
315
+
316
+
317
+