bio 1.5.2 → 1.6.0.pre.20181210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +12 -11
  3. data/ChangeLog +14 -3106
  4. data/{gemfiles/Gemfile.travis-ruby2.2 → Gemfile} +0 -1
  5. data/KNOWN_ISSUES.rdoc +0 -5
  6. data/README.rdoc +11 -18
  7. data/RELEASE_NOTES.rdoc +34 -291
  8. data/Rakefile +13 -9
  9. data/appveyor.yml +21 -0
  10. data/bioruby.gemspec +7 -78
  11. data/bioruby.gemspec.erb +8 -27
  12. data/doc/ChangeLog-1.5.0 +2919 -0
  13. data/doc/RELEASE_NOTES-1.5.0.rdoc +285 -0
  14. data/doc/Tutorial.rd +6 -108
  15. data/doc/Tutorial.rd.html +19 -98
  16. data/gemfiles/Gemfile.travis-jruby1.8 +3 -5
  17. data/gemfiles/Gemfile.travis-jruby1.9 +0 -3
  18. data/gemfiles/Gemfile.travis-rbx +0 -1
  19. data/gemfiles/Gemfile.travis-ruby1.8 +4 -4
  20. data/gemfiles/Gemfile.travis-ruby1.9 +0 -1
  21. data/gemfiles/prepare-gemspec.rb +4 -0
  22. data/lib/bio.rb +0 -10
  23. data/lib/bio/data/codontable.rb +99 -3
  24. data/lib/bio/io/togows.rb +5 -5
  25. data/lib/bio/version.rb +6 -8
  26. data/sample/test_restriction_enzyme_long.rb +1 -1
  27. data/test/unit/bio/data/test_codontable.rb +3 -0
  28. metadata +11 -77
  29. data/bin/bioruby +0 -47
  30. data/bin/br_biofetch.rb +0 -71
  31. data/bin/br_bioflat.rb +0 -293
  32. data/bin/br_biogetseq.rb +0 -45
  33. data/bin/br_pmfetch.rb +0 -422
  34. data/lib/bio/db/biosql/biosql_to_biosequence.rb +0 -78
  35. data/lib/bio/db/biosql/sequence.rb +0 -444
  36. data/lib/bio/db/phyloxml/phyloxml.xsd +0 -582
  37. data/lib/bio/db/phyloxml/phyloxml_elements.rb +0 -1197
  38. data/lib/bio/db/phyloxml/phyloxml_parser.rb +0 -1001
  39. data/lib/bio/db/phyloxml/phyloxml_writer.rb +0 -227
  40. data/lib/bio/io/biosql/ar-biosql.rb +0 -257
  41. data/lib/bio/io/biosql/biosql.rb +0 -39
  42. data/lib/bio/io/biosql/config/database.yml +0 -21
  43. data/lib/bio/io/sql.rb +0 -79
  44. data/lib/bio/shell.rb +0 -44
  45. data/lib/bio/shell/core.rb +0 -578
  46. data/lib/bio/shell/demo.rb +0 -146
  47. data/lib/bio/shell/interface.rb +0 -217
  48. data/lib/bio/shell/irb.rb +0 -94
  49. data/lib/bio/shell/object.rb +0 -71
  50. data/lib/bio/shell/plugin/blast.rb +0 -42
  51. data/lib/bio/shell/plugin/codon.rb +0 -218
  52. data/lib/bio/shell/plugin/das.rb +0 -58
  53. data/lib/bio/shell/plugin/emboss.rb +0 -23
  54. data/lib/bio/shell/plugin/entry.rb +0 -137
  55. data/lib/bio/shell/plugin/flatfile.rb +0 -101
  56. data/lib/bio/shell/plugin/midi.rb +0 -430
  57. data/lib/bio/shell/plugin/ncbirest.rb +0 -68
  58. data/lib/bio/shell/plugin/obda.rb +0 -45
  59. data/lib/bio/shell/plugin/psort.rb +0 -56
  60. data/lib/bio/shell/plugin/seq.rb +0 -248
  61. data/lib/bio/shell/plugin/togows.rb +0 -40
  62. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +0 -29
  63. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +0 -4
  64. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +0 -27
  65. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +0 -11
  66. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +0 -4
  67. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +0 -7
  68. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
  69. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
  70. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
  71. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +0 -368
  72. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +0 -47
  73. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +0 -144
  74. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +0 -47
  75. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +0 -8
  76. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +0 -10
  77. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +0 -26
  78. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
  79. data/lib/bio/shell/script.rb +0 -25
  80. data/lib/bio/shell/setup.rb +0 -108
  81. data/lib/bio/shell/web.rb +0 -102
  82. data/sample/test_phyloxml_big.rb +0 -205
  83. data/test/data/phyloxml/apaf.xml +0 -666
  84. data/test/data/phyloxml/bcl_2.xml +0 -2097
  85. data/test/data/phyloxml/made_up.xml +0 -144
  86. data/test/data/phyloxml/ncbi_taxonomy_mollusca_short.xml +0 -65
  87. data/test/data/phyloxml/phyloxml_examples.xml +0 -415
  88. data/test/unit/bio/db/biosql/tc_biosql.rb +0 -114
  89. data/test/unit/bio/db/biosql/ts_suite_biosql.rb +0 -8
  90. data/test/unit/bio/db/test_phyloxml.rb +0 -821
  91. data/test/unit/bio/db/test_phyloxml_writer.rb +0 -334
  92. data/test/unit/bio/shell/plugin/test_seq.rb +0 -187
  93. data/test/unit/bio/test_shell.rb +0 -20
@@ -1,422 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # = pmfetch - PubMed client
4
- #
5
- # Copyright:: Copyright (C) 2004, 2005
6
- # Toshiaki Katayama <k@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- # $Id:$
10
- #
11
-
12
- require 'bio'
13
-
14
- PROG_VER = "Powered by BioRuby #{Bio::BIORUBY_VERSION_ID}"
15
- PROG_NAME = File.basename($0)
16
-
17
-
18
- require 'getoptlong'
19
-
20
-
21
- ### formatting
22
-
23
- class String
24
- def fill(fill_column = 80, prefix = '', separater = ' ')
25
- prefix = ' ' * prefix if prefix.is_a?(Integer)
26
- maxlen = fill_column - prefix.length
27
- raise "prefix is longer than fill_column" if maxlen <= 0
28
-
29
- cursor = pos = 0
30
- lines = []
31
- while cursor < self.length
32
- line = self[cursor, maxlen]
33
- pos = line.rindex(separater)
34
- pos = nil if line.length < maxlen
35
- if pos
36
- len = pos + separater.length
37
- lines << self[cursor, len]
38
- cursor += len
39
- else
40
- lines << self[cursor, maxlen]
41
- cursor += maxlen
42
- end
43
- end
44
- return lines.join("\n#{prefix}")
45
- end
46
- end
47
-
48
-
49
- module Bio
50
- class Reference
51
- def report
52
- if (num = @authors.size) > 10
53
- authors = "#{@authors[0]} et al. (#{num} authors)"
54
- elsif num > 4
55
- sep = ',' * (num - 1)
56
- authors = "#{@authors[0]}#{sep} #{@authors[-1]}"
57
- else
58
- authors = authors_join(' & ')
59
- end
60
- journal = "#{@journal} #{@year} #{@volume}(#{@issue}):#{@pages}"
61
-
62
- indent = 8
63
- prefix = ' ' * indent
64
- [
65
- "#{@pages[/\d+/]}".ljust(indent) + "#{@title}".fill(78, indent),
66
- authors,
67
- "#{journal} [PMID:#{@pubmed}]",
68
- ].join("\n#{prefix}")
69
- end
70
- end
71
- end
72
-
73
-
74
- class PMFetch
75
-
76
- class Examples < StandardError; end
77
- class Version < StandardError; end
78
- class Usage < StandardError; end
79
-
80
- ### default options
81
-
82
- def initialize
83
- @format = 'rd'
84
- @search_opts = {
85
- 'retmax' => 20,
86
- }
87
- @query = nil
88
- @query_opts = []
89
- @pmid_list_only = false
90
-
91
- pmfetch
92
- end
93
-
94
-
95
- ### main
96
-
97
- def pmfetch
98
- begin
99
- set_options
100
- parse_options
101
- check_query
102
- rescue PMFetch::Examples
103
- puts examples
104
- exit
105
- rescue PMFetch::Version
106
- puts version
107
- exit
108
- rescue PMFetch::Usage
109
- puts usage
110
- exit
111
- rescue GetoptLong::MissingArgument, GetoptLong::InvalidOption
112
- puts usage
113
- exit
114
- end
115
-
116
- list = pm_esearch
117
-
118
- if list.empty?
119
- ;
120
- elsif @pmid_list_only
121
- puts list
122
- else
123
- pm_efetch(list)
124
- end
125
- end
126
-
127
-
128
- ### help
129
-
130
- def usage
131
- %Q[
132
- Usage: #{PROG_NAME} [options...] "query string"
133
- or #{PROG_NAME} --query "query string" [other options...]
134
-
135
- Options:
136
- -q --query "genome AND virus" Query string for PubMed search
137
- -t --title "mobile elements" Title of the article to search
138
- -j --journal "genome res" Journal title to search
139
- -v --volume # Journal volume to search
140
- -i --issue # Journal issue to search
141
- -p --page # First page number of the article to search
142
- -a --author "Altschul SF" Author name to search
143
- -m --mesh "SARS virus" MeSH term to search
144
- -f --format bibtex Summary output format
145
- --pmidlist Output only a list of PubMed IDs
146
- -n --retmax # Number of articles to retrieve at the maximum
147
- -N --retstart # Starting number of the articles to retrieve
148
- -s --sort pub+date Sort method for the summary output
149
- --reldate # Search articles published within recent # days
150
- --mindate YYYY/MM/DD Search articles published after the date
151
- --maxdate YYYY/MM/DD Search articles published before the date
152
- --help Output this help, then exit
153
- --examples Output examples, then exit
154
- --version Output version number, then exit
155
-
156
- Formats:
157
- endnote, medline, bibitem, bibtex, report, rd,
158
- nature, science, genome_res, genome_biol, nar, current, trends, cell
159
-
160
- Sort:
161
- author, journal, pub+date, page
162
-
163
- See the following pages for the PubMed search options:
164
- http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html
165
- http://www.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html
166
-
167
- #{version}
168
-
169
- ]
170
- end
171
-
172
- def version
173
- PROG_VER
174
- end
175
-
176
- def examples
177
- DATA.read.gsub('PMFetch', PROG_NAME)
178
- end
179
-
180
-
181
- private
182
-
183
-
184
- ### options
185
-
186
- def set_options
187
- @parser = GetoptLong.new
188
-
189
- @parser.set_options(
190
- [ '--query', '-q', GetoptLong::REQUIRED_ARGUMENT ],
191
- [ '--title', '-t', GetoptLong::REQUIRED_ARGUMENT ],
192
- [ '--journal', '-j', GetoptLong::REQUIRED_ARGUMENT ],
193
- [ '--volume', '-v', GetoptLong::REQUIRED_ARGUMENT ],
194
- [ '--issue', '-i', GetoptLong::REQUIRED_ARGUMENT ],
195
- [ '--page', '-p', GetoptLong::REQUIRED_ARGUMENT ],
196
- [ '--author', '-a', GetoptLong::REQUIRED_ARGUMENT ],
197
- [ '--mesh', '-m', GetoptLong::REQUIRED_ARGUMENT ],
198
- [ '--format', '-f', GetoptLong::REQUIRED_ARGUMENT ],
199
- [ '--pmidlist', GetoptLong::NO_ARGUMENT ],
200
- [ '--retmax', '-n', GetoptLong::REQUIRED_ARGUMENT ],
201
- [ '--retstart', '-N', GetoptLong::REQUIRED_ARGUMENT ],
202
- [ '--sort', '-s', GetoptLong::REQUIRED_ARGUMENT ],
203
- [ '--reldate', GetoptLong::REQUIRED_ARGUMENT ],
204
- [ '--mindate', GetoptLong::REQUIRED_ARGUMENT ],
205
- [ '--maxdate', GetoptLong::REQUIRED_ARGUMENT ],
206
- [ '--examples', GetoptLong::NO_ARGUMENT ],
207
- [ '--help', GetoptLong::NO_ARGUMENT ],
208
- [ '--version', GetoptLong::NO_ARGUMENT ]
209
- )
210
- end
211
-
212
- def parse_options
213
- @parser.each_option do |optname, optarg|
214
- case optname
215
- when /--query/
216
- @query = optarg
217
- when /--title/
218
- @query_opts << "#{optarg}[ti]"
219
- when /--journal/
220
- @query_opts << "#{optarg}[ta]"
221
- when /--volume/
222
- @query_opts << "#{optarg}[vi]"
223
- when /--issue/
224
- @query_opts << "#{optarg}[ip]"
225
- when /--page/
226
- @query_opts << "#{optarg}[pg]"
227
- when /--author/
228
- @query_opts << "#{optarg}[au]"
229
- when /--mesh/
230
- @query_opts << "#{optarg}[mh]"
231
- when /--format/
232
- @format = optarg
233
- when /--pmidlist/
234
- @pmid_list_only = true
235
- when /--examples/
236
- raise PMFetch::Examples
237
- when /--help/
238
- raise PMFetch::Usage
239
- when /--version/
240
- raise PMFetch::Version
241
- when /--sort/
242
- @sort = optarg
243
- @search_opts["sort"] = @sort unless @sort == "page"
244
- else
245
- optname.delete!('-')
246
- @search_opts[optname] = optarg
247
- end
248
- end
249
- end
250
-
251
-
252
- ### check query
253
-
254
- def check_query
255
- p @query if $DEBUG
256
- @query ||= ARGV.join(" ") unless ARGV.empty?
257
-
258
- p @query if $DEBUG
259
- @query_str = [ @query, @query_opts ].flatten.compact.join(" AND ")
260
-
261
- p @query_str if $DEBUG
262
- if @query_str.empty?
263
- raise PMFetch::Usage
264
- end
265
- end
266
-
267
-
268
- ### search
269
-
270
- def pm_esearch
271
- return Bio::PubMed.esearch(@query_str, @search_opts)
272
- end
273
-
274
- def pm_efetch(list)
275
- entries = Bio::PubMed.efetch(list)
276
-
277
- if @format == 'medline'
278
- medline_format(entries)
279
- else
280
- entries = parse_entries(entries)
281
- if @sort == 'page'
282
- entries = sort_entries(entries)
283
- end
284
- if @format == 'report'
285
- report_format(entries)
286
- else
287
- other_format(entries)
288
- end
289
- end
290
- end
291
-
292
-
293
- ### output
294
-
295
- def medline_format(entries)
296
- entries.each do |entry|
297
- puts entry
298
- puts '//'
299
- end
300
- end
301
-
302
- def parse_entries(entries)
303
- entries.map { |entry| Bio::MEDLINE.new(entry) }
304
- end
305
-
306
- def sort_entries(entries)
307
- if RUBY_VERSION > "1.8.0"
308
- entries.sort_by { |x|
309
- [ x.journal, x.volume.to_i, x.issue.to_i, x.pages.to_i ]
310
- }
311
- else
312
- entries.map { |x|
313
- [ x.journal, x.volume.to_i, x.issue.to_i, x.pages.to_i, x ]
314
- }.sort { |a, b|
315
- a[0..3] <=> b[0..3]
316
- }.map { |y|
317
- y.pop
318
- }
319
- end
320
- end
321
-
322
- def report_format(entries)
323
- entries.each do |entry|
324
- puts entry.reference.report
325
- puts
326
- end
327
- end
328
-
329
- def other_format(entries)
330
- entries.each do |entry|
331
- puts entry.reference.format(@format)
332
- puts
333
- end
334
- end
335
-
336
- end
337
-
338
-
339
- PMFetch.new
340
-
341
-
342
- __END__
343
-
344
- = Examples : PubMed search
345
-
346
- These four lines will do the same job.
347
-
348
- % PMFetch transcription factor
349
- % PMFetch "transcription factor"
350
- % PMFetch --query "transcription factor"
351
- % PMFetch -q "transcription factor"
352
-
353
-
354
- Retrieve max 100 artiecles (20 is a NCBI's default) at a time, use --retmax as
355
-
356
- % PMFetch -q "transcription factor" --retmax 100
357
-
358
- and, to retrieve next 100 articles, use --retstart as
359
-
360
- % PMFetch -q "transcription factor" --retmax 100 --retstart 100
361
-
362
-
363
- You can narrow the search target for an issue of the journal.
364
-
365
- % PMFetch --journal development --volume 131 --issue 3 transcription factor
366
-
367
-
368
- Short options are also available.
369
-
370
- % PMFetch -j development -v 131 -i 3 transcription factor
371
-
372
-
373
- Search articles indexed in PubMed within these 90 days.
374
-
375
- % PMFetch -q "transcription factor" --reldate 90
376
-
377
-
378
- Search articles indexed in PubMed during the period of 2001/04/01 to 2001/08/31
379
-
380
- % PMFetch -q "transcription factor" --mindate 2001/04/01 --maxdate 2001/08/31
381
-
382
-
383
- Output format can be changed by --format option.
384
-
385
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f report
386
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f rd
387
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f endnote
388
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f medline
389
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f bibitem
390
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f bibtex
391
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f nature
392
- % PMFetch -q "transcription factor" -j development -v 131 -i 3 -f science
393
-
394
-
395
- Generate title listings for the journal report meeting (don't forget
396
- to inclease the number of --retmax for fetching all titles).
397
-
398
- % PMFetch -f report -j development -v 131 -i 3 -n 100
399
-
400
-
401
- Search by author name.
402
-
403
- % PMFetch -a "Karlin S"
404
- % PMFetch -a "Koonin EV"
405
-
406
-
407
- Search by MeSH term.
408
-
409
- % PMFetch -m "computational biology"
410
- % PMFetch -m "SARS virus"
411
-
412
-
413
- Search by PubMed ID (PMID).
414
-
415
- % PMFetch 12345
416
-
417
-
418
- Output PMID only.
419
-
420
- % PMFetch --pmidlist tardigrada
421
-
422
-
@@ -1,78 +0,0 @@
1
- #
2
- # = bio/db/biosql/biosql_to_biosequence.rb - Bio::SQL::Sequence to Bio::Sequence adapter module
3
- #
4
- # Copyright:: Copyright (C) 2008
5
- # Naohisa Goto <ng@bioruby.org>,
6
- # Raoul Jean Pierre Bonnal
7
- # License:: The Ruby License
8
- #
9
- # $Id:$
10
- #
11
-
12
- require 'bio/sequence'
13
- require 'bio/sequence/adapter'
14
- require 'bio/sequence/dblink'
15
-
16
- # Internal use only. Normal users should not use this module.
17
- #
18
- # Bio::SQL::Sequence to Bio::Sequence adapter module.
19
- # It is internally used in Bio::SQL::Sequence#to_biosequence.
20
- #
21
- module Bio::Sequence::Adapter::BioSQL
22
-
23
- extend Bio::Sequence::Adapter
24
-
25
- private
26
-
27
- def_biosequence_adapter :seq
28
-
29
- def_biosequence_adapter :entry_id
30
-
31
- def_biosequence_adapter :primary_accession
32
-
33
- def_biosequence_adapter :secondary_accessions
34
-
35
- def_biosequence_adapter :molecule_type
36
-
37
- #--
38
- #TODO: identify where is stored data_class in biosql
39
- #++
40
-
41
- def_biosequence_adapter :data_class
42
-
43
- def_biosequence_adapter :definition, :description
44
-
45
- def_biosequence_adapter :topology
46
-
47
- def_biosequence_adapter :date_created
48
-
49
- def_biosequence_adapter :date_modified
50
- #do |bs|
51
- # Date.parse(bs.date_modified.to_s).strftime("%d-%b-%Y").upcase
52
- # end
53
-
54
- def_biosequence_adapter :division
55
-
56
- def_biosequence_adapter :sequence_version
57
-
58
- def_biosequence_adapter :keywords
59
-
60
- def_biosequence_adapter :species
61
-
62
- def_biosequence_adapter :classification, :taxonomy
63
-
64
- def_biosequence_adapter :references
65
-
66
- def_biosequence_adapter :features
67
-
68
- def_biosequence_adapter :comments
69
-
70
- def_biosequence_adapter :other_seqids do |orig|
71
- orig.identifier.split(',').collect do |dblink|
72
- database, id = dblink.split(':')
73
- Bio::Sequence::DBLink.new(database,id)
74
- end
75
- end
76
-
77
- end #module Bio::Sequence::Adapter::BioSQL
78
-