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,68 +0,0 @@
1
- #
2
- # = bio/shell/plugin/ncbirest.rb - plugin for NCBI eUtils
3
- #
4
- # Copyright:: Copyright (C) 2009
5
- # Naohisa Goto <ng@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id:$
9
- #
10
-
11
- module Bio::Shell
12
-
13
- private
14
-
15
- # NCBI eUtils EFetch service.
16
- #
17
- # With 1 argument, it gets sequence(s) by using
18
- # Bio::NCBI::REST::EFetch.sequence.
19
- # Nucleotide or protein database is automatically selected for each id.
20
- #
21
- # Example:
22
- # efetch('AF237819')
23
- #
24
- # With two or more arguments, and when the 2nd argument is Symbol,
25
- # it calls the corresponding Bio::NCBI::REST::EFetch class method.
26
- #
27
- # Example:
28
- # efetch('13054692', :pubmed)
29
- # # the same as Bio::NCBI::REST::EFetch.pubmed('13054692')
30
- #
31
- # Otherwise, it acts the same as Bio::NCBI::REST.efetch.
32
- def efetch(ids, *arg)
33
- if arg.empty? then
34
- ret = Bio::NCBI::REST::EFetch.nucleotide(ids)
35
- unless /^LOCUS / =~ ret.to_s then
36
- ret = Bio::NCBI::REST::EFetch.protein(ids)
37
- end
38
- ret
39
- elsif arg[0].kind_of?(Symbol)
40
- meth = arg[0]
41
- case meth.to_s
42
- when /\A(journal|omim|pmc|pubmed|sequence|taxonomy)\z/
43
- Bio::NCBI::REST::EFetch.__send__(meth, ids, *(arg[1..-1]))
44
- else
45
- nil
46
- end
47
- else
48
- Bio::NCBI::REST.efetch(ids, *arg)
49
- end
50
- end
51
-
52
- # NCBI eUtils EInfo
53
- def einfo
54
- Bio::NCBI::REST.einfo
55
- end
56
-
57
- # NCBI eUtils ESearch
58
- def esearch(str, *arg)
59
- Bio::NCBI::REST.esearch(str, *arg)
60
- end
61
-
62
- # Same as Bio::NCBI::REST.esearch_count
63
- def esearch_count(str, *arg)
64
- Bio::NCBI::REST.esearch_count(str, *arg)
65
- end
66
-
67
- end
68
-
@@ -1,45 +0,0 @@
1
- #
2
- # = bio/shell/plugin/obda.rb - plugin for OBDA
3
- #
4
- # Copyright:: Copyright (C) 2005
5
- # Toshiaki Katayama <k@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id: obda.rb,v 1.10 2007/04/05 23:45:11 trevor Exp $
9
- #
10
-
11
- module Bio::Shell
12
-
13
- private
14
-
15
- def obda
16
- @obda ||= Bio::Registry.new
17
- end
18
-
19
- def obdaentry(dbname, entry_id)
20
- db = obda.get_database(dbname)
21
- unless db
22
- warn "Error: No such database (#{dbname})"
23
- return
24
- end
25
- entry = db.get_by_id(entry_id)
26
- if block_given?
27
- yield entry
28
- else
29
- return entry
30
- end
31
- end
32
-
33
- def obdadbs
34
- result = obda.databases.map {|db| db.database}
35
- return result
36
- end
37
-
38
- def biofetch(db, id, style = 'raw', format = 'default')
39
- serv = Bio::Fetch.new("http://www.ebi.ac.uk/cgi-bin/dbfetch")
40
- result = serv.fetch(db, id, style, format)
41
- return result
42
- end
43
-
44
- end
45
-
@@ -1,56 +0,0 @@
1
- #
2
- # = bio/shell/plugin/psort.rb - plugin for PSORT
3
- #
4
- # Copyright:: Copyright (C) 2006
5
- # Toshiaki Katayama <k@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id: psort.rb,v 1.3 2007/04/05 23:35:41 trevor Exp $
9
- #
10
-
11
- module Bio::Shell
12
-
13
- private
14
-
15
- def psort1(str)
16
- seq = getseq(str)
17
- if seq.is_a?(Bio::Sequence::NA)
18
- seq = seq.translate
19
- end
20
-
21
- psort = Bio::PSORT::PSORT1.imsut
22
- fasta = seq.to_fasta
23
-
24
- results = psort.exec(fasta).final_result
25
- results.each do |result|
26
- puts "#{result["certainty"].to_f*100.0}\t#{result["prediction"]}"
27
- end
28
- return results.first["prediction"]
29
- end
30
-
31
- def psort2(str)
32
- seq = getseq(str)
33
- if seq.is_a?(Bio::Sequence::NA)
34
- seq = seq.translate
35
- end
36
-
37
- psort = Bio::PSORT::PSORT2.imsut
38
- fasta = seq.to_fasta
39
-
40
- results = psort.exec(fasta).prob.sort_by{|x, y| y}.reverse
41
- results.each do |loc, prob|
42
- next if prob <= 0.0
43
- puts "#{prob}\t#{Bio::PSORT::PSORT2::SclNames[loc]}"
44
- end
45
- return results.first.first
46
- end
47
-
48
- def psort2locations
49
- names = Bio::PSORT::PSORT2::SclNames
50
- names.sort.each do |loc, desc|
51
- puts "#{loc}\t#{desc}"
52
- end
53
- return names
54
- end
55
- end
56
-
@@ -1,248 +0,0 @@
1
- #
2
- # = bio/shell/plugin/seq.rb - plugin for biological sequence manipulations
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
- # Convert sequence to colored HTML string
15
- def htmlseq(str)
16
- if str.kind_of?(Bio::Sequence)
17
- seq = str
18
- else
19
- seq = getseq(str)
20
- end
21
-
22
- if seq.is_a?(Bio::Sequence::AA)
23
- scheme = Bio::ColorScheme::Taylor
24
- else
25
- scheme = Bio::ColorScheme::Nucleotide
26
- end
27
-
28
- html = %Q[<div style="font-family:monospace;">\n]
29
- seq.fold(50).each_byte do |c|
30
- case c.chr
31
- when "\n"
32
- html += "<br>\n"
33
- else
34
- color = scheme[c.chr]
35
- html += %Q[<span style="background:\##{color};">#{c.chr}</span>\n]
36
- end
37
- end
38
- html += "</div>\n"
39
- return html
40
- end
41
-
42
-
43
- def sixtrans(str)
44
- seq = getseq(str)
45
- [ 1, 2, 3, -1, -2, -3 ].each do |frame|
46
- title = "Translation #{frame.to_s.rjust(2)}"
47
- puts seq.translate(frame).to_fasta(title, 60)
48
- end
49
- end
50
-
51
-
52
- # Displays some basic properties of the sequence.
53
- def seqstat(str)
54
- max = 150
55
- seq = getseq(str)
56
- rep = "\n* * * Sequence statistics * * *\n\n"
57
- if seq.moltype == Bio::Sequence::NA
58
- fwd = seq
59
- rev = seq.complement
60
- if seq.length > max
61
- dot = " ..."
62
- fwd = fwd.subseq(1, max)
63
- rev = rev.subseq(1, max)
64
- end
65
- rep << "5'->3' sequence : #{fwd.fold(70,20).strip}#{dot}\n"
66
- rep << "3'->5' sequence : #{rev.fold(70,20).strip}#{dot}\n"
67
- [ 1, 2, 3, -1, -2, -3 ].each do |frame|
68
- pep = seq.subseq(1, max+2).translate(frame).fold(70,20).strip
69
- rep << "Translation #{frame.to_s.rjust(2)} : #{pep}#{dot}\n"
70
- end
71
- rep << "Length : #{seq.length} bp\n"
72
- rep << "GC percent : #{seq.gc_percent} %\n"
73
-
74
- ary = []
75
- seq.composition.sort.each do |base, num|
76
- percent = format("%.2f", 100.0 * num / seq.length).rjust(6)
77
- count = num.to_s.rjust(seq.length.to_s.length)
78
- ary << " #{base} - #{count} (#{percent} %)\n"
79
- end
80
- rep << "Composition : #{ary.join.strip}\n"
81
-
82
- rep << "Codon usage :\n"
83
- hash = Hash.new("0.0%")
84
- seq.codon_usage.sort.each do |codon, num|
85
- percent = format("%.1f%%", 100.0 * num / (seq.length / 3))
86
- hash[codon] = percent
87
- end
88
- rep << codontable(1, hash).output
89
-
90
- begin
91
- rep << "Molecular weight : #{seq.molecular_weight}\n"
92
- rescue
93
- rep << "Molecular weight : #{$!}\n"
94
- end
95
- begin
96
- rep << "Protein weight : #{seq.translate.chomp('*').molecular_weight}\n"
97
- rescue
98
- rep << "Protein weight : #{$!}\n"
99
- end
100
- else
101
- pep = seq
102
- if seq.length > max
103
- dot = " ..."
104
- pep = seq.subseq(1, max)
105
- end
106
- rep << "N->C sequence : #{pep.fold(70,20).strip}#{dot}\n"
107
- rep << "Length : #{seq.length} aa\n"
108
-
109
- names = Bio::AminoAcid.names
110
- ary = []
111
- seq.composition.sort.each do |aa, num|
112
- percent = format("%.2f", 100.0 * num / seq.length).rjust(6)
113
- count = num.to_s.rjust(seq.length.to_s.length)
114
- code = names[aa]
115
- name = names[names[aa]]
116
- ary << " #{aa} #{code} - #{count} (#{percent} %) #{name}\n"
117
- end
118
- rep << "Composition : #{ary.join.strip}\n"
119
-
120
- begin
121
- rep << "Protein weight : #{seq.molecular_weight}\n"
122
- rescue
123
- rep << "Protein weight : #{$!}\n"
124
- end
125
- end
126
- rep << "//\n"
127
- puts rep
128
- return rep
129
- end
130
-
131
- # Displays a DNA sequence by ascii art in B-type double helix.
132
- # Argument need to be at least 16 bases in length.
133
- def doublehelix(str)
134
- seq = getseq(str)
135
- if seq.length < 16
136
- warn "Error: Sequence must be longer than 16 bases."
137
- return
138
- end
139
- if seq.moltype != Bio::Sequence::NA
140
- warn "Error: Sequence must be a DNA sequence."
141
- return
142
- end
143
- pairs = [ [5, 0], [4, 2], [3, 3], [2, 4],
144
- [1, 4], [0, 3], [0, 2], [1, 0] ]
145
- seq.window_search(16, 16) do |subseq|
146
- pairs.each_with_index do |ij, x|
147
- base = subseq[x, 1]
148
- puts ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n"
149
- end
150
- pairs.reverse.each_with_index do |ij, x|
151
- base = subseq[x + 8, 1]
152
- puts ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n"
153
- end
154
- end
155
- end
156
-
157
- end
158
-
159
-
160
- class String
161
-
162
- def step(window_size)
163
- j = 0
164
- 0.step(self.length - window_size, window_size) do |i|
165
- yield self[i, window_size]
166
- j = i
167
- end
168
- yield self[j + window_size .. -1] if j + window_size < self.length
169
- end
170
-
171
- def skip(window_size, step_size = 1)
172
- j = 0
173
- 0.step(self.length - window_size, step_size) do |i|
174
- yield [self[i, window_size], i + 1, i + window_size]
175
- j = i
176
- end
177
- from = j + step_size
178
- to = [self.length, j + step_size + window_size].min
179
- yield [self[from, window_size], from + 1, to] if from + 1 <= to
180
- end
181
-
182
- def to_naseq
183
- Bio::Sequence::NA.new(self)
184
- end
185
-
186
- def to_aaseq
187
- Bio::Sequence::AA.new(self)
188
- end
189
-
190
- # folding both line end justified
191
- def fold(fill_column = 72, indent = 0)
192
- str = ''
193
-
194
- # size : allowed length of the actual text
195
- unless (size = fill_column - indent) > 0
196
- warn "Error: indent > fill_column (indent is set to 0)"
197
- size = fill_column
198
- indent = 0
199
- end
200
-
201
- 0.step(self.length - 1, size) do |n|
202
- str << ' ' * indent + self[n, size] + "\n"
203
- end
204
-
205
- return str
206
- end
207
-
208
- # folding with conscious about word boundaries with prefix string
209
- def fill(fill_column = 80, indent = 0, separater = ' ', prefix = '', first_line_only = true)
210
-
211
- # size : allowed length of the actual text
212
- unless (size = fill_column - indent) > 0
213
- warn "Error: indent > fill_column (indent is set to 0)"
214
- size = fill_column
215
- indent = 0
216
- end
217
-
218
- n = pos = 0
219
- ary = []
220
- while n < self.length
221
- pos = self[n, size].rindex(separater)
222
-
223
- if self[n, size].length < size # last line of the folded str
224
- pos = nil
225
- end
226
-
227
- if pos
228
- ary << self[n, pos+separater.length]
229
- n += pos + separater.length
230
- else # line too long or the last line
231
- ary << self[n, size]
232
- n += size
233
- end
234
- end
235
- str = ary.join("\n")
236
-
237
- str[0,0] = prefix + ' ' * (indent - prefix.length)
238
- if first_line_only
239
- head = ' ' * indent
240
- else
241
- head = prefix + ' ' * (indent - prefix.length)
242
- end
243
- str.gsub!("\n", "\n#{head}")
244
-
245
- return str.chomp
246
- end
247
- end
248
-
@@ -1,40 +0,0 @@
1
- #
2
- # = bio/shell/plugin/togows.rb - plugin for TogoWS REST service
3
- #
4
- # Copyright:: Copyright (C) 2009
5
- # Naohisa Goto <ng@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id:$
9
- #
10
-
11
- module Bio::Shell
12
-
13
- private
14
-
15
- # Shortcut method to fetch entry(entries) by using TogoWS REST "entry"
16
- # service. Multiple databases may be used.
17
- #
18
- def togows(ids, *arg)
19
- Bio::TogoWS::REST.retrieve(ids, *arg)
20
- end
21
-
22
- # Fetches entry(entries) by using TogoWS REST "entry" service.
23
- # Same as Bio::TogoWS::REST.entry(database, ids, *arg).
24
- def togowsentry(database, ids, *arg)
25
- Bio::TogoWS::REST.entry(database, ids, *arg)
26
- end
27
-
28
- # Database search by using TogoWS REST "search" service.
29
- # Same as Bio::TogoWS::REST.search(database, term, *arg).
30
- def togowssearch(database, term, *arg)
31
- Bio::TogoWS::REST.search(database, term, *arg)
32
- end
33
-
34
- # Data format conversion by using TogoWS REST "convert" service.
35
- # Same as Bio::TogoWS::REST.convert(data, format_from, format_to).
36
- def togowsconvert(data, format_from, format_to)
37
- Bio::TogoWS::REST.convert(data, format_from, format_to)
38
- end
39
-
40
- end