bioinform 0.2.0 → 0.2.1
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 +4 -4
- data/TODO.txt +5 -1
- data/lib/bioinform/background.rb +8 -3
- data/lib/bioinform/parsers/motif_splitter.rb +1 -1
- data/lib/bioinform/version.rb +1 -1
- data/lib/bioinform.rb +0 -61
- data/spec/parsers/motif_splitter_spec.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e322a8657abaa2fb242f0b7774dfc3b38a1e83
|
4
|
+
data.tar.gz: 65e5cdc14dec4d99cb0266d8d4bf589ef44efb99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a503972ed0e5ec8f9aba819230991d9ef33704ff587e47a6b310b98f3429aa580245499b13e17f59d5023213764887cf8bf92834aed28717746acbd8a2c6ad
|
7
|
+
data.tar.gz: bce479c347c8f439c6e133e14f1379b75ed855b26553059c85f2e04a04344f3c2885b44f35ac146128ecb75054b35d0267801509f21719afecc922be999b5639
|
data/TODO.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
PCM2PWM не имеет возможности вычислить псевдокаунт для матриц с разными каунтами в столбцах. Может быть брать логарифм и корень максимума. Или конкретной колонки?
|
2
|
+
|
1
3
|
сделать работу с ValidationError
|
2
4
|
сделать ошибки тэгированными
|
3
5
|
обобщить модели фона на разные алфавиты
|
@@ -28,4 +30,6 @@ Decide:
|
|
28
30
|
-- Whether to cache suffices: cache :best_suffix, obsolete: [:discrete!, :background!, ...]
|
29
31
|
|
30
32
|
Specs
|
31
|
-
-- PWM#probabilities, #score_variance, #gauss_estimation
|
33
|
+
-- PWM#probabilities, #score_variance, #gauss_estimation
|
34
|
+
|
35
|
+
background#to_s and WordwiseBackground#to_s
|
data/lib/bioinform/background.rb
CHANGED
@@ -11,9 +11,14 @@ module Bioinform
|
|
11
11
|
Bioinform::Background::Uniform
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.from_frequencies(frequencies)
|
15
|
+
Frequencies.new(frequencies)
|
16
|
+
end
|
17
|
+
|
14
18
|
def self.from_gc_content(gc_content)
|
15
|
-
|
16
|
-
|
19
|
+
raise Error, 'GC-content should be withing range [0;1]' unless (0..1).include?(gc_content)
|
20
|
+
p_at = (1.0 - gc_content) / 2.0
|
21
|
+
p_cg = gc_content / 2.0
|
17
22
|
Frequencies.new([p_at, p_cg, p_cg, p_at])
|
18
23
|
end
|
19
24
|
|
@@ -79,7 +84,7 @@ module Bioinform
|
|
79
84
|
end
|
80
85
|
|
81
86
|
def to_s
|
82
|
-
|
87
|
+
'wordwise'
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
@@ -17,7 +17,7 @@ module Bioinform
|
|
17
17
|
# and by lines which will be retained.
|
18
18
|
#
|
19
19
|
class MotifSplitter
|
20
|
-
attr_reader :start_motif_pattern, :
|
20
|
+
attr_reader :start_motif_pattern, :splitter_pattern
|
21
21
|
|
22
22
|
def initialize(options={})
|
23
23
|
@start_motif_pattern = options.fetch(:start_motif_pattern, /^\s*([^-+\s\d.]+|>.*)/)
|
data/lib/bioinform/version.rb
CHANGED
data/lib/bioinform.rb
CHANGED
@@ -11,65 +11,4 @@ require_relative 'bioinform/background'
|
|
11
11
|
require_relative 'bioinform/alphabet'
|
12
12
|
|
13
13
|
module Bioinform
|
14
|
-
def self.get_model(data_model, matrix, name)
|
15
|
-
Bioinform::MotifModel.const_get(data_model).new(matrix).named(name)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.get_model_from_string(data_model, matrix_string)
|
19
|
-
motif_infos = MatrixParser.new.parse(matrix_string)
|
20
|
-
get_model(data_model, motif_infos.matrix, name)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.get_pwm(data_model, matrix, background, pseudocount, effective_count)
|
24
|
-
input_model = get_model_from_string(data_model, matrix)
|
25
|
-
case input_model
|
26
|
-
when MotifModel::PPM
|
27
|
-
ppm2pcm_converter = ConversionAlgorithms::PPM2PCM.new(count: effective_count)
|
28
|
-
pcm2pwm_converter = ConversionAlgorithms::PCM2PWM.new(background: background, pseudocount: pseudocount)
|
29
|
-
pcm2pwm_converter.convert(ppm2pcm_converter.convert(input_model))
|
30
|
-
when MotifModel::PCM
|
31
|
-
pcm2pwm_converter = ConversionAlgorithms::PCM2PWM.new(background: background, pseudocount: pseudocount)
|
32
|
-
pcm2pwm_converter.convert(input_model)
|
33
|
-
when MotifModel::PWM
|
34
|
-
input_model
|
35
|
-
else
|
36
|
-
raise Error, "Unknown input `#{input_model}`"
|
37
|
-
end
|
38
|
-
rescue => e
|
39
|
-
raise Error, "PWM creation failed (#{e})"
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.get_pcm(data_model, matrix, effective_count)
|
43
|
-
input_model = get_model_from_string(data_model, matrix)
|
44
|
-
case input_model
|
45
|
-
when MotifModel::PPM
|
46
|
-
ppm2pcm_converter = ConversionAlgorithms::PPM2PCM.new(count: effective_count)
|
47
|
-
ppm2pcm_converter.convert(input_model)
|
48
|
-
when MotifModel::PCM
|
49
|
-
input_model
|
50
|
-
when MotifModel::PWM
|
51
|
-
raise Error, 'Conversion PWM-->PCM not yet implemented'
|
52
|
-
else
|
53
|
-
raise Error, "Unknown input `#{input_model}`"
|
54
|
-
end
|
55
|
-
rescue => e
|
56
|
-
raise Error, "PCM creation failed (#{e})"
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.get_ppm(data_model, matrix)
|
60
|
-
input_model = get_model_from_string(data_model, matrix)
|
61
|
-
case input_model
|
62
|
-
when MotifModel::PPM
|
63
|
-
input_model
|
64
|
-
when MotifModel::PCM
|
65
|
-
pcm2ppm_converter = ConversionAlgorithms::PCM2PPM.new
|
66
|
-
pcm2ppm_converter.convert(input_model)
|
67
|
-
when MotifModel::PWM
|
68
|
-
raise Error, 'Conversion PWM-->PPM not yet implemented'
|
69
|
-
else
|
70
|
-
raise Error, "Unknown input `#{input_model}`"
|
71
|
-
end
|
72
|
-
rescue => e
|
73
|
-
raise Error, "PPM creation failed (#{e})"
|
74
|
-
end
|
75
14
|
end
|
@@ -30,6 +30,8 @@ describe Bioinform::MotifSplitter do
|
|
30
30
|
|
31
31
|
context 'with specified pattern' do
|
32
32
|
let(:motif_splitter) { Bioinform::MotifSplitter.new(start_motif_pattern: /^NA\s+\w+$/, splitter_pattern: /^\/\/\s$/) }
|
33
|
+
specify{ expect(motif_splitter.splitter_pattern).to eq(/^\/\/\s$/) }
|
34
|
+
specify{ expect(motif_splitter.start_motif_pattern).to eq(/^NA\s+\w+$/) }
|
33
35
|
|
34
36
|
let(:input_1) {
|
35
37
|
"NA motif_1\n" +
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Vorontsov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A bunch of useful classes for bioinformatics
|
14
14
|
email:
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.4.1
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Classes for work with different input formats of positional matrices and
|