vienna_rna 0.1.4 → 0.1.5
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.
- data/lib/{modules → vienna_rna/modules}/fftbor.rb +20 -2
- data/lib/{modules → vienna_rna/modules}/utils.rb +6 -3
- data/lib/{modules → vienna_rna/modules}/xbor.rb +8 -4
- data/lib/vienna_rna.rb +3 -2
- metadata +11 -11
- /data/lib/{modules → vienna_rna/modules}/base.rb +0 -0
- /data/lib/{modules → vienna_rna/modules}/batch.rb +0 -0
- /data/lib/{modules → vienna_rna/modules}/fold.rb +0 -0
- /data/lib/{modules → vienna_rna/modules}/heat.rb +0 -0
- /data/lib/{modules → vienna_rna/modules}/rnabor.rb +0 -0
- /data/lib/{modules → vienna_rna/modules}/subopt.rb +0 -0
@@ -16,11 +16,11 @@ module ViennaRna
|
|
16
16
|
STDERR.puts "ERROR: The mode requested (%s) is not available" % flags[:mode]
|
17
17
|
end
|
18
18
|
|
19
|
-
case flags
|
19
|
+
case mode = flags.delete(:mode)
|
20
20
|
when :standalone then
|
21
21
|
super(flags)
|
22
22
|
when :dispatch then
|
23
|
-
"%s -m 6 -tr 0 -s %s -ss '%s'" % [MODES[
|
23
|
+
"%s -m 6 -tr 0 -s %s -ss '%s'" % [MODES[mode], data.seq, data.safe_structure]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,6 +38,24 @@ module ViennaRna
|
|
38
38
|
self.class.parse(response).map { |row| BigDecimal.new(row[1]) }
|
39
39
|
end
|
40
40
|
|
41
|
+
def windows
|
42
|
+
# This is starting to feel pretty hackety.
|
43
|
+
response.gsub(/Sum.*\n+Window size:\s+\d+/) { |match| "[:separator:]" + match }.split("[:separator:]").map do |window_response|
|
44
|
+
window_size = window_response.match(/Window size:\s+(\d+)/)[1].to_i
|
45
|
+
window_index = window_response.match(/Window starting index:\s+(\d+)/)[1].to_i
|
46
|
+
|
47
|
+
self.class.new(seq: data.seq[window_index - 1, window_size], str: data.safe_structure[window_index - 1, window_size]).tap do |window_run|
|
48
|
+
class << window_run
|
49
|
+
attr_accessor :response, :window_size, :window_index
|
50
|
+
end
|
51
|
+
|
52
|
+
window_run.response = window_response
|
53
|
+
window_run.window_size = window_size
|
54
|
+
window_run.window_index = window_index
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
41
59
|
def compare
|
42
60
|
{
|
43
61
|
dispatch: self.class.new(data).run(mode: :dispatch).distribution,
|
@@ -56,9 +56,12 @@ module ViennaRna
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def quick_plot(title, data)
|
60
|
-
# data = [[x_0, y_0], [x_1, y_1], ...]
|
61
|
-
|
59
|
+
def quick_plot(title, data, filename = false)
|
60
|
+
# data = [[x_0, y_0], [x_1, y_1], ...]
|
61
|
+
options = { title: title }
|
62
|
+
options.merge!(output: "file", filename: filename) if filename
|
63
|
+
|
64
|
+
plot([{ x: data.map(&:first), y: data.map(&:last), style: "linespoints" }], options)
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
@@ -9,7 +9,7 @@ module ViennaRna
|
|
9
9
|
|
10
10
|
self.executable_name = -> { name.demodulize.gsub(/^([A-Z].*)bor$/) { |match| $1.upcase + "bor" } }
|
11
11
|
|
12
|
-
def run_command(flags)
|
12
|
+
def run_command(flags = {})
|
13
13
|
file = Tempfile.new("rna")
|
14
14
|
file.write("%s\n" % data.seq)
|
15
15
|
file.write("%s\n" % data.safe_structure)
|
@@ -17,7 +17,7 @@ module ViennaRna
|
|
17
17
|
|
18
18
|
"%s %s %s" % [
|
19
19
|
exec_name,
|
20
|
-
stringify_flags(BASE_FLAGS.merge(self.class.const_defined?(:FLAGS) ? self.class.const_get(:FLAGS) : {})),
|
20
|
+
stringify_flags(BASE_FLAGS.merge(self.class.const_defined?(:FLAGS) ? self.class.const_get(:FLAGS) : {}).merge(flags)),
|
21
21
|
file.path
|
22
22
|
]
|
23
23
|
end
|
@@ -28,13 +28,17 @@ module ViennaRna
|
|
28
28
|
|
29
29
|
def full_distribution
|
30
30
|
distribution = run.distribution
|
31
|
-
full_distribution = distribution + ([0] * (data.seq.length - distribution.length + 1))
|
31
|
+
full_distribution = distribution + ([0.0] * ((differnece = data.seq.length - distribution.length + 1) < 0 ? 0 : differnece))
|
32
|
+
end
|
33
|
+
|
34
|
+
def k_p_points
|
35
|
+
full_distribution.each_with_index.to_a.map(&:reverse)[0..data.seq.length]
|
32
36
|
end
|
33
37
|
|
34
38
|
def quick_plot
|
35
39
|
ViennaRna::Utils.quick_plot(
|
36
40
|
"%s\\n%s\\n%s" % [self.class.name, data.seq, data.safe_structure],
|
37
|
-
|
41
|
+
k_p_points
|
38
42
|
)
|
39
43
|
end
|
40
44
|
end
|
data/lib/vienna_rna.rb
CHANGED
@@ -6,8 +6,9 @@ require "active_support/core_ext/module/aliasing"
|
|
6
6
|
module ViennaRna
|
7
7
|
@debug = true
|
8
8
|
|
9
|
-
Dir[File.join(File.dirname(__FILE__), "
|
10
|
-
|
9
|
+
Dir[File.join(File.dirname(__FILE__), "vienna_rna", "modules", "*.rb")].each do |file|
|
10
|
+
# Doesn't support autoloading modules that are of the form: TwoWords
|
11
|
+
autoload(File.basename(file, ".rb").camelize.to_sym, "vienna_rna/modules/#{File.basename(file, '.rb')}")
|
11
12
|
end
|
12
13
|
|
13
14
|
def self.const_missing(name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vienna_rna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bio
|
@@ -49,15 +49,15 @@ executables: []
|
|
49
49
|
extensions: []
|
50
50
|
extra_rdoc_files: []
|
51
51
|
files:
|
52
|
-
- ./lib/modules/base.rb
|
53
|
-
- ./lib/modules/batch.rb
|
54
|
-
- ./lib/modules/fftbor.rb
|
55
|
-
- ./lib/modules/fold.rb
|
56
|
-
- ./lib/modules/heat.rb
|
57
|
-
- ./lib/modules/rnabor.rb
|
58
|
-
- ./lib/modules/subopt.rb
|
59
|
-
- ./lib/modules/utils.rb
|
60
|
-
- ./lib/modules/xbor.rb
|
52
|
+
- ./lib/vienna_rna/modules/base.rb
|
53
|
+
- ./lib/vienna_rna/modules/batch.rb
|
54
|
+
- ./lib/vienna_rna/modules/fftbor.rb
|
55
|
+
- ./lib/vienna_rna/modules/fold.rb
|
56
|
+
- ./lib/vienna_rna/modules/heat.rb
|
57
|
+
- ./lib/vienna_rna/modules/rnabor.rb
|
58
|
+
- ./lib/vienna_rna/modules/subopt.rb
|
59
|
+
- ./lib/vienna_rna/modules/utils.rb
|
60
|
+
- ./lib/vienna_rna/modules/xbor.rb
|
61
61
|
- ./lib/vienna_rna.rb
|
62
62
|
homepage: http://rubygems.org/gems/vienna_rna
|
63
63
|
licenses: []
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|