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.
- checksums.yaml +5 -5
- data/.travis.yml +12 -11
- data/ChangeLog +14 -3106
- data/{gemfiles/Gemfile.travis-ruby2.2 → Gemfile} +0 -1
- data/KNOWN_ISSUES.rdoc +0 -5
- data/README.rdoc +11 -18
- data/RELEASE_NOTES.rdoc +34 -291
- data/Rakefile +13 -9
- data/appveyor.yml +21 -0
- data/bioruby.gemspec +7 -78
- data/bioruby.gemspec.erb +8 -27
- data/doc/ChangeLog-1.5.0 +2919 -0
- data/doc/RELEASE_NOTES-1.5.0.rdoc +285 -0
- data/doc/Tutorial.rd +6 -108
- data/doc/Tutorial.rd.html +19 -98
- data/gemfiles/Gemfile.travis-jruby1.8 +3 -5
- data/gemfiles/Gemfile.travis-jruby1.9 +0 -3
- data/gemfiles/Gemfile.travis-rbx +0 -1
- data/gemfiles/Gemfile.travis-ruby1.8 +4 -4
- data/gemfiles/Gemfile.travis-ruby1.9 +0 -1
- data/gemfiles/prepare-gemspec.rb +4 -0
- data/lib/bio.rb +0 -10
- data/lib/bio/data/codontable.rb +99 -3
- data/lib/bio/io/togows.rb +5 -5
- data/lib/bio/version.rb +6 -8
- data/sample/test_restriction_enzyme_long.rb +1 -1
- data/test/unit/bio/data/test_codontable.rb +3 -0
- metadata +11 -77
- data/bin/bioruby +0 -47
- data/bin/br_biofetch.rb +0 -71
- data/bin/br_bioflat.rb +0 -293
- data/bin/br_biogetseq.rb +0 -45
- data/bin/br_pmfetch.rb +0 -422
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +0 -78
- data/lib/bio/db/biosql/sequence.rb +0 -444
- data/lib/bio/db/phyloxml/phyloxml.xsd +0 -582
- data/lib/bio/db/phyloxml/phyloxml_elements.rb +0 -1197
- data/lib/bio/db/phyloxml/phyloxml_parser.rb +0 -1001
- data/lib/bio/db/phyloxml/phyloxml_writer.rb +0 -227
- data/lib/bio/io/biosql/ar-biosql.rb +0 -257
- data/lib/bio/io/biosql/biosql.rb +0 -39
- data/lib/bio/io/biosql/config/database.yml +0 -21
- data/lib/bio/io/sql.rb +0 -79
- data/lib/bio/shell.rb +0 -44
- data/lib/bio/shell/core.rb +0 -578
- data/lib/bio/shell/demo.rb +0 -146
- data/lib/bio/shell/interface.rb +0 -217
- data/lib/bio/shell/irb.rb +0 -94
- data/lib/bio/shell/object.rb +0 -71
- data/lib/bio/shell/plugin/blast.rb +0 -42
- data/lib/bio/shell/plugin/codon.rb +0 -218
- data/lib/bio/shell/plugin/das.rb +0 -58
- data/lib/bio/shell/plugin/emboss.rb +0 -23
- data/lib/bio/shell/plugin/entry.rb +0 -137
- data/lib/bio/shell/plugin/flatfile.rb +0 -101
- data/lib/bio/shell/plugin/midi.rb +0 -430
- data/lib/bio/shell/plugin/ncbirest.rb +0 -68
- data/lib/bio/shell/plugin/obda.rb +0 -45
- data/lib/bio/shell/plugin/psort.rb +0 -56
- data/lib/bio/shell/plugin/seq.rb +0 -248
- data/lib/bio/shell/plugin/togows.rb +0 -40
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +0 -29
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +0 -27
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +0 -11
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +0 -7
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +0 -368
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +0 -144
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +0 -8
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +0 -10
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +0 -26
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/shell/script.rb +0 -25
- data/lib/bio/shell/setup.rb +0 -108
- data/lib/bio/shell/web.rb +0 -102
- data/sample/test_phyloxml_big.rb +0 -205
- data/test/data/phyloxml/apaf.xml +0 -666
- data/test/data/phyloxml/bcl_2.xml +0 -2097
- data/test/data/phyloxml/made_up.xml +0 -144
- data/test/data/phyloxml/ncbi_taxonomy_mollusca_short.xml +0 -65
- data/test/data/phyloxml/phyloxml_examples.xml +0 -415
- data/test/unit/bio/db/biosql/tc_biosql.rb +0 -114
- data/test/unit/bio/db/biosql/ts_suite_biosql.rb +0 -8
- data/test/unit/bio/db/test_phyloxml.rb +0 -821
- data/test/unit/bio/db/test_phyloxml_writer.rb +0 -334
- data/test/unit/bio/shell/plugin/test_seq.rb +0 -187
- data/test/unit/bio/test_shell.rb +0 -20
data/lib/bio/shell/demo.rb
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = bio/shell/demo.rb - demo 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: demo.rb,v 1.4 2007/04/05 23:35:41 trevor Exp $
|
9
|
-
#
|
10
|
-
|
11
|
-
module Bio::Shell
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def demo(part = nil)
|
16
|
-
demo = Demo.new
|
17
|
-
if part
|
18
|
-
demo.send(part)
|
19
|
-
else
|
20
|
-
demo.all
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Demo
|
25
|
-
|
26
|
-
def initialize
|
27
|
-
@bind = Bio::Shell.cache[:binding]
|
28
|
-
end
|
29
|
-
|
30
|
-
def all
|
31
|
-
sequence &&
|
32
|
-
entry &&
|
33
|
-
shell &&
|
34
|
-
pdb &&
|
35
|
-
true
|
36
|
-
end
|
37
|
-
|
38
|
-
def tutorial
|
39
|
-
end
|
40
|
-
|
41
|
-
def aldh2
|
42
|
-
end
|
43
|
-
|
44
|
-
def mito
|
45
|
-
run(%q[entry = getent("data/kumamushi.gb")], "Load kumamushi gene from GenBank database entry ...", false) &&
|
46
|
-
run(%q[disp entry], "Check the contents ...", false) &&
|
47
|
-
run(%q[kuma = flatparse(entry)], "Parse the database entry ...", true) &&
|
48
|
-
run(%q[web], "Start BioRuby on Rails...", false) &&
|
49
|
-
run(%q[puts kuma.entry_id], "Extract entry ID ...", false) &&
|
50
|
-
run(%q[puts kuma.definition], "Extract definition ...", false) &&
|
51
|
-
run(%q[gene = kuma.seq], "Extract DNA sequence of the gene ...", true) &&
|
52
|
-
run(%q[doublehelix(gene)], "Show the sequence in ascii art ...", false) &&
|
53
|
-
run(%q[seqstat(gene)], "Statistics of the gene ...", false) &&
|
54
|
-
run(%q[config :color], "Change to color mode...", false) &&
|
55
|
-
run(%q[seqstat(gene)], "Statistics of the gene ...", false) &&
|
56
|
-
#run(%q[codontable], "Codontalble ...", false) &&
|
57
|
-
run(%q[protein = gene.translate], "Translate DNA into protein ...", true) &&
|
58
|
-
run(%q[comp = protein.composition], "Composition of the amino acids ...", false) &&
|
59
|
-
run(%q[pp comp], "Check the composition ...", false) &&
|
60
|
-
run(%q[puts protein.molecular_weight], "Molecular weight ...", false) &&
|
61
|
-
run(%q[midifile("data/kumamushi.mid", gene)], "Gene to music ...", false) &&
|
62
|
-
run(%q[`open "data/kumamushi.mid"`], "Let's listen ...", false) &&
|
63
|
-
true
|
64
|
-
end
|
65
|
-
|
66
|
-
def sequence
|
67
|
-
run(%q[dna = getseq("atgc" * 100)], "Generating DNA sequence ...", true) &&
|
68
|
-
run(%q[doublehelix dna], "Double helix representation", false) &&
|
69
|
-
run(%q[protein = dna.translate], "Translate DNA into Protein ...", true) &&
|
70
|
-
run(%q[protein.molecular_weight], "Calculating molecular weight ...", true) &&
|
71
|
-
run(%q[protein.composition], "Amino acid composition ...", true) &&
|
72
|
-
true
|
73
|
-
end
|
74
|
-
|
75
|
-
def entry
|
76
|
-
run(%q[kuma = getobj("gb:AF237819")], "Obtain an entry from GenBank database", false) &&
|
77
|
-
run(%q[kuma.definition], "Definition of the entry", true) &&
|
78
|
-
run(%q[kuma.naseq], "Sequence of the entry", true) &&
|
79
|
-
run(%q[kuma.naseq.translate], "Translate the sequence to protein", true) &&
|
80
|
-
run(%q[midifile("data/AF237819.mid", kuma.naseq)], "Generate gene music ...", false) &&
|
81
|
-
true
|
82
|
-
end
|
83
|
-
|
84
|
-
def shell
|
85
|
-
run(%q[pwd], "Show current working directory ...", false) &&
|
86
|
-
run(%q[dir], "Show directory contents ...", false) &&
|
87
|
-
run(%q[dir "shell/session"], "Show directory contents ...", false) &&
|
88
|
-
true
|
89
|
-
end
|
90
|
-
|
91
|
-
def pdb
|
92
|
-
run(%q[ent_1bl8 = getent("pdb:1bl8")], "Retrieving PDB entry 1BL8 ...", false) &&
|
93
|
-
run(%q[head ent_1bl8], "Head part of the entry ...", false) &&
|
94
|
-
run(%q[savefile("1bl8.pdb", ent_1bl8)], "Saving the original entry in file ...", false) &&
|
95
|
-
run(%q[disp "data/1bl8.pdb"], "Look through the entire entry ...", false) &&
|
96
|
-
run(%q[pdb_1bl8 = flatparse(ent_1bl8)], "Parsing the entry ...", false) &&
|
97
|
-
run(%q[pdb_1bl8.entry_id], "Showing the entry ID ...", true) &&
|
98
|
-
run(%q[pdb_1bl8.each_heterogen { |heterogen| p heterogen.resName }], "Showing each heterogen object ...", false) &&
|
99
|
-
true
|
100
|
-
end
|
101
|
-
|
102
|
-
def pdb_hetdic
|
103
|
-
# run(%q[het_dic = open("http://deposit.pdb.org/het_dictionary.txt").read],
|
104
|
-
# "Retrieving the het_dic database ...", false) &&
|
105
|
-
# run(%q[savefile("data/het_dictionary.txt", het_dic)],
|
106
|
-
# "Saving the file ... ", false) &&
|
107
|
-
run(%q[het_dic.size], "Bytes of the file ...", true) &&
|
108
|
-
run(%q[disp "data/het_dictionary.txt"], "Take a look on the contents ...", true) &&
|
109
|
-
run(%q[flatindex("het_dic", "data/het_dictionary.txt")],
|
110
|
-
"Creating index to make the seaarchable database ...", false) &&
|
111
|
-
run(%q[ethanol = flatsearch("het_dic", "EOH")], "Search an ethanol entry ...", true) &&
|
112
|
-
run(%q[osake = flatparse(ethanol)], "Parse the entry ...", true) &&
|
113
|
-
run(%q[osake.conect], "Showing connect table (conect) of the molecule ...", true) &&
|
114
|
-
true
|
115
|
-
end
|
116
|
-
|
117
|
-
private
|
118
|
-
|
119
|
-
def run(cmd, msg, echo)
|
120
|
-
comment(msg)
|
121
|
-
splash(cmd)
|
122
|
-
result = eval(cmd, @bind)
|
123
|
-
if echo
|
124
|
-
pp result
|
125
|
-
end
|
126
|
-
continue?
|
127
|
-
end
|
128
|
-
|
129
|
-
def comment(msg)
|
130
|
-
puts "### #{msg}"
|
131
|
-
end
|
132
|
-
|
133
|
-
def splash(msg)
|
134
|
-
Bio::Shell.splash_message_action("bioruby> #{msg}")
|
135
|
-
print "bioruby> #{msg}"
|
136
|
-
gets
|
137
|
-
end
|
138
|
-
|
139
|
-
def continue?
|
140
|
-
Bio::Shell.ask_yes_or_no("Continue? [y/n] ")
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
end
|
146
|
-
|
data/lib/bio/shell/interface.rb
DELETED
@@ -1,217 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = bio/shell/interface.rb - core user interface of the BioRuby shell
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (C) 2005
|
5
|
-
# Toshiaki Katayama <k@bioruby.org>
|
6
|
-
# License:: The Ruby License
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
module Bio::Shell
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
### work space
|
15
|
-
|
16
|
-
def ls
|
17
|
-
bind = Bio::Shell.cache[:binding]
|
18
|
-
list = eval("local_variables", bind).reject { |x|
|
19
|
-
eval(x, bind).nil?
|
20
|
-
}
|
21
|
-
puts list.inspect
|
22
|
-
return list
|
23
|
-
end
|
24
|
-
|
25
|
-
def rm(name)
|
26
|
-
bind = Bio::Shell.cache[:binding]
|
27
|
-
list = eval("local_variables", bind).reject { |x|
|
28
|
-
eval(x, bind).nil?
|
29
|
-
}
|
30
|
-
begin
|
31
|
-
if list.include?(name.to_s)
|
32
|
-
eval("#{name} = nil", bind)
|
33
|
-
else
|
34
|
-
raise
|
35
|
-
end
|
36
|
-
rescue
|
37
|
-
warn "Usage: rm :var or rm 'var' (rm var is not valid)"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
### script
|
42
|
-
|
43
|
-
def script(mode = nil)
|
44
|
-
Bio::Shell.script(mode)
|
45
|
-
end
|
46
|
-
|
47
|
-
### object
|
48
|
-
|
49
|
-
def reload_object
|
50
|
-
Bio::Shell.load_object
|
51
|
-
end
|
52
|
-
|
53
|
-
### plugin
|
54
|
-
|
55
|
-
def reload_plugin
|
56
|
-
Bio::Shell.load_plugin
|
57
|
-
end
|
58
|
-
|
59
|
-
### config
|
60
|
-
|
61
|
-
def config(mode = :show, *opts)
|
62
|
-
case mode
|
63
|
-
when :show, "show"
|
64
|
-
Bio::Shell.config_show
|
65
|
-
when :echo, "echo"
|
66
|
-
Bio::Shell.config_echo
|
67
|
-
when :color, "color"
|
68
|
-
Bio::Shell.config_color
|
69
|
-
when :splash, "splash"
|
70
|
-
Bio::Shell.config_splash
|
71
|
-
when :pager, "pager"
|
72
|
-
Bio::Shell.config_pager(*opts)
|
73
|
-
when :message, "message"
|
74
|
-
Bio::Shell.config_message(*opts)
|
75
|
-
else
|
76
|
-
puts "Invalid mode (#{mode}) - :show, :echo, :color, :splash, :massage"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def reload_config
|
81
|
-
Bio::Shell.load_config
|
82
|
-
end
|
83
|
-
|
84
|
-
### pager
|
85
|
-
|
86
|
-
def pager(cmd = nil)
|
87
|
-
unless Bio::Shell.config[:pager]
|
88
|
-
cmd ||= ENV['PAGER']
|
89
|
-
end
|
90
|
-
Bio::Shell.config_pager(cmd)
|
91
|
-
puts "Pager is set to '#{cmd ? cmd : 'off'}'"
|
92
|
-
end
|
93
|
-
|
94
|
-
def disp(*objs)
|
95
|
-
# The original idea is from http://sheepman.parfait.ne.jp/20050215.html
|
96
|
-
if cmd = Bio::Shell.config[:pager]
|
97
|
-
pg = IO.popen(cmd, "w")
|
98
|
-
begin
|
99
|
-
stdout_save = STDOUT.clone
|
100
|
-
STDOUT.reopen(pg)
|
101
|
-
objs.each do |obj|
|
102
|
-
if obj.is_a?(String)
|
103
|
-
if File.exist?(obj)
|
104
|
-
system("#{cmd} #{obj}")
|
105
|
-
else
|
106
|
-
obj.display
|
107
|
-
end
|
108
|
-
else
|
109
|
-
pp obj
|
110
|
-
end
|
111
|
-
end
|
112
|
-
ensure
|
113
|
-
STDOUT.reopen(stdout_save)
|
114
|
-
stdout_save.close
|
115
|
-
pg.close
|
116
|
-
end
|
117
|
-
else
|
118
|
-
objs.each do |obj|
|
119
|
-
if obj.is_a?(String)
|
120
|
-
obj.display
|
121
|
-
else
|
122
|
-
pp obj
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def head(arg, num = 10)
|
129
|
-
str = ""
|
130
|
-
if File.exist?(arg)
|
131
|
-
File.open(arg) do |file|
|
132
|
-
num.times do
|
133
|
-
if line = file.gets
|
134
|
-
str << line
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
else
|
139
|
-
arg.to_s.each_with_index do |line, i|
|
140
|
-
break if i >= num
|
141
|
-
str << line
|
142
|
-
end
|
143
|
-
end
|
144
|
-
puts str
|
145
|
-
return str
|
146
|
-
end
|
147
|
-
|
148
|
-
### file save
|
149
|
-
|
150
|
-
def savefile(file, *objs)
|
151
|
-
datadir = Bio::Shell.data_dir
|
152
|
-
message = "Save file '#{file}' in '#{datadir}' directory? [y/n] "
|
153
|
-
if ! file[/^#{datadir}/] and Bio::Shell.ask_yes_or_no(message)
|
154
|
-
file = File.join(datadir, file)
|
155
|
-
end
|
156
|
-
if File.exist?(file)
|
157
|
-
message = "Overwrite existing '#{file}' file? [y/n] "
|
158
|
-
if ! Bio::Shell.ask_yes_or_no(message)
|
159
|
-
puts " ... save aborted."
|
160
|
-
return
|
161
|
-
end
|
162
|
-
end
|
163
|
-
begin
|
164
|
-
print "Saving file (#{file}) ... "
|
165
|
-
File.open(file, "w") do |f|
|
166
|
-
objs.each do |obj|
|
167
|
-
f.puts obj.to_s
|
168
|
-
end
|
169
|
-
end
|
170
|
-
puts "done"
|
171
|
-
rescue
|
172
|
-
warn "Error: Failed to save (#{file}) : #{$!}"
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
### file system
|
177
|
-
|
178
|
-
def cd(dir = ENV['HOME'])
|
179
|
-
if dir
|
180
|
-
Dir.chdir(dir)
|
181
|
-
end
|
182
|
-
puts Dir.pwd.inspect
|
183
|
-
end
|
184
|
-
|
185
|
-
def pwd
|
186
|
-
puts Dir.pwd.inspect
|
187
|
-
end
|
188
|
-
|
189
|
-
def dir(file = nil)
|
190
|
-
if file
|
191
|
-
if File.directory?(file)
|
192
|
-
files = Dir.glob("#{file}/*")
|
193
|
-
else
|
194
|
-
files = Dir.glob(file)
|
195
|
-
end
|
196
|
-
else
|
197
|
-
files = Dir.glob("*")
|
198
|
-
end
|
199
|
-
if files
|
200
|
-
str = " UGO Date Byte File\n"
|
201
|
-
str << "------ ------------------------------ ----------- ------------\n"
|
202
|
-
files.sort.each { |f|
|
203
|
-
stat = File.lstat(f)
|
204
|
-
mode = format("%6o", stat.mode)
|
205
|
-
date = stat.mtime
|
206
|
-
byte = stat.size
|
207
|
-
name = f.inspect
|
208
|
-
str << format("%s %30s%13d %s\n", mode, date, byte, name)
|
209
|
-
}
|
210
|
-
puts str
|
211
|
-
return files.sort
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
|
data/lib/bio/shell/irb.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = bio/shell/irb.rb - CUI 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
|
-
module Bio::Shell
|
11
|
-
|
12
|
-
class Irb
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
require 'irb'
|
16
|
-
begin
|
17
|
-
require 'irb/completion'
|
18
|
-
Bio::Shell.cache[:readline] = true
|
19
|
-
rescue LoadError
|
20
|
-
Bio::Shell.cache[:readline] = false
|
21
|
-
end
|
22
|
-
IRB.setup(nil)
|
23
|
-
setup_irb
|
24
|
-
start_irb
|
25
|
-
end
|
26
|
-
|
27
|
-
def start_irb
|
28
|
-
Bio::Shell.cache[:irb] = IRB::Irb.new
|
29
|
-
|
30
|
-
# needed for method completion
|
31
|
-
IRB.conf[:MAIN_CONTEXT] = Bio::Shell.cache[:irb].context
|
32
|
-
|
33
|
-
# store binding for evaluation
|
34
|
-
Bio::Shell.cache[:binding] = IRB.conf[:MAIN_CONTEXT].workspace.binding
|
35
|
-
|
36
|
-
# overwrite gets to store history with time stamp
|
37
|
-
io = IRB.conf[:MAIN_CONTEXT].io
|
38
|
-
io.class.class_eval do
|
39
|
-
alias_method :irb_original_gets, :gets
|
40
|
-
end
|
41
|
-
|
42
|
-
def io.gets
|
43
|
-
line = irb_original_gets
|
44
|
-
if line
|
45
|
-
Bio::Shell.store_history(line)
|
46
|
-
end
|
47
|
-
return line
|
48
|
-
end
|
49
|
-
|
50
|
-
if File.exist?("./config/boot.rb")
|
51
|
-
require "./config/boot"
|
52
|
-
require "./config/environment"
|
53
|
-
#require 'commands/console'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def setup_irb
|
58
|
-
# set application name
|
59
|
-
IRB.conf[:AP_NAME] = 'bioruby'
|
60
|
-
|
61
|
-
# change prompt for bioruby
|
62
|
-
$_ = Bio::Shell.colors
|
63
|
-
IRB.conf[:PROMPT][:BIORUBY_COLOR] = {
|
64
|
-
:PROMPT_I => "bio#{$_[:ruby]}ruby#{$_[:none]}> ",
|
65
|
-
:PROMPT_S => "bio#{$_[:ruby]}ruby#{$_[:none]}%l ",
|
66
|
-
:PROMPT_C => "bio#{$_[:ruby]}ruby#{$_[:none]}+ ",
|
67
|
-
:RETURN => " ==> %s\n"
|
68
|
-
}
|
69
|
-
IRB.conf[:PROMPT][:BIORUBY] = {
|
70
|
-
:PROMPT_I => "bioruby> ",
|
71
|
-
:PROMPT_S => "bioruby%l ",
|
72
|
-
:PROMPT_C => "bioruby+ ",
|
73
|
-
:RETURN => " ==> %s\n"
|
74
|
-
}
|
75
|
-
if Bio::Shell.config[:color]
|
76
|
-
IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR
|
77
|
-
else
|
78
|
-
IRB.conf[:PROMPT_MODE] = :BIORUBY
|
79
|
-
end
|
80
|
-
|
81
|
-
# echo mode (uncomment to off by default)
|
82
|
-
#IRB.conf[:ECHO] = Bio::Shell.config[:echo] || false
|
83
|
-
|
84
|
-
# irb/input-method.rb >= v1.5 (not in 1.8.2)
|
85
|
-
#IRB.conf[:SAVE_HISTORY] = 100000
|
86
|
-
|
87
|
-
# not nicely works
|
88
|
-
#IRB.conf[:AUTO_INDENT] = true
|
89
|
-
end
|
90
|
-
|
91
|
-
end # Irb
|
92
|
-
|
93
|
-
end
|
94
|
-
|