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
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <title>BioRuby shell on Rails</title>
6
- <%= stylesheet_link_tag "bioruby.css" %>
7
- <%= javascript_include_tag :defaults %>
8
- </head>
9
-
10
- <body>
11
-
12
- <div id="content">
13
-
14
- <div id="side">
15
- <div class="title">Project</div>
16
- <ul>
17
- <li><%= link_to "#{File.basename(project_workdir)}", "file://#{project_workdir}" %>
18
- </ul>
19
-
20
- <div class="title">Functions</div>
21
- <ul>
22
- <li><%= link_to "Console", :action => "index" %></li>
23
- <li><%= link_to "History", :action => "history" %></li>
24
- <li><%= link_to "Commands", :action => "commands" %></li>
25
- </ul>
26
-
27
- <div class="title">Local variables</div>
28
- <%= render :partial => "variables" %>
29
-
30
- <br>
31
- <a href="http://bioruby.org/"><img src="/images/bioruby/link.gif" border=0></a>
32
- </div><!-- side -->
33
-
34
- <div id="title">
35
- <p class="titletop">BioRuby shell on Rails</p>
36
- <p class="titlesub">Web interface for the BioRuby library</p>
37
- </div><!-- title -->
38
-
39
- <div id="main">
40
- <%= yield %>
41
- </div><!-- main -->
42
-
43
- </div><!-- content -->
44
-
45
- </body>
46
-
47
- </html>
@@ -1,144 +0,0 @@
1
- class BiorubyController < ApplicationController
2
-
3
- HIDE_METHODS = Object.methods + [ "singleton_method_added" ]
4
-
5
- HIDE_MODULES = [
6
- Base64::Deprecated, Base64, PP::ObjectMixin, Bio::Shell,
7
- ]
8
- HIDE_MODULES << WEBrick if defined?(WEBrick)
9
-
10
- HIDE_VARIABLES = [
11
- "_", "irb", "_erbout",
12
- ]
13
-
14
- SECURITY_NOTICE = "For security purposes, this functionality is only available to local requests."
15
-
16
- def index
17
- unless local_request?
18
- flash[:notice] = SECURITY_NOTICE
19
- end
20
- end
21
-
22
- def evaluate
23
- if local_request?
24
- begin
25
- @script = params[:script].strip
26
-
27
- # write out to history
28
- Bio::Shell.store_history(@script)
29
-
30
- # evaluate ruby script
31
- @result = eval(@script, Bio::Shell.cache[:binding])
32
-
33
- # *TODO* need to handle with output of print/puts/p/pp etc. here
34
- @output = nil
35
- rescue
36
- @result = $!
37
- @output = nil
38
- end
39
- else
40
- @result = SECURITY_NOTICE
41
- @output = nil
42
- end
43
-
44
- @number = Bio::Shell.cache[:results].store(@script, @result, @output)
45
-
46
- render :update do |page|
47
- render_log(page)
48
- end
49
- end
50
-
51
- def list_methods
52
- number = params[:number].to_i
53
-
54
- script, result, output = Bio::Shell.cache[:results].restore(number)
55
- @class = result.class
56
- @methods = (result.methods - HIDE_METHODS).sort
57
-
58
- render :update do |page|
59
- page.replace_html "methods_#{number}", :partial => "methods"
60
- page.visual_effect :toggle_blind, "methods_#{number}", :duration => 0.5
61
- end
62
- end
63
-
64
- def list_classes
65
- number = params[:number].to_i
66
-
67
- script, result, output = Bio::Shell.cache[:results].restore(number)
68
- class_name = result.class
69
- @class = class_name
70
- @classes = []
71
- loop do
72
- @classes.unshift(class_name)
73
- if class_name == Object
74
- break
75
- else
76
- class_name = class_name.superclass
77
- end
78
- end
79
-
80
- render :update do |page|
81
- page.replace_html "classes_#{number}", :partial => "classes"
82
- page.visual_effect :toggle_blind, "classes_#{number}", :duration => 0.5
83
- end
84
- end
85
-
86
- def list_modules
87
- number = params[:number].to_i
88
-
89
- script, result, output = Bio::Shell.cache[:results].restore(number)
90
- @class = result.class
91
- @modules = result.class.included_modules - HIDE_MODULES
92
-
93
- render :update do |page|
94
- page.replace_html "modules_#{number}", :partial => "modules"
95
- page.visual_effect :toggle_blind, "modules_#{number}", :duration => 0.5
96
- end
97
- end
98
-
99
- def reload_script
100
- number = params[:number].to_i
101
-
102
- script, result, output = Bio::Shell.cache[:results].restore(number)
103
-
104
- render :update do |page|
105
- page.replace_html :script, script
106
- end
107
- end
108
-
109
- def results
110
- if Bio::Shell.cache[:results].number > 0
111
- limit = params[:limit].to_i
112
- max_num = Bio::Shell.cache[:results].number
113
- min_num = [ max_num - limit + 1, 1 ].max
114
- min_num = 1 if limit == 0
115
-
116
- render :update do |page|
117
- # delete all existing results in the current DOM for clean up
118
- page.select(".log").each do |element|
119
- #page.hide element
120
- page.remove element
121
- end
122
-
123
- # add selected results to the current DOM
124
- min_num.upto(max_num) do |@number|
125
- #page.show "log_#{@number}"
126
- @script, @result, @output = Bio::Shell.cache[:results].restore(@number)
127
- if @script
128
- render_log(page)
129
- end
130
- end
131
- end
132
- end
133
- end
134
-
135
- def commands
136
- @bioruby_commands = Bio::Shell.private_instance_methods.sort
137
- end
138
-
139
- def history
140
- @history = File.readlines(Bio::Shell.history_file)
141
- end
142
-
143
- end
144
-
@@ -1,47 +0,0 @@
1
- module BiorubyHelper
2
-
3
- include Bio::Shell
4
-
5
- def project_workdir
6
- if Bio::Shell.cache[:savedir].match(/\.bioruby$/)
7
- Bio::Shell.cache[:workdir]
8
- else
9
- Bio::Shell.cache[:savedir]
10
- end
11
- end
12
-
13
- def have_results
14
- Bio::Shell.cache[:results].number > 0
15
- end
16
-
17
- def local_variables
18
- eval("local_variables", Bio::Shell.cache[:binding]) -
19
- BiorubyController::HIDE_VARIABLES
20
- end
21
-
22
- def render_log(page)
23
- page.insert_html :top, :logs, :partial => "log"
24
- page.replace_html "variables", :partial => "variables"
25
- page.hide "methods_#{@number}"
26
- page.hide "classes_#{@number}"
27
- page.hide "modules_#{@number}"
28
- end
29
-
30
- def reference_link(class_or_module)
31
- name = class_or_module.to_s
32
- case name
33
- when /Bio::(.+)/
34
- path = $1.split('::').join('/')
35
- url = "http://bioruby.org/rdoc/classes/Bio/#{path}.html"
36
- when /Chem::(.+)/
37
- path = $1.split('::').join('/')
38
- url = "http://chemruby.org/rdoc/classes/Chem/#{path}.html"
39
- else
40
- path = name.split('::').join('/')
41
- url = "http://www.ruby-doc.org/core/classes/#{path}.html"
42
- end
43
- return "<a href='#{url}'>#{name}</a>"
44
- end
45
-
46
- end
47
-
@@ -1,8 +0,0 @@
1
- <div id="command">
2
- <h2>BioRuby shell commands</h2>
3
- <ul>
4
- <% @bioruby_commands.each do |cmd| %>
5
- <li><%= cmd %></li>
6
- <% end %>
7
- </ul>
8
- </div>
@@ -1,10 +0,0 @@
1
- <div id="history">
2
- <h2>Command history</h2>
3
- <% @history.each do |line| %>
4
- <% if line[/^# /] %>
5
- <div class="histtime"><%= line %></div>
6
- <% else %>
7
- <div class="histline"><%= line %></div>
8
- <% end %>
9
- <% end %>
10
- </div>
@@ -1,26 +0,0 @@
1
- <div id="console">
2
- <%- if flash[:notice] -%>
3
- <div id="notice"><p><%= flash[:notice] %></p></div><br>
4
- <%- end -%>
5
- <% form_remote_tag(:url => {:action => "evaluate"}, :position => "top",
6
- :before => %(Element.show('spinner')),
7
- :complete => %(Element.hide('spinner'))) do %>
8
- <img id="spinner" src="/images/bioruby/spinner.gif" style="display:none">
9
- <b>BioRuby script:</b>
10
- <br/>
11
- <textarea id="script" name="script" rows=10 cols=80></textarea>
12
- <br/>
13
- <input type="submit" value="Evaluate">
14
- <input type="reset" value="Clear">
15
- &nbsp;&nbsp;
16
- Show [
17
- <%= link_to_remote "All", :url => {:action => "results", :limit => 0} %> |
18
- <%= link_to_remote "Last 5", :url => {:action => "results", :limit => 5} %> |
19
- <%= link_to_remote "Previous", :url => {:action => "results", :limit => 1} %>
20
- ] or <%= link_to "Hide", :action => "index" %> results<br/>
21
- <% end %>
22
- </div>
23
-
24
- <div id="logs">
25
- </div>
26
-
@@ -1,25 +0,0 @@
1
- #
2
- # = bio/shell/script.rb - script mode for the BioRuby shell
3
- #
4
- # Copyright:: Copyright (C) 2006
5
- # Toshiaki Katayama <k@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id: script.rb,v 1.3 2007/04/05 23:35:41 trevor Exp $
9
- #
10
-
11
- module Bio::Shell
12
-
13
- class Script
14
-
15
- def initialize(script)
16
- Bio::Shell.cache[:binding] = TOPLEVEL_BINDING
17
- Bio::Shell.load_session
18
- eval(File.read(script), TOPLEVEL_BINDING)
19
- exit
20
- end
21
-
22
- end # Script
23
-
24
- end
25
-
@@ -1,108 +0,0 @@
1
- #
2
- # = bio/shell/setup.rb - setup initial environment for the BioRuby shell
3
- #
4
- # Copyright:: Copyright (C) 2006
5
- # Toshiaki Katayama <k@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- #
9
-
10
- require 'getoptlong'
11
-
12
- class Bio::Shell::Setup
13
-
14
- def initialize
15
- check_ruby_version
16
-
17
- # command line options
18
- getoptlong
19
-
20
- # setup working directory
21
- savedir = setup_savedir
22
-
23
- # load configuration and plugins
24
- Bio::Shell.configure(savedir)
25
-
26
- # set default to irb mode
27
- Bio::Shell.cache[:mode] = ((defined? @mode) && @mode) || :irb
28
-
29
- case Bio::Shell.cache[:mode]
30
- when :web
31
- # setup rails server
32
- Bio::Shell::Web.new
33
- when :irb
34
- # setup irb server
35
- Bio::Shell::Irb.new
36
- when :script
37
- # run bioruby shell script
38
- Bio::Shell::Script.new(@script)
39
- end
40
- end
41
-
42
- def check_ruby_version
43
- if RUBY_VERSION < "1.8.2"
44
- raise "BioRuby shell runs on Ruby version >= 1.8.2"
45
- end
46
- end
47
-
48
- # command line argument (working directory or bioruby shell script file)
49
- def getoptlong
50
- opts = GetoptLong.new
51
- opts.set_options(
52
- [ '--rails', '-r', GetoptLong::NO_ARGUMENT ],
53
- [ '--web', '-w', GetoptLong::NO_ARGUMENT ],
54
- [ '--console', '-c', GetoptLong::NO_ARGUMENT ],
55
- [ '--irb', '-i', GetoptLong::NO_ARGUMENT ]
56
- )
57
- opts.each_option do |opt, arg|
58
- case opt
59
- when /--rails/, /--web/
60
- @mode = :web
61
- when /--console/, /--irb/
62
- @mode = :irb
63
- end
64
- end
65
- end
66
-
67
- def setup_savedir
68
- arg = ARGV.shift
69
-
70
- # Options after the '--' argument are not parsed by GetoptLong and
71
- # are passed to irb or rails. This hack preserve the first option
72
- # when working directory of the project is not given.
73
- if arg and arg[/^-/]
74
- ARGV.unshift arg
75
- arg = nil
76
- end
77
-
78
- if arg.nil?
79
- # run in the current directory
80
- if File.exist?(Bio::Shell::Core::HISTORY)
81
- savedir = Dir.pwd
82
- else
83
- savedir = File.join(ENV['HOME'].to_s, ".bioruby")
84
- install_savedir(savedir)
85
- end
86
- elsif File.file?(arg)
87
- # run file as a bioruby shell script
88
- savedir = File.join(File.dirname(arg), "..")
89
- @script = arg
90
- @mode = :script
91
- else
92
- # run in new or existing directory
93
- if arg[/^#{File::SEPARATOR}/]
94
- savedir = arg
95
- else
96
- savedir = File.join(Dir.pwd, arg)
97
- end
98
- install_savedir(savedir)
99
- end
100
-
101
- return savedir
102
- end
103
-
104
- def install_savedir(savedir)
105
- FileUtils.makedirs(savedir)
106
- end
107
-
108
- end # Setup
@@ -1,102 +0,0 @@
1
- #
2
- # = bio/shell/web.rb - GUI for the BioRuby shell
3
- #
4
- # Copyright:: Copyright (C) 2006
5
- # Nobuya Tanaka <t@chemruby.org>,
6
- # Toshiaki Katayama <k@bioruby.org>
7
- # License:: The Ruby License
8
- #
9
- # $Id: web.rb,v 1.5 2007/06/26 08:38:38 k Exp $
10
- #
11
-
12
-
13
- module Bio::Shell
14
-
15
- class Web
16
-
17
- def initialize
18
- Bio::Shell.cache[:binding] = binding
19
- Bio::Shell.cache[:results] ||= Results.new
20
- install_rails
21
- setup_rails
22
- start_rails
23
- end
24
-
25
- private
26
-
27
- def setup_rails
28
- puts
29
- puts ">>>"
30
- puts ">>> open http://localhost:3000/bioruby"
31
- puts ">>>"
32
- puts
33
- puts '(You can change the port number by adding "-- -p 4000" option)'
34
- puts
35
- end
36
-
37
- def install_rails
38
- savedir = Bio::Shell.cache[:savedir]
39
- path = File.join(savedir, "script", "generate")
40
- unless File.exist?(path)
41
- puts "Installing Rails application for BioRuby shell ... "
42
- system("rails #{savedir}")
43
- puts "done"
44
- end
45
- path = File.join(savedir, "app", "controllers", "bioruby_controller.rb")
46
- unless File.exist?(path)
47
- basedir = File.dirname(__FILE__)
48
- puts "Installing Rails plugin for BioRuby shell ... "
49
- FileUtils.cp_r("#{basedir}/rails/.", savedir)
50
- Dir.chdir(savedir) do
51
- system("./script/generate bioruby shell")
52
- end
53
- puts "done"
54
- end
55
- end
56
-
57
- def start_rails
58
- begin
59
- Bio::Shell.cache[:rails] = Thread.new do
60
- Dir.chdir(Bio::Shell.cache[:savedir]) do
61
- require './config/boot'
62
- require 'commands/server'
63
- end
64
- end
65
- end
66
- end
67
-
68
- class Results
69
- attr_accessor :number, :script, :result, :output
70
-
71
- def initialize
72
- @number = 0
73
- @script = []
74
- @result = []
75
- @output = []
76
- end
77
-
78
- def store(script, result, output)
79
- @number += 1
80
- @script[@number] = script
81
- @result[@number] = result
82
- @output[@number] = output
83
- return @number
84
- end
85
-
86
- def restore(number)
87
- return @script[number], @result[number], @output[number]
88
- end
89
- end
90
-
91
- end
92
-
93
- private
94
-
95
- # *TODO* stop irb and start rails?
96
- #def web
97
- #end
98
-
99
- end
100
-
101
-
102
-