bioinform 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 64c5e6fe652d85bd538d08020e5d06779e676fa7
4
- data.tar.gz: 954a02afb784d086d006e59e97f57400a10f7858
2
+ SHA256:
3
+ metadata.gz: 815bb48e1022dbcf03e50fd8fe9ea2aebde5af49982a6dd724dd8076b6f8feb2
4
+ data.tar.gz: 2763d993767d26629452e4b1249005ac9a1fd2a2e7ea2144bad6fb64c1f4db01
5
5
  SHA512:
6
- metadata.gz: f3e549ad3b7b20a45ba37dc90c25660af7f1a455cf358aced90991570b76070da5688872141a32e54590a6cd0e65622fe2010b9b27b34466886b15f5a6b7856e
7
- data.tar.gz: 81e3dba3f91e3f4acc6838efe5e197da2712f070a4962e3d29bd0df81a0834eb513542ecfcbaca62802cd32fdaa90e883c356d1a008abde9715e5183e52501ee
6
+ metadata.gz: f2c27432312380b2595e42560e9edcf37d78790a06f8f4ebd4524e464fc2a2a50856b1c81935d921b8e240d1c914d737acb3baabdbf24f37cb84c77e991c2084
7
+ data.tar.gz: c6d1a75d09883d8cef6c1cec3a1aa2df635b02bcc86b7dea3d633e32f69649e3a0a324e0edde779c0dd30e541a4ea7017d74b30e16491e0b0d1c437c77adfd7f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bioinform (0.3.0)
4
+ bioinform (0.3.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -81,4 +81,4 @@ DEPENDENCIES
81
81
  wdm
82
82
 
83
83
  BUNDLED WITH
84
- 1.11.2
84
+ 2.2.33
@@ -16,8 +16,8 @@ module Bioinform
16
16
 
17
17
  private :motif_klasses, :motif?
18
18
 
19
- def method_missing(meth, *args, &block)
20
- result = model.public_send(meth, *args, &block)
19
+ def method_missing(meth, *args, **kwargs, &block)
20
+ result = model.public_send(meth, *args, **kwargs, &block)
21
21
  if motif?(result) && ! result.is_a?(self.class)
22
22
  self.class.new(result, name)
23
23
  else
@@ -29,7 +29,12 @@ module Bioinform
29
29
  VALIDATOR = PM::VALIDATOR * PCM.count_validator(eps: 1.0e-4).make_strict
30
30
  DIFFERENT_COUNTS_VALIDATOR = PM::VALIDATOR * PCM.count_validator(eps: nil).make_strict
31
31
 
32
- def initialize(matrix, alphabet: NucleotideAlphabet, validator: PCM::VALIDATOR)
32
+
33
+ def self.default_validator
34
+ PCM::VALIDATOR
35
+ end
36
+
37
+ def initialize(matrix, alphabet: NucleotideAlphabet, validator: default_validator)
33
38
  super
34
39
  # validator already checked count discrepancy. We store median count.
35
40
  @count = matrix.map{|pos| pos.inject(0.0, &:+) }.sort[matrix.length / 2]
@@ -20,7 +20,7 @@ module Bioinform
20
20
  }
21
21
 
22
22
  attr_reader :matrix, :alphabet
23
- def initialize(matrix, alphabet: NucleotideAlphabet, validator: PM::VALIDATOR)
23
+ def initialize(matrix, alphabet: NucleotideAlphabet, validator: default_validator)
24
24
  validation_results = validator.validate_params(matrix, alphabet)
25
25
  unless validation_results.valid?
26
26
  raise ValidationError.new('Invalid matrix.', validation_errors: validation_results)
@@ -29,15 +29,23 @@ module Bioinform
29
29
  @alphabet = alphabet
30
30
  end
31
31
 
32
- def self.from_string(input, alphabet: NucleotideAlphabet, parser: DEFAULT_PARSER)
32
+ def self.default_validator
33
+ PM::VALIDATOR
34
+ end
35
+
36
+ def default_validator
37
+ self.class.default_validator
38
+ end
39
+
40
+ def self.from_string(input, alphabet: NucleotideAlphabet, parser: DEFAULT_PARSER, validator: default_validator)
33
41
  info = parser.parse!(input)
34
- self.new(info[:matrix], alphabet: alphabet).named( info[:name] )
42
+ self.new(info[:matrix], alphabet: alphabet, validator: validator).named( info[:name] )
35
43
  end
36
44
 
37
- def self.from_file(filename, alphabet: NucleotideAlphabet, parser: DEFAULT_PARSER)
45
+ def self.from_file(filename, alphabet: NucleotideAlphabet, parser: DEFAULT_PARSER, validator: default_validator)
38
46
  info = parser.parse!(File.read(filename))
39
47
  name = (info[:name] && !info[:name].strip.empty?) ? info[:name] : File.basename(filename, File.extname(filename))
40
- self.new(info[:matrix], alphabet: alphabet).named( name )
48
+ self.new(info[:matrix], alphabet: alphabet, validator: validator).named( name )
41
49
  end
42
50
 
43
51
  def length
@@ -7,6 +7,10 @@ module Bioinform
7
7
  end
8
8
 
9
9
  class PPM < PM
10
+ def self.default_validator
11
+ PPM::VALIDATOR
12
+ end
13
+
10
14
  def self.probability_validator(eps: 1.0e-4)
11
15
  Validator.new{|matrix, alphabet|
12
16
  errors = []
@@ -26,10 +30,6 @@ module Bioinform
26
30
  end
27
31
 
28
32
  VALIDATOR = PM::VALIDATOR * PPM.probability_validator(eps: 1.0e-4).make_strict
29
-
30
- def initialize(matrix, alphabet: NucleotideAlphabet, validator: PPM::VALIDATOR)
31
- super # default validator redefined
32
- end
33
33
  end
34
34
  end
35
35
  end
@@ -8,8 +8,9 @@ module Bioinform
8
8
 
9
9
  class PWM < PM
10
10
  VALIDATOR = PM::VALIDATOR
11
- def initialize(matrix, alphabet: NucleotideAlphabet, validator: PWM::VALIDATOR)
12
- super # default validator redefined
11
+
12
+ def self.default_validator
13
+ PWM::VALIDATOR
13
14
  end
14
15
 
15
16
  def score(word)
@@ -1,3 +1,3 @@
1
1
  module Bioinform
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bioinform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Vorontsov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2026-01-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A bunch of useful classes for bioinformatics
14
14
  email:
@@ -106,7 +106,7 @@ files:
106
106
  homepage: ''
107
107
  licenses: []
108
108
  metadata: {}
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.5.1
126
- signing_key:
124
+ rubygems_version: 3.2.33
125
+ signing_key:
127
126
  specification_version: 4
128
127
  summary: Classes for work with different input formats of positional matrices and
129
128
  IUPAC-words and making simple transform and statistics with them. Also module includes