vienna_rna 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,28 @@ require "bigdecimal"
3
3
 
4
4
  module ViennaRna
5
5
  class Fftbor < Xbor
6
+ MODES = {
7
+ dispatch: "TripletPF",
8
+ standalone: "Fftbor"
9
+ }
10
+
11
+ def run_command(flags = {})
12
+ flags = { mode: :dispatch }.merge(flags)
13
+
14
+ ap flags
15
+
16
+ unless MODES[flags[:mode]]
17
+ STDERR.puts "ERROR: The mode requested (%s) is not available" % flags[:mode]
18
+ end
19
+
20
+ case flags[:mode]
21
+ when :standalone then
22
+ super(flags)
23
+ when :dispatch then
24
+ "./%s -m 6 -tr 0 -s %s -ss '%s'" % [MODES[flags[:mode]], data.seq, data.safe_structure]
25
+ end
26
+ end
27
+
6
28
  def partition
7
29
  response.split(/\n/).find { |line| line =~ /^Scaling factor.*:\s+(\d+\.\d+)/ }
8
30
  BigDecimal.new($1)
@@ -12,7 +12,7 @@ module ViennaRna
12
12
  end
13
13
 
14
14
  def counts
15
- (non_zero_counts = self.class.parse(response).map { |row| row[2].to_i }) + [0] * (data.seq.length - non_zero_counts.length + 1)
15
+ (non_zero_counts = self.class.parse(response).map { |row| BigDecimal.new(row[2]).to_i }) + [0] * (data.seq.length - non_zero_counts.length + 1)
16
16
  end
17
17
 
18
18
  def distribution(options = {})
data/lib/modules/xbor.rb CHANGED
@@ -15,7 +15,7 @@ module ViennaRna
15
15
  end
16
16
 
17
17
  def self.parse(response)
18
- response.split(/\n/).select { |line| line =~ /^\d+\t\d+/ }.map { |line| line.split(/\t/) }
18
+ response.split(/\n/).select { |line| line =~ /^\d+\t-?\d+/ }.map { |line| line.split(/\t/) }
19
19
  end
20
20
  end
21
21
  end
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.1
4
+ version: 0.1.2
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-06-26 00:00:00.000000000 Z
12
+ date: 2012-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bio