bio 1.5.2 → 1.6.0.pre.20181210

Sign up to get free protection for your applications and to get access to all the features.
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,47 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # = BioRuby shell - command line interface for the BioRuby library
4
- #
5
- # Copyright:: Copyright (C) 2005, 2006, 2007
6
- # Toshiaki Katayama <k@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- # $Id:$
10
- #
11
-
12
- begin
13
- require 'rubygems'
14
- gem 'bio', '>= 1.1.0'
15
- rescue LoadError
16
- require 'bio'
17
- end
18
- require 'bio/shell'
19
-
20
- # required to run commands (getseq, ls etc.)
21
- include Bio::Shell
22
-
23
- # setup command line options, working directory, and irb configurations
24
- Bio::Shell::Setup.new
25
-
26
- # loading workspace and command history
27
- Bio::Shell.load_session
28
-
29
- # sets default email address for Entrez eUtils.
30
- Bio::NCBI.default_email ||= 'staff@bioruby.org'
31
-
32
- # main loop
33
- if Bio::Shell.cache[:rails]
34
- Bio::Shell.cache[:rails].join
35
- else
36
- Signal.trap("SIGINT") do
37
- Bio::Shell.cache[:irb].signal_handle
38
- end
39
-
40
- catch(:IRB_EXIT) do
41
- Bio::Shell.cache[:irb].eval_input
42
- end
43
- end
44
-
45
- # saving workspace, command history and configuration before exit
46
- Bio::Shell.save_session
47
-
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # = biofetch - BioFetch client
4
- #
5
- # Copyright:: Copyright (C) 2002
6
- # Toshiaki Katayama <k@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- #
10
-
11
- begin
12
- require 'rubygems'
13
- rescue LoadError
14
- end
15
-
16
- require 'bio/io/fetch'
17
-
18
- def require_bio_old_biofetch_emulator(mandatory = true)
19
- begin
20
- require 'bio-old-biofetch-emulator'
21
- rescue LoadError
22
- if mandatory then
23
- $stderr.puts "Error: please install bio-old-biofetch-emulator gem."
24
- exit 1
25
- end
26
- end
27
- end
28
-
29
- def default_url
30
- 'http://bioruby.org/cgi-bin/biofetch.rb'
31
- end
32
-
33
- def another_url
34
- 'http://www.ebi.ac.uk/cgi-bin/dbfetch'
35
- end
36
-
37
- def usage
38
- puts "#{$0} [-s[erver] #{another_url}] db id [style] [format]"
39
- puts " server : URL of the BioFetch CGI (default is #{default_url})"
40
- puts " db : database name (embl, genbank, etc.)"
41
- puts " id : entry id"
42
- puts " style : 'raw' or 'html' (default is 'raw')"
43
- puts " format : change the output format ('default', 'fasta', etc.)"
44
- end
45
-
46
- if ARGV.empty? or ARGV[0] =~ /^--?h/
47
- usage
48
- exit 1
49
- end
50
-
51
- case ARGV[0]
52
- when /^--?s/ # User specified server
53
- require_bio_old_biofetch_emulator(false)
54
- ARGV.shift
55
- serv = Bio::Fetch.new(ARGV.shift)
56
- puts serv.fetch(*ARGV)
57
- when /^--?e/ # EBI server
58
- ARGV.shift
59
- serv = Bio::Fetch.new(another_url)
60
- puts serv.fetch(*ARGV)
61
- when /^--?r/ # BioRuby server
62
- require_bio_old_biofetch_emulator
63
- ARGV.shift
64
- serv = Bio::Fetch.new(default_url)
65
- puts serv.fetch(*ARGV)
66
- else # Default server
67
- require_bio_old_biofetch_emulator
68
- puts Bio::Fetch.query(*ARGV)
69
- end
70
-
71
-
@@ -1,293 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # = bioflat - OBDA flat file indexer (executable)
4
- #
5
- # Copyright:: Copyright (C) 2002
6
- # Naohisa Goto <ng@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- # $Id: br_bioflat.rb,v 1.17 2007/04/05 23:35:39 trevor Exp $
10
- #
11
-
12
- require 'bio'
13
-
14
- def usage
15
- print <<EOM
16
- Search:
17
- #{$0} [--search] [options...] [DIR/]DBNAME KEYWORDS
18
- or
19
- #{$0} [--search] --location DIR --dbname DBNAME [options...] KEYWORDS
20
-
21
- Search options:
22
- --namespace NAME set serch namespace to NAME
23
- (or --name NAME) You can set this option many times to specify
24
- more than one namespace.
25
-
26
- Create index:
27
- #{$0} --create --location DIR --dbname DBNAME [--format <genbank|embl|fasta>] [options...] [--files] FILES
28
- Update index:
29
- #{$0} --update --location DIR --dbname DBNAME [options...] [--files] FILES
30
-
31
- Create index options:
32
- --primary=UNIQUE set primary namespece to UNIQUE
33
- Default primary/secondary namespaces depend on
34
- each format of flatfiles.
35
- --secondary=KEY set secondary namespaces.
36
- You may use this option many times to specify
37
- more than one namespace.
38
- --add-secondary=KEY add secondary namespaces to default specification.
39
- You can use this option many times.
40
-
41
- Options only valid for --create (or --update) --type flat:
42
- --sort=/path/to/sort use external sort program (e.g. /usr/bin/sort)
43
- --sort=BUILTIN use builtin sort routine
44
- (default: /usr/bin/sort or BUILTIN)
45
- --env=/path/to/env use env program to run sort (default: /usr/bin/env)
46
- --env-arg=XXXXXX argument given to the env program (default: LC_ALL=C)
47
- (multiple --env-arg=XXXXXX can be specified)
48
-
49
- Options only valid for --update:
50
- --renew re-read all flatfiles and update whole index
51
-
52
- Backward compatibility:
53
- --makeindex DIR/DBNAME
54
- same as --create --type flat --location DIR --dbname DBNAME
55
- --makeindexBDB DIR/DBNAME
56
- same as --create --type bdb --location DIR --dbname DBNAME
57
- --format=CLASS
58
- instead of genbank|embl|fasta, specifing a class name is allowed
59
-
60
- Show namespaces:
61
- #{$0} --show-namespaces [--location DIR --dbname DBNAME] [DIR/DBNAME]
62
- or
63
- #{$0} --show-namespaces [--format=CLASS]
64
- or
65
- #{$0} --show-namespaces --files file
66
-
67
- EOM
68
-
69
- end
70
-
71
-
72
- def do_index(mode = :create)
73
- case ARGV[0]
74
- when /^\-\-?make/
75
- dbpath = ARGV[1]
76
- args = ARGV[2..-1]
77
- is_bdb = nil
78
- when /^\-\-?make.*bdb/i
79
- dbname = ARGV[1]
80
- args = ARGV[2..-1]
81
- is_bdb = Bio::FlatFileIndex::MAGIC_BDB
82
- when /^\-\-create/, /^\-\-update/
83
- args = ARGV[1..-1]
84
- else
85
- usage
86
- end
87
-
88
- options = {}
89
-
90
- while args.first =~ /^\-/
91
- case x = args.shift
92
-
93
- # OBDA stuff
94
-
95
- when /^\-\-?format$/
96
- args.shift
97
- format = nil # throw this f*ckin' mess for auto detect :)
98
- when /^\-\-?location/
99
- location = args.shift.chomp('/')
100
- when /^\-\-?dbname/
101
- dbname = args.shift
102
- when /^\-\-?(index)?type/
103
- indextype = args.shift
104
- case indextype
105
- when /bdb/
106
- is_bdb = Bio::FlatFileIndex::MAGIC_BDB
107
- when /flat/
108
- is_bdb = nil
109
- else
110
- usage
111
- end
112
-
113
- # BioRuby extension
114
-
115
- when /^\-\-?files/i
116
- break
117
-
118
- when /^\-\-?format\=(.*)/i
119
- format = $1
120
-
121
- when /^\-\-?sort\=(.*)/i
122
- options['sort_program'] = $1
123
- options['onmemory'] = nil
124
- when /^\-\-?no\-?te?mp/i
125
- options['onmemory'] = true
126
-
127
- when /^\-\-?env\=(.*)/i
128
- options['env_program'] = $1
129
-
130
- when /^\-\-?env-arg(?:ument)?\=(.*)/i
131
- options['env_program_arguments'] ||= []
132
- options['env_program_arguments'].push $1
133
-
134
- when /^\-\-?primary.*\=(.*)/i
135
- options['primary_namespace'] = $1
136
-
137
- when /^\-\-?add-secondary.*\=(.*)/i
138
- unless options['additional_secondary_namespaces'] then
139
- options['additional_secondary_namespaces'] = []
140
- end
141
- options['additional_secondary_namespaces'] << $1 if $1.length > 0
142
-
143
- when /^\-\-?secondary.*\=(.*)/i
144
- unless options['secondary_namespaces'] then
145
- options['secondary_namespaces'] = []
146
- end
147
- options['secondary_namespaces'] << $1 if $1.length > 0
148
-
149
- when /^\-\-?renew/
150
- options['renew'] = true
151
-
152
- else
153
- $stderr.print "Warning: ignoring invalid option #{x.inspect}\n"
154
- end
155
- end
156
-
157
- dbpath = File.join(location, dbname) unless dbpath
158
- if mode == :update then
159
- Bio::FlatFileIndex::update_index(dbpath, format, options, *args)
160
- else
161
- Bio::FlatFileIndex::makeindex(is_bdb, dbpath, format, options, *args)
162
- end
163
- end
164
-
165
-
166
- def do_search
167
- dbname = nil
168
- location = nil
169
- names = []
170
- while x = ARGV.shift
171
- case x
172
- when /\A\-\-?search/i
173
- #do nothing
174
- when /\A\-\-?location/i
175
- location = ARGV.shift.to_s.chomp('/')
176
- when /\A\-\-?dbname/i
177
- dbname = ARGV.shift
178
- when /\A\-\-?name(?:space)?(?:\=(.+))?/i
179
- if $1 then
180
- names << $1
181
- elsif x = ARGV.shift
182
- names << x
183
- end
184
- else
185
- ARGV.unshift x
186
- break
187
- end
188
- end
189
- dbname = ARGV.shift unless dbname
190
- dbname = File.join(location, dbname) unless location.to_s.empty?
191
- db = Bio::FlatFileIndex.open(dbname)
192
- ARGV.each do |key|
193
- $stderr.print "Searching for \'#{key}\'...\n"
194
- #r = db.search(key)
195
- #$stderr.print "OK, #{r.size} entry found\n"
196
- #if r.size > 0 then
197
- # print r
198
- #end
199
- begin
200
- if names.empty? then
201
- r = db.include?(key)
202
- else
203
- r = db.include_in_namespaces?(key, *names)
204
- end
205
- rescue RuntimeError
206
- $stderr.print "ERROR: #{$!}\n"
207
- next
208
- end
209
- r = [] unless r
210
- $stderr.print "OK, #{r.size} entry found\n"
211
- r.each do |i|
212
- print db.search_primary(i)
213
- end
214
- end
215
- db.close
216
- end
217
-
218
-
219
- def do_show_namespaces
220
- dbname = nil
221
- location = nil
222
- files = nil
223
- format = nil
224
- names = []
225
- while x = ARGV.shift
226
- case x
227
- when /\A\-\-?(show\-)?name(space)?s/i
228
- #do nothing
229
- when /\A\-\-?location/i
230
- location = ARGV.shift.to_s.chomp('/')
231
- when /\A\-\-?dbname/i
232
- dbname = ARGV.shift
233
- when /\A\-\-?format(?:\=(.+))?/i
234
- if $1 then
235
- format = $1
236
- elsif x = ARGV.shift
237
- format = x
238
- end
239
- when /\A\-\-?files/i
240
- files = ARGV
241
- break
242
- else
243
- ARGV.unshift x
244
- break
245
- end
246
- end
247
- if files then
248
- k = nil
249
- files.each do |x|
250
- k = Bio::FlatFile.autodetect_file(x)
251
- break if k
252
- end
253
- if k then
254
- $stderr.print "Format: #{k.to_s}\n"
255
- format = k
256
- else
257
- $stderr.print "ERROR: couldn't determine file format\n"
258
- return
259
- end
260
- end
261
- $stderr.print "Namespaces: (first line: primary namespace)\n"
262
- if format then
263
- parser = Bio::FlatFileIndex::Indexer::Parser.new(format)
264
- print parser.primary.name, "\n"
265
- puts parser.secondary.keys
266
- else
267
- dbname = ARGV.shift unless dbname
268
- dbname = File.join(location, dbname) unless location.to_s.empty?
269
- db = Bio::FlatFileIndex.open(dbname)
270
- puts db.namespaces
271
- db.close
272
- end
273
- end
274
-
275
- if ARGV.size > 1
276
- case ARGV[0]
277
- when /--make/, /--create/
278
- Bio::FlatFileIndex::DEBUG.out = true
279
- do_index
280
- when /--update/
281
- Bio::FlatFileIndex::DEBUG.out = true
282
- do_index(:update)
283
- when /\A\-\-?(show\-)?name(space)?s/i
284
- do_show_namespaces
285
- when /--search/
286
- do_search
287
- else #default is search
288
- do_search
289
- end
290
- else
291
- usage
292
- end
293
-
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # = biogetseq - OBDA sequence data retrieval (executable)
4
- #
5
- # Copyright:: Copyright (C) 2003
6
- # Toshiaki Katayama <k@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- # $Id: br_biogetseq.rb,v 1.4 2007/04/05 23:35:39 trevor Exp $
10
- #
11
-
12
- require 'bio'
13
-
14
- def usage
15
- print <<END
16
- #{$0} --dbname <dbname> [--namespace <namespace>] entry_id [entry_id]
17
- END
18
- exit 1
19
- end
20
-
21
- if ARGV.size < 3
22
- usage
23
- end
24
-
25
- while ARGV.first =~ /^-/
26
- case ARGV.shift
27
- when /^\-\-format/
28
- ARGV.shift
29
- raise NotImplementedError
30
- when /^\-\-dbname/
31
- dbname = ARGV.shift
32
- when /^\-\-namespace/
33
- namespace = ARGV.shift
34
- end
35
- end
36
-
37
- reg = Bio::Registry.new
38
- db = reg.get_database(dbname)
39
- if namespace
40
- db['namespace'] = namespace
41
- end
42
- ARGV.each do |entry|
43
- puts db.get_by_id(entry)
44
- end
45
-