vienna_rna 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b931c7540df1fe667e698d358ad5f362bb9099c
4
- data.tar.gz: dcf9b4f4f050e4ca03f152385f663d8e6add6d66
3
+ metadata.gz: 16cb73b2fcfe880d27bc3754363cb986f12b9e93
4
+ data.tar.gz: a18ea5d222722e5512e8d46b3ecdb4a837c44bf8
5
5
  SHA512:
6
- metadata.gz: 7ba749544f0b4b8443beb65f3b97b02d2021d0a0d319e95e050924316bc3537fd8a3a61e5d3f396e4c20a70eda94654fc6b5d6b27e32c8529b1fa7365782d021
7
- data.tar.gz: fec7d1ad0a7407c70f73d1ea1dc3f38e66e6e6e0f6ee21574e4d0b6d53f80544aea175444b47a75d1d59ed0eb298411589789b17d2e7f7136dc797670845f232
6
+ metadata.gz: 1e33cfffbe0538c3e6c887a8b18f65f9e74c2f26d1aa0255ffd079710770df8c4118804f9183969568cde1f65a703563a501cf899e136e312bc58e4bc0360c5c
7
+ data.tar.gz: 83153eae6e5c83f85cb30772ac1ae3134a99c226e4e84cd0a96ad1157087a633ef54cb66b5402bb99095d685bde334d7703c4fbf7738a9c8a964de8b98e10d9e
@@ -40,10 +40,6 @@ module ViennaRna
40
40
  end
41
41
  end
42
42
  end
43
-
44
- def debugger
45
- STDERR.puts yield if ViennaRna.debug
46
- end
47
43
  end
48
44
 
49
45
  attr_reader :data, :response, :runtime
@@ -86,7 +82,7 @@ module ViennaRna
86
82
  post_process if respond_to?(:post_process)
87
83
  end
88
84
 
89
- debugger { "Total runtime: %.3f sec." % runtime.real }
85
+ ViennaRna.debugger { "Total runtime: %.3f sec." % runtime.real }
90
86
  end
91
87
  else
92
88
  self
@@ -114,7 +110,7 @@ module ViennaRna
114
110
  "echo #{exec_sequence_format} | #{exec_name} #{stringify_flags(flags)}"
115
111
  end
116
112
 
117
- debugger { command }
113
+ ViennaRna.debugger { command }
118
114
 
119
115
  %x[#{command}]
120
116
  end
@@ -18,7 +18,8 @@ module ViennaRna
18
18
  end
19
19
 
20
20
  def init_from_fasta(string)
21
- init_from_string(*string.split(/\n/).reject { |line| line.start_with?(">") })
21
+ string = File.read(string).chomp if File.exist?(string)
22
+ init_from_string(*string.split(/\n/).reject { |line| line.start_with?(">") }[0, 2])
22
23
  end
23
24
 
24
25
  def init_from_self(rna)
@@ -35,6 +36,10 @@ module ViennaRna
35
36
  when :mfe then ViennaRna::Fold.run(Rna.init_from_string(seq)).structure
36
37
  when String then structure
37
38
  end
39
+
40
+ if str && seq.length != str.length
41
+ ViennaRna.debugger { "The sequence length (%d) doesn't match the structure length (%d)" % [seq.length, str.length] }
42
+ end
38
43
  end
39
44
 
40
45
  alias :seq :sequence
@@ -15,7 +15,7 @@ module ViennaRna
15
15
  file.write("%s\n" % data.str)
16
16
  file.close
17
17
 
18
- debugger { "Running FFTbor on #{data.inspect}" }
18
+ ViennaRna.debugger { "Running FFTbor on #{data.inspect}" }
19
19
 
20
20
  "%s %s %s" % [
21
21
  exec_name,
data/lib/vienna_rna.rb CHANGED
@@ -28,6 +28,10 @@ module ViennaRna
28
28
  end
29
29
  end
30
30
  end
31
+
32
+ def self.debugger
33
+ STDERR.puts yield if ViennaRna.debug
34
+ end
31
35
 
32
36
  def self.debug
33
37
  @debug
@@ -41,6 +45,14 @@ end
41
45
  # This dirties up the public namespace, but I use it so many times that I want a shorthand to it
42
46
  unless defined? RNA
43
47
  def RNA(sequence, structure = nil)
44
- ViennaRna::Rna.init_from_string(sequence, structure)
48
+ RNA.from_string(sequence, structure)
49
+ end
50
+ end
51
+
52
+ module RNA
53
+ def self.method_missing(name, *args, &block)
54
+ if "#{name}" =~ /^from_\w+$/
55
+ ViennaRna::Rna.send("init_#{name}", *args)
56
+ else super end
45
57
  end
46
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vienna_rna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Senter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2013-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.0.3
141
+ rubygems_version: 2.0.5
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Bindings to the Vienna RNA package.