bio 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +136 -0
- data/KNOWN_ISSUES.rdoc +0 -8
- data/RELEASE_NOTES.rdoc +26 -0
- data/bioruby.gemspec +2 -1
- data/lib/bio/appl/iprscan/report.rb +3 -3
- data/lib/bio/appl/sosui/report.rb +1 -1
- data/lib/bio/db/embl/uniprotkb.rb +1 -1
- data/lib/bio/db/go.rb +2 -2
- data/lib/bio/sequence/common.rb +112 -0
- data/lib/bio/tree.rb +1 -1
- data/lib/bio/version.rb +1 -1
- data/test/unit/bio/sequence/test_ruby3.rb +462 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 990d6888c3a4e53089aaf8332c4bc87bb9cc40efe25e1aa13b7337be69145227
|
4
|
+
data.tar.gz: 361fad495b8f8ee3528a6729b8a52a3522a6d594353679a6a84993e97e1e8f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c72d6055da72526d208e85b42ad75b150b4538b62c2552323e5f344721b9fe0ed3b18adf5e9d570f9d34fba019379fc6528a329a1340962f5a9c6c279e458c
|
7
|
+
data.tar.gz: f8894738bbb973722b77f65559f56b2ec661619e9f2dfe060456d63523fb921d4697d619171a8998686d234ac6bb5f3a300cbd140c8a78f8083b36029b536825
|
data/ChangeLog
CHANGED
@@ -1,3 +1,139 @@
|
|
1
|
+
commit c16e230d15cf30478a3739563b4e4745dc57ef82
|
2
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
3
|
+
Date: Fri Nov 5 23:44:45 2021 +0900
|
4
|
+
|
5
|
+
regenerate bioruby.gemspec with rake regemspec
|
6
|
+
|
7
|
+
bioruby.gemspec | 3 ++-
|
8
|
+
1 file changed, 2 insertions(+), 1 deletion(-)
|
9
|
+
|
10
|
+
commit 1a8c44dc5b8d24342550273a594e5f75e41f41df
|
11
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
12
|
+
Date: Fri Nov 5 23:41:29 2021 +0900
|
13
|
+
|
14
|
+
prepare for BioRuby 2.0.3 release
|
15
|
+
|
16
|
+
lib/bio/version.rb | 2 +-
|
17
|
+
1 file changed, 1 insertion(+), 1 deletion(-)
|
18
|
+
|
19
|
+
commit 863242cdb9a748ba9efb3be3b39f92c17ed3ea84
|
20
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
21
|
+
Date: Fri Nov 5 23:36:27 2021 +0900
|
22
|
+
|
23
|
+
update release notes for upcoming BioRuby 2.0.3
|
24
|
+
|
25
|
+
RELEASE_NOTES.rdoc | 26 ++++++++++++++++++++++++++
|
26
|
+
1 file changed, 26 insertions(+)
|
27
|
+
|
28
|
+
commit b97794d632c73dc45639cec000fb11238740eb30
|
29
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
30
|
+
Date: Fri Nov 5 23:26:20 2021 +0900
|
31
|
+
|
32
|
+
Ruby 3.0 compatibility fix: Bio::Sequence::*#partition, #rpartiton
|
33
|
+
|
34
|
+
* Behaviors of Bio::Sequence::*#partition and #rpartition in Ruby 3.0
|
35
|
+
are changed to mimic those in Ruby 2.x.
|
36
|
+
|
37
|
+
lib/bio/sequence/common.rb | 17 +++++++
|
38
|
+
test/unit/bio/sequence/test_ruby3.rb | 94 ++++++++++++++++++++++++++++++++++++
|
39
|
+
2 files changed, 111 insertions(+)
|
40
|
+
|
41
|
+
commit 7ff79cd449ee03e0063120fb9abec50d9b08e979
|
42
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
43
|
+
Date: Fri Nov 5 22:24:16 2021 +0900
|
44
|
+
|
45
|
+
remove resolved Ruby 3.0 issue
|
46
|
+
|
47
|
+
KNOWN_ISSUES.rdoc | 8 --------
|
48
|
+
1 file changed, 8 deletions(-)
|
49
|
+
|
50
|
+
commit 24bb3c3cf417837ad63a27913db7237aef1414c6
|
51
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
52
|
+
Date: Fri Nov 5 21:24:26 2021 +0900
|
53
|
+
|
54
|
+
Bio::Sequence::NA,AA,Generic: workaround for Ruby 3.0.0 incompatible change
|
55
|
+
|
56
|
+
* Since Ruby 3.0.0, over 30 methods in subclass of String class are
|
57
|
+
changed to return/yield String instance instead of the subclass
|
58
|
+
instance. (https://github.com/ruby/ruby/blob/v3_0_0/NEWS.md )
|
59
|
+
|
60
|
+
* In this commit, workaround is made for the following methods:
|
61
|
+
* *
|
62
|
+
* capitalize
|
63
|
+
* center
|
64
|
+
* chomp
|
65
|
+
* chop
|
66
|
+
* delete
|
67
|
+
* delete_prefix
|
68
|
+
* delete_suffix
|
69
|
+
* downcase
|
70
|
+
* each_char
|
71
|
+
* each_grapheme_cluster
|
72
|
+
* each_line
|
73
|
+
* gsub
|
74
|
+
* gsub!
|
75
|
+
* ljust
|
76
|
+
* lstrip
|
77
|
+
* revserse
|
78
|
+
* rjust
|
79
|
+
* rstrip
|
80
|
+
* slice!
|
81
|
+
* slice / []
|
82
|
+
* split
|
83
|
+
* squeeze
|
84
|
+
* strip
|
85
|
+
* sub
|
86
|
+
* sub!
|
87
|
+
* succ / next
|
88
|
+
* swapcase
|
89
|
+
* tr
|
90
|
+
* tr_s
|
91
|
+
* upcase
|
92
|
+
* Note: sub! and gsub! are not described in the NEWS.md
|
93
|
+
but are also affected by this Ruby 3.0.0 incompatible changes.
|
94
|
+
|
95
|
+
* The following methods are not patched i.e. they return/yield
|
96
|
+
String instances.
|
97
|
+
* dump
|
98
|
+
* partition
|
99
|
+
* rpartition
|
100
|
+
* scrub
|
101
|
+
* Note: In Ruby 2.7 or earlier, Bio::Sequence::NA#partition
|
102
|
+
and #rpartition methods return an array that may contain
|
103
|
+
mixture of Bio::Sequence::NA instances and String instances.
|
104
|
+
|
105
|
+
* test/unit/bio/sequence/test_ruby3.rb: unit tests for the
|
106
|
+
above methods.
|
107
|
+
|
108
|
+
* Close https://github.com/bioruby/bioruby/issues/137
|
109
|
+
|
110
|
+
lib/bio/sequence/common.rb | 95 +++++++++
|
111
|
+
test/unit/bio/sequence/test_ruby3.rb | 368 +++++++++++++++++++++++++++++++++++
|
112
|
+
2 files changed, 463 insertions(+)
|
113
|
+
create mode 100644 test/unit/bio/sequence/test_ruby3.rb
|
114
|
+
|
115
|
+
commit 0efc0a54685d43645daa9c53d7140bfb81577777
|
116
|
+
Author: kojix2 <2xijok@gmail.com>
|
117
|
+
Date: Tue Aug 31 19:39:25 2021 +0900
|
118
|
+
|
119
|
+
Fix typos: Retrun -> Return
|
120
|
+
|
121
|
+
lib/bio/appl/iprscan/report.rb | 6 +++---
|
122
|
+
lib/bio/appl/sosui/report.rb | 2 +-
|
123
|
+
lib/bio/db/embl/uniprotkb.rb | 2 +-
|
124
|
+
lib/bio/db/go.rb | 4 ++--
|
125
|
+
lib/bio/tree.rb | 2 +-
|
126
|
+
5 files changed, 8 insertions(+), 8 deletions(-)
|
127
|
+
|
128
|
+
commit a291b5a72da12a5cc8b006d1dd63d002fda5dff3
|
129
|
+
Author: Naohisa Goto <ng@bioruby.org>
|
130
|
+
Date: Thu Dec 31 23:52:54 2020 +0900
|
131
|
+
|
132
|
+
BioRuby 2.0.2 is released
|
133
|
+
|
134
|
+
ChangeLog | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
135
|
+
1 file changed, 98 insertions(+)
|
136
|
+
|
1
137
|
commit fd420b713ca364e677ef3551919ec907791df86d
|
2
138
|
Author: Naohisa Goto <ng@bioruby.org>
|
3
139
|
Date: Thu Dec 31 23:51:08 2020 +0900
|
data/KNOWN_ISSUES.rdoc
CHANGED
@@ -12,14 +12,6 @@ they are not BioRuby's issues and/or it is very difficult to fix them.
|
|
12
12
|
|
13
13
|
== 1. Ruby version specific issues
|
14
14
|
|
15
|
-
==== Ruby 3.0
|
16
|
-
|
17
|
-
Since Ruby 3.0, internal inplementation of String methods are changed and
|
18
|
-
methods in a subclass of String return String instead of the subclass
|
19
|
-
instance. Bio::Sequence::NA, AA, and Generic inherit String and are severely
|
20
|
-
affected by this change.
|
21
|
-
See GitHub issue https://github.com/bioruby/bioruby/issues/137 .
|
22
|
-
|
23
15
|
==== String encodings
|
24
16
|
|
25
17
|
Currently, BioRuby do not care string encodings. In some cases,
|
data/RELEASE_NOTES.rdoc
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
= BioRuby 2.0.3 RELEASE NOTES
|
2
|
+
|
3
|
+
Some bug fixes have been made in BioRuby 2.0.3 after the release of 2.0.2.
|
4
|
+
|
5
|
+
== Bug fixes
|
6
|
+
|
7
|
+
* Fix Ruby 3.0.0 Bio::Sequence::* issue.
|
8
|
+
(https://github.com/bioruby/bioruby/issues/137 )
|
9
|
+
* Fix typo (https://github.com/bioruby/bioruby/pull/145 )
|
10
|
+
|
11
|
+
== Incompatible changes
|
12
|
+
|
13
|
+
=== Bio::Sequence::* incompatible changes since Ruby 3.0.0
|
14
|
+
|
15
|
+
Since Ruby 3.0.0, the following methods in Bio::Sequence::NA,
|
16
|
+
Bio::Sequence::AA, and Bio::Sequence::Generic return or yield
|
17
|
+
String instance, instead of the Bio::Sequence::* instance.
|
18
|
+
|
19
|
+
* dump
|
20
|
+
* scrub
|
21
|
+
|
22
|
+
For details about Ruby 3.0.0 incompatible changes, see
|
23
|
+
{News for Ruby 3.0.0}[https://github.com/ruby/ruby/blob/v3_0_0/NEWS.md].
|
24
|
+
|
25
|
+
|
26
|
+
|
1
27
|
= BioRuby 2.0.2 RELEASE NOTES
|
2
28
|
|
3
29
|
Some bugs fixes have been made in BioRuby 2.0.2 after the release of 2.0.1.
|
data/bioruby.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'bio'
|
6
|
-
s.version = "2.0.
|
6
|
+
s.version = "2.0.3"
|
7
7
|
|
8
8
|
s.author = "BioRuby project"
|
9
9
|
s.email = "staff@bioruby.org"
|
@@ -546,6 +546,7 @@ Gem::Specification.new do |s|
|
|
546
546
|
"test/unit/bio/sequence/test_dblink.rb",
|
547
547
|
"test/unit/bio/sequence/test_na.rb",
|
548
548
|
"test/unit/bio/sequence/test_quality_score.rb",
|
549
|
+
"test/unit/bio/sequence/test_ruby3.rb",
|
549
550
|
"test/unit/bio/sequence/test_sequence_masker.rb",
|
550
551
|
"test/unit/bio/test_alignment.rb",
|
551
552
|
"test/unit/bio/test_command.rb",
|
@@ -83,7 +83,7 @@ module Bio
|
|
83
83
|
yield Bio::Iprscan::Report.parse_raw_entry(entry) if entry != ''
|
84
84
|
end
|
85
85
|
|
86
|
-
# Parser method for a raw formated entry.
|
86
|
+
# Parser method for a raw formated entry. Returns a Bio::Iprscan::Report
|
87
87
|
# object.
|
88
88
|
def self.parse_raw_entry(str)
|
89
89
|
report = self.new
|
@@ -113,7 +113,7 @@ module Bio
|
|
113
113
|
|
114
114
|
|
115
115
|
|
116
|
-
# Parser method for a xml formated entry.
|
116
|
+
# Parser method for a xml formated entry. Returns a Bio::Iprscan::Report
|
117
117
|
# object.
|
118
118
|
# def self.parse_xml(str)
|
119
119
|
# end
|
@@ -196,7 +196,7 @@ module Bio
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
# Parser method for a pseudo-txt formated entry.
|
199
|
+
# Parser method for a pseudo-txt formated entry. Returns a Bio::Iprscan::Report
|
200
200
|
# object.
|
201
201
|
#
|
202
202
|
# == Usage
|
@@ -174,7 +174,7 @@ class UniProtKB < EMBLDB
|
|
174
174
|
#
|
175
175
|
# http://www.uniprot.org/docs/sp_news.htm
|
176
176
|
def parse_DE_line_rel14(str)
|
177
|
-
#
|
177
|
+
# Returns if it is not the new format since Rel.14
|
178
178
|
return nil unless /^DE (RecName|AltName|SubName)\: / =~ str
|
179
179
|
ret = []
|
180
180
|
cur = nil
|
data/lib/bio/db/go.rb
CHANGED
@@ -193,7 +193,7 @@ class GO
|
|
193
193
|
# Delimiter
|
194
194
|
RS = DELIMITER
|
195
195
|
|
196
|
-
#
|
196
|
+
# Returns an Array of parsed gene_association flatfile.
|
197
197
|
# Block is acceptable.
|
198
198
|
def self.parser(str)
|
199
199
|
if block_given?
|
@@ -226,7 +226,7 @@ class GO
|
|
226
226
|
# Returns Db_Reference variable.
|
227
227
|
attr_reader :db_reference # -> []
|
228
228
|
|
229
|
-
#
|
229
|
+
# Returns Evidence code variable.
|
230
230
|
attr_reader :evidence
|
231
231
|
|
232
232
|
# Returns the entry is associated with this value.
|
data/lib/bio/sequence/common.rb
CHANGED
@@ -303,6 +303,118 @@ module Common
|
|
303
303
|
end
|
304
304
|
alias splicing splice
|
305
305
|
|
306
|
+
#--
|
307
|
+
# Workaround for Ruby 3.0.0 incompatible changes
|
308
|
+
if ::RUBY_VERSION > "3"
|
309
|
+
|
310
|
+
# Acts almost the same as String#split.
|
311
|
+
def split(*arg)
|
312
|
+
if block_given?
|
313
|
+
super
|
314
|
+
else
|
315
|
+
ret = super(*arg)
|
316
|
+
ret.collect! { |x| self.class.new('').replace(x) }
|
317
|
+
ret
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
%w( * ljust rjust center ).each do |w|
|
322
|
+
module_eval %Q{
|
323
|
+
def #{w}(*arg)
|
324
|
+
self.class.new('').replace(super)
|
325
|
+
end
|
326
|
+
}
|
327
|
+
end
|
328
|
+
|
329
|
+
%w( chomp chop
|
330
|
+
delete delete_prefix delete_suffix
|
331
|
+
lstrip rstrip strip
|
332
|
+
reverse
|
333
|
+
squeeze
|
334
|
+
succ next
|
335
|
+
tr tr_s
|
336
|
+
capitalize upcase downcase swapcase
|
337
|
+
).each do |w|
|
338
|
+
module_eval %Q{
|
339
|
+
def #{w}(*arg)
|
340
|
+
s = self.dup
|
341
|
+
s.#{w}!(*arg)
|
342
|
+
s
|
343
|
+
end
|
344
|
+
}
|
345
|
+
end
|
346
|
+
|
347
|
+
%w( sub gsub ).each do |w|
|
348
|
+
module_eval %Q{
|
349
|
+
def #{w}(*arg, &block)
|
350
|
+
s = self.dup
|
351
|
+
s.#{w}!(*arg, &block)
|
352
|
+
s
|
353
|
+
end
|
354
|
+
}
|
355
|
+
end
|
356
|
+
|
357
|
+
#Reference: https://nacl-ltd.github.io/2018/11/08/gsub-wrapper.html
|
358
|
+
#(Title: Is it possible to implement gsub wrapper?)
|
359
|
+
%w( sub! gsub! ).each do |w|
|
360
|
+
module_eval %Q{
|
361
|
+
def #{w}(*arg, &block)
|
362
|
+
if block_given? then
|
363
|
+
super(*arg) do |m|
|
364
|
+
b = Thread.current[:_backref]
|
365
|
+
Thread.current[:_backref] = ::Regexp.last_match
|
366
|
+
block.binding.eval("$~ = Thread.current[:_backref]")
|
367
|
+
Thread.current[:_backref] = b
|
368
|
+
block.call(self.class.new('').replace(m))
|
369
|
+
end
|
370
|
+
else
|
371
|
+
super
|
372
|
+
end
|
373
|
+
end
|
374
|
+
}
|
375
|
+
end
|
376
|
+
|
377
|
+
%w( each_char each_grapheme_cluster each_line ).each do |w|
|
378
|
+
module_eval %Q{
|
379
|
+
def #{w}
|
380
|
+
if block_given?
|
381
|
+
super { |c| yield(self.class.new('').replace(c)) }
|
382
|
+
else
|
383
|
+
enum_for(:#{w})
|
384
|
+
end
|
385
|
+
end
|
386
|
+
}
|
387
|
+
end
|
388
|
+
|
389
|
+
%w( slice [] slice! ).each do |w|
|
390
|
+
module_eval %Q{
|
391
|
+
def #{w}(*arg)
|
392
|
+
r = super
|
393
|
+
r ? self.class.new('').replace(r) : r
|
394
|
+
end
|
395
|
+
}
|
396
|
+
end
|
397
|
+
|
398
|
+
%w( partition rpartition ).each do |w|
|
399
|
+
module_eval %Q{
|
400
|
+
def #{w}(sep)
|
401
|
+
r = super
|
402
|
+
if r.kind_of?(Array)
|
403
|
+
r[1] == sep ?
|
404
|
+
[ self.class.new('').replace(r[0]),
|
405
|
+
r[1],
|
406
|
+
self.class.new('').replace(r[2]) ] :
|
407
|
+
r.collect { |x| self.class.new('').replace(x) }
|
408
|
+
else
|
409
|
+
r
|
410
|
+
end
|
411
|
+
end
|
412
|
+
}
|
413
|
+
end
|
414
|
+
#++
|
415
|
+
|
416
|
+
end # if ::RUBY_VERSION > "3"
|
417
|
+
|
306
418
|
end # Common
|
307
419
|
|
308
420
|
end # Sequence
|
data/lib/bio/tree.rb
CHANGED
@@ -605,7 +605,7 @@ module Bio
|
|
605
605
|
end
|
606
606
|
|
607
607
|
# Gets path from node1 to node2.
|
608
|
-
#
|
608
|
+
# Returns an array of nodes, including node1 and node2.
|
609
609
|
# If node1 and/or node2 do not exist, IndexError is raised.
|
610
610
|
# If node1 and node2 are not connected, NoPathError is raised.
|
611
611
|
# The result is unspecified for cyclic trees.
|
data/lib/bio/version.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
module Bio
|
11
11
|
|
12
12
|
# BioRuby version (Array containing Integer)
|
13
|
-
BIORUBY_VERSION = [2, 0,
|
13
|
+
BIORUBY_VERSION = [2, 0, 3].extend(Comparable).freeze
|
14
14
|
|
15
15
|
# Extra version specifier (String or nil).
|
16
16
|
# Existance of the value indicates development version.
|
@@ -0,0 +1,462 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/sequence/test_ruby3.rb - Unit test for Bio::Sequencce::Common with Ruby version 3
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2021 BioRuby Project
|
5
|
+
# Maintainter:: Naohisa Goto <ng@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
|
9
|
+
# loading helper routine for testing bioruby
|
10
|
+
require 'pathname'
|
11
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
|
12
|
+
'bioruby_test_helper.rb')).cleanpath.to_s
|
13
|
+
|
14
|
+
# libraries needed for the tests
|
15
|
+
require 'test/unit'
|
16
|
+
require 'bio/sequence'
|
17
|
+
require 'bio/sequence/common'
|
18
|
+
|
19
|
+
module Bio; module TestSequenceRuby3
|
20
|
+
|
21
|
+
class TSeq < String
|
22
|
+
include Bio::Sequence::Common
|
23
|
+
end
|
24
|
+
|
25
|
+
class TestSequenceCommon < Test::Unit::TestCase
|
26
|
+
|
27
|
+
def test_multiply
|
28
|
+
str = 'atgc'.freeze
|
29
|
+
obj = TSeq.new(str)
|
30
|
+
val = obj * 3
|
31
|
+
assert_instance_of(TSeq, val)
|
32
|
+
assert_equal(TSeq.new(str * 3), val)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_chomp
|
36
|
+
[ "atgc\n".freeze, "atgc".freeze ].each do |str|
|
37
|
+
obj = TSeq.new(str)
|
38
|
+
val = obj.chomp
|
39
|
+
assert_instance_of(TSeq, val)
|
40
|
+
assert_equal(TSeq.new(str.chomp), val)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_chop
|
45
|
+
[ "atgc\n".freeze, "atgc".freeze ].each do |str|
|
46
|
+
obj = TSeq.new(str)
|
47
|
+
val = obj.chop
|
48
|
+
assert_instance_of(TSeq, val)
|
49
|
+
assert_equal(TSeq.new(str.chop), val)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_delete
|
54
|
+
str = "atgggc".freeze
|
55
|
+
obj = TSeq.new(str)
|
56
|
+
val = obj.delete("g")
|
57
|
+
assert_instance_of(TSeq, val)
|
58
|
+
assert_equal(TSeq.new("atc"), val)
|
59
|
+
end
|
60
|
+
|
61
|
+
if "string".respond_to?(:delete_prefix)
|
62
|
+
def test_delete_prefix
|
63
|
+
str = "atgggc".freeze
|
64
|
+
obj = TSeq.new(str)
|
65
|
+
val = obj.delete_prefix("atg")
|
66
|
+
assert_instance_of(TSeq, val)
|
67
|
+
assert_equal(TSeq.new("ggc"), val)
|
68
|
+
end
|
69
|
+
end #if "string".respond_to?(:delete_prefix)
|
70
|
+
|
71
|
+
|
72
|
+
if "string".respond_to?(:delete_suffix)
|
73
|
+
def test_delete_suffix
|
74
|
+
str = "atgggc".freeze
|
75
|
+
obj = TSeq.new(str)
|
76
|
+
val = obj.delete_suffix("ggc")
|
77
|
+
assert_instance_of(TSeq, val)
|
78
|
+
assert_equal(TSeq.new("atg"), val)
|
79
|
+
end
|
80
|
+
end #if "string".respond_to?(:delete_suffix)
|
81
|
+
|
82
|
+
def test_each_char
|
83
|
+
str = 'atgc'.freeze
|
84
|
+
ary = str.split(//)
|
85
|
+
obj = TSeq.new(str)
|
86
|
+
obj.each_char do |c|
|
87
|
+
assert_instance_of(TSeq, c)
|
88
|
+
assert_equal(TSeq.new(ary.shift), c)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_each_char_enum
|
93
|
+
str = 'atgc'.freeze
|
94
|
+
ary = str.split(//).collect { |c| TSeq.new(c) }
|
95
|
+
obj = TSeq.new(str)
|
96
|
+
e = obj.each_char
|
97
|
+
to_a = e.to_a
|
98
|
+
to_a.each { |c| assert_instance_of(TSeq, c) }
|
99
|
+
assert_equal(ary, to_a)
|
100
|
+
end
|
101
|
+
|
102
|
+
if "string".respond_to?(:each_grapheme_cluster)
|
103
|
+
def test_each_grapheme_cluster
|
104
|
+
str = 'atgc'.freeze
|
105
|
+
ary = str.split(//)
|
106
|
+
obj = TSeq.new(str)
|
107
|
+
obj.each_grapheme_cluster do |c|
|
108
|
+
assert_instance_of(TSeq, c)
|
109
|
+
assert_equal(TSeq.new(ary.shift), c)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_each_grapheme_cluster_enum
|
114
|
+
str = 'atgc'.freeze
|
115
|
+
ary = str.split(//).collect { |c| TSeq.new(c) }
|
116
|
+
obj = TSeq.new(str)
|
117
|
+
e = obj.each_grapheme_cluster
|
118
|
+
to_a = e.to_a
|
119
|
+
to_a.each { |c| assert_instance_of(TSeq, c) }
|
120
|
+
assert_equal(ary, to_a)
|
121
|
+
end
|
122
|
+
end #if "string".respond_to?(:each_grapheme_cluster)
|
123
|
+
|
124
|
+
def test_each_line
|
125
|
+
str = "aagtcgt\nttgctagc\nggtacagt\n".freeze
|
126
|
+
ary = str.each_line.to_a
|
127
|
+
obj = TSeq.new(str)
|
128
|
+
obj.each_line do |c|
|
129
|
+
assert_instance_of(TSeq, c)
|
130
|
+
assert_equal(TSeq.new(ary.shift), c)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_each_line_enum
|
135
|
+
str = "aagtcgt\nttgctagc\nggtacagt\n".freeze
|
136
|
+
ary = str.each_line.collect { |x| TSeq.new(x) }
|
137
|
+
obj = TSeq.new(str)
|
138
|
+
e = obj.each_line
|
139
|
+
to_a = e.to_a
|
140
|
+
to_a.each { |x| assert_instance_of(TSeq, x) }
|
141
|
+
assert_equal(ary, to_a)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_gsub
|
145
|
+
str = "aagtcgtaacaaggt".freeze
|
146
|
+
str2 = str.gsub(/aa/, "bb")
|
147
|
+
obj = TSeq.new(str)
|
148
|
+
val = obj.gsub(/aa/, "bb")
|
149
|
+
assert_instance_of(TSeq, val)
|
150
|
+
assert_equal(TSeq.new(str2), val)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_sub
|
154
|
+
str = "aagtcgtaacaaggt".freeze
|
155
|
+
str2 = str.sub(/aa/, "bb")
|
156
|
+
obj = TSeq.new(str)
|
157
|
+
val = obj.sub(/aa/, "bb")
|
158
|
+
assert_instance_of(TSeq, val)
|
159
|
+
assert_equal(TSeq.new(str2), val)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_gsub_with_block
|
163
|
+
str = "aagtcgtaacaaggtaagt".freeze
|
164
|
+
str2 = str.gsub(/a(ag)/) { |x| "bb" }
|
165
|
+
obj = TSeq.new(str)
|
166
|
+
val = obj.gsub(/a(ag)/) do |x|
|
167
|
+
assert_equal("ag", $1)
|
168
|
+
assert_equal("aag", $&)
|
169
|
+
assert_equal(TSeq.new("aag"), x)
|
170
|
+
assert_instance_of(MatchData, Regexp.last_match)
|
171
|
+
assert_instance_of(TSeq, x)
|
172
|
+
"bb"
|
173
|
+
end
|
174
|
+
assert_instance_of(TSeq, val)
|
175
|
+
assert_equal(TSeq.new(str2), val)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_sub_with_block
|
179
|
+
str = "aagtcgtaacaaggtaagt".freeze
|
180
|
+
str2 = str.sub(/a(ag)/) { |x| "bb" }
|
181
|
+
obj = TSeq.new(str)
|
182
|
+
val = obj.sub(/a(ag)/) do |x|
|
183
|
+
assert_equal("ag", $1)
|
184
|
+
assert_equal("aag", $&)
|
185
|
+
assert_equal(TSeq.new("aag"), x)
|
186
|
+
assert_instance_of(MatchData, Regexp.last_match)
|
187
|
+
assert_instance_of(TSeq, x)
|
188
|
+
"bb"
|
189
|
+
end
|
190
|
+
assert_instance_of(TSeq, val)
|
191
|
+
assert_equal(TSeq.new(str2), val)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_ljust
|
195
|
+
str = "atgc".freeze
|
196
|
+
str2 = str.ljust(20, "xyz")
|
197
|
+
obj = TSeq.new(str)
|
198
|
+
val = obj.ljust(20, "xyz")
|
199
|
+
assert_instance_of(TSeq, val)
|
200
|
+
assert_equal(TSeq.new(str2), val)
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_rjust
|
204
|
+
str = "atgc".freeze
|
205
|
+
str2 = str.rjust(20, "xyz")
|
206
|
+
obj = TSeq.new(str)
|
207
|
+
val = obj.rjust(20, "xyz")
|
208
|
+
assert_instance_of(TSeq, val)
|
209
|
+
assert_equal(TSeq.new(str2), val)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_center
|
213
|
+
str = "atgc".freeze
|
214
|
+
str2 = str.center(20, "xyz")
|
215
|
+
obj = TSeq.new(str)
|
216
|
+
val = obj.center(20, "xyz")
|
217
|
+
assert_instance_of(TSeq, val)
|
218
|
+
assert_equal(TSeq.new(str2), val)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_strip
|
222
|
+
str = " at gc\n".freeze
|
223
|
+
str2 = str.strip
|
224
|
+
obj = TSeq.new(str)
|
225
|
+
val = obj.strip
|
226
|
+
assert_instance_of(TSeq, val)
|
227
|
+
assert_equal(TSeq.new(str2), val)
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_lstrip
|
231
|
+
str = " at gc\n".freeze
|
232
|
+
str2 = str.lstrip
|
233
|
+
obj = TSeq.new(str)
|
234
|
+
val = obj.lstrip
|
235
|
+
assert_instance_of(TSeq, val)
|
236
|
+
assert_equal(TSeq.new(str2), val)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_rstrip
|
240
|
+
str = " at gc\n".freeze
|
241
|
+
str2 = str.rstrip
|
242
|
+
obj = TSeq.new(str)
|
243
|
+
val = obj.rstrip
|
244
|
+
assert_instance_of(TSeq, val)
|
245
|
+
assert_equal(TSeq.new(str2), val)
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_split
|
249
|
+
str = "aagtcgta".freeze
|
250
|
+
ary = str.split("gt").collect { |x| TSeq.new(x) }
|
251
|
+
obj = TSeq.new(str)
|
252
|
+
val = obj.split("gt")
|
253
|
+
val.each do |x|
|
254
|
+
assert_instance_of(TSeq, x)
|
255
|
+
end
|
256
|
+
assert_equal(ary, val)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_reverse
|
260
|
+
str = "aagtttcca".freeze
|
261
|
+
str2 = str.reverse
|
262
|
+
obj = TSeq.new(str)
|
263
|
+
val = obj.reverse
|
264
|
+
assert_instance_of(TSeq, val)
|
265
|
+
assert_equal(TSeq.new(str2), val)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_squeeze
|
269
|
+
str = "aagtttcca".freeze
|
270
|
+
str2 = str.squeeze
|
271
|
+
obj = TSeq.new(str)
|
272
|
+
val = obj.squeeze
|
273
|
+
assert_instance_of(TSeq, val)
|
274
|
+
assert_equal(TSeq.new(str2), val)
|
275
|
+
end
|
276
|
+
|
277
|
+
def test_succ
|
278
|
+
str = "aagt".freeze
|
279
|
+
str2 = str.succ
|
280
|
+
obj = TSeq.new(str)
|
281
|
+
val = obj.succ
|
282
|
+
assert_instance_of(TSeq, val)
|
283
|
+
assert_equal(TSeq.new(str2), val)
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_next
|
287
|
+
str = "aagt".freeze
|
288
|
+
str2 = str.next
|
289
|
+
obj = TSeq.new(str)
|
290
|
+
val = obj.next
|
291
|
+
assert_instance_of(TSeq, val)
|
292
|
+
assert_equal(TSeq.new(str2), val)
|
293
|
+
end
|
294
|
+
|
295
|
+
def test_capitalize
|
296
|
+
str = "aacgt".freeze
|
297
|
+
str2 = str.capitalize
|
298
|
+
obj = TSeq.new(str)
|
299
|
+
val = obj.capitalize
|
300
|
+
assert_instance_of(TSeq, val)
|
301
|
+
assert_equal(TSeq.new(str2), val)
|
302
|
+
end
|
303
|
+
|
304
|
+
def test_upcase
|
305
|
+
str = "aacgt".freeze
|
306
|
+
str2 = str.upcase
|
307
|
+
obj = TSeq.new(str)
|
308
|
+
val = obj.upcase
|
309
|
+
assert_instance_of(TSeq, val)
|
310
|
+
assert_equal(TSeq.new(str2), val)
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_downcase
|
314
|
+
str = "AACGT".freeze
|
315
|
+
str2 = str.downcase
|
316
|
+
obj = TSeq.new(str)
|
317
|
+
val = obj.downcase
|
318
|
+
assert_instance_of(TSeq, val)
|
319
|
+
assert_equal(TSeq.new(str2), val)
|
320
|
+
end
|
321
|
+
|
322
|
+
def test_swapcase
|
323
|
+
str = "AaCgT".freeze
|
324
|
+
str2 = str.swapcase
|
325
|
+
obj = TSeq.new(str)
|
326
|
+
val = obj.swapcase
|
327
|
+
assert_instance_of(TSeq, val)
|
328
|
+
assert_equal(TSeq.new(str2), val)
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_tr
|
332
|
+
str = "acggt".freeze
|
333
|
+
str2 = str.tr("cg", "xy")
|
334
|
+
obj = TSeq.new(str)
|
335
|
+
val = obj.tr("cg", "xy")
|
336
|
+
assert_instance_of(TSeq, val)
|
337
|
+
assert_equal(TSeq.new(str2), val)
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_tr_s
|
341
|
+
str = "acggt".freeze
|
342
|
+
str2 = str.tr("cg", "n")
|
343
|
+
obj = TSeq.new(str)
|
344
|
+
val = obj.tr("cg", "n")
|
345
|
+
assert_instance_of(TSeq, val)
|
346
|
+
assert_equal(TSeq.new(str2), val)
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_slice
|
350
|
+
str = "aagtcgta".freeze
|
351
|
+
str2 = str.slice(3, 3)
|
352
|
+
obj = TSeq.new(str)
|
353
|
+
val = obj.slice(3, 3)
|
354
|
+
assert_instance_of(TSeq, val)
|
355
|
+
assert_equal(TSeq.new(str2), val)
|
356
|
+
end
|
357
|
+
|
358
|
+
def test_slice2
|
359
|
+
str = "aagtcgta".freeze
|
360
|
+
str2 = str[3, 3]
|
361
|
+
obj = TSeq.new(str)
|
362
|
+
val = obj[3, 3]
|
363
|
+
assert_instance_of(TSeq, val)
|
364
|
+
assert_equal(TSeq.new(str2), val)
|
365
|
+
end
|
366
|
+
end #class TestSequenceCommon
|
367
|
+
|
368
|
+
|
369
|
+
class TestSequenceCommonPartition < Test::Unit::TestCase
|
370
|
+
def test_partition
|
371
|
+
str = "atgatgagttctattcatc".freeze
|
372
|
+
sep = "ttc".freeze
|
373
|
+
a0 = str.partition(sep)
|
374
|
+
a1 = [ TSeq.new(a0[0]), a0[1], TSeq.new(a0[2]) ]
|
375
|
+
obj = TSeq.new(str)
|
376
|
+
val = obj.partition(sep)
|
377
|
+
assert_instance_of(TSeq, val[0])
|
378
|
+
assert_instance_of(String, val[1])
|
379
|
+
assert_instance_of(TSeq, val[2])
|
380
|
+
assert_equal(a1, val)
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_partition_sep_TSeq
|
384
|
+
str = "atgatgagttctattcatc".freeze
|
385
|
+
sep = TSeq.new("ttc").freeze
|
386
|
+
a0 = str.partition(sep)
|
387
|
+
a1 = [ TSeq.new(a0[0]), a0[1], TSeq.new(a0[2]) ]
|
388
|
+
obj = TSeq.new(str)
|
389
|
+
val = obj.partition(sep)
|
390
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
391
|
+
assert_equal(a1, val)
|
392
|
+
end
|
393
|
+
|
394
|
+
def test_partition_sep_regexp
|
395
|
+
str = "atgatgagttctattcatc".freeze
|
396
|
+
sep = /ttc/
|
397
|
+
a1 = str.partition(sep).collect { |x| TSeq.new(x) }
|
398
|
+
obj = TSeq.new(str)
|
399
|
+
val = obj.partition(sep)
|
400
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
401
|
+
assert_equal(a1, val)
|
402
|
+
end
|
403
|
+
|
404
|
+
def test_partition_nomatch
|
405
|
+
str = "atgatgagttctattcatc".freeze
|
406
|
+
sep = "x".freeze
|
407
|
+
a1 = str.partition(sep).collect { |x| TSeq.new(x) }
|
408
|
+
obj = TSeq.new(str)
|
409
|
+
val = obj.partition(sep)
|
410
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
411
|
+
assert_equal(a1, val)
|
412
|
+
end
|
413
|
+
end #class TestSequenceCommonPartition
|
414
|
+
|
415
|
+
|
416
|
+
class TestSequenceCommonRpartition < Test::Unit::TestCase
|
417
|
+
def test_rpartition
|
418
|
+
str = "atgatgagttctattcatc".freeze
|
419
|
+
sep = "ttc".freeze
|
420
|
+
a0 = str.rpartition(sep)
|
421
|
+
a1 = [ TSeq.new(a0[0]), a0[1], TSeq.new(a0[2]) ]
|
422
|
+
obj = TSeq.new(str)
|
423
|
+
val = obj.rpartition(sep)
|
424
|
+
assert_instance_of(TSeq, val[0])
|
425
|
+
assert_instance_of(String, val[1])
|
426
|
+
assert_instance_of(TSeq, val[2])
|
427
|
+
assert_equal(a1, val)
|
428
|
+
end
|
429
|
+
|
430
|
+
def test_rpartition_sep_TSeq
|
431
|
+
str = "atgatgagttctattcatc".freeze
|
432
|
+
sep = TSeq.new("ttc").freeze
|
433
|
+
a0 = str.rpartition(sep)
|
434
|
+
a1 = [ TSeq.new(a0[0]), a0[1], TSeq.new(a0[2]) ]
|
435
|
+
obj = TSeq.new(str)
|
436
|
+
val = obj.rpartition(sep)
|
437
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
438
|
+
assert_equal(a1, val)
|
439
|
+
end
|
440
|
+
|
441
|
+
def test_rpartition_sep_regexp
|
442
|
+
str = "atgatgagttctattcatc".freeze
|
443
|
+
sep = /ttc/
|
444
|
+
a1 = str.rpartition(sep).collect { |x| TSeq.new(x) }
|
445
|
+
obj = TSeq.new(str)
|
446
|
+
val = obj.rpartition(sep)
|
447
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
448
|
+
assert_equal(a1, val)
|
449
|
+
end
|
450
|
+
|
451
|
+
def test_rpartition_nomatch
|
452
|
+
str = "atgatgagttctattcatc".freeze
|
453
|
+
sep = "x".freeze
|
454
|
+
a1 = str.rpartition(sep).collect { |x| TSeq.new(x) }
|
455
|
+
obj = TSeq.new(str)
|
456
|
+
val = obj.rpartition(sep)
|
457
|
+
val.each { |x| assert_instance_of(TSeq, x) }
|
458
|
+
assert_equal(a1, val)
|
459
|
+
end
|
460
|
+
end #class TestSequenceCommonRpartition
|
461
|
+
|
462
|
+
end; end #module Bio; module TestSequenceRuby3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BioRuby project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: BioRuby is a library for bioinformatics (biology + information science).
|
14
14
|
email: staff@bioruby.org
|
@@ -557,6 +557,7 @@ files:
|
|
557
557
|
- test/unit/bio/sequence/test_dblink.rb
|
558
558
|
- test/unit/bio/sequence/test_na.rb
|
559
559
|
- test/unit/bio/sequence/test_quality_score.rb
|
560
|
+
- test/unit/bio/sequence/test_ruby3.rb
|
560
561
|
- test/unit/bio/sequence/test_sequence_masker.rb
|
561
562
|
- test/unit/bio/test_alignment.rb
|
562
563
|
- test/unit/bio/test_command.rb
|
@@ -616,8 +617,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
616
617
|
- !ruby/object:Gem::Version
|
617
618
|
version: '0'
|
618
619
|
requirements: []
|
619
|
-
|
620
|
-
rubygems_version: 2.7.6.2
|
620
|
+
rubygems_version: 3.1.6
|
621
621
|
signing_key:
|
622
622
|
specification_version: 4
|
623
623
|
summary: Bioinformatics library
|