vienna_rna 0.5.3 → 0.5.4

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: ac790b2a3c57e6ce297c390cc8c0be520335faab
4
- data.tar.gz: 5f67cbffc3f17f963c56f5f795d3420170bd5426
3
+ metadata.gz: 3ef71ef14f8aa6b6cfd87e922a9ee3cf615d0803
4
+ data.tar.gz: 57eaf84d7035c682f590c59f89b7979642dad4a5
5
5
  SHA512:
6
- metadata.gz: ca1ff9ce93175706556b3ba6d8bd99c67aa482a33d95efbecc1138c0dc720794d7e27efe5b1311776450000410be96fd3401203c27f3f5be60575b1adaff23ac
7
- data.tar.gz: a0f49b84a5592c629d10a5ce3119f248f5acf281ec092efb12b64bc80e6cabce67e54eb40d6f5026392fae4029c6447255106d8838e02f1faa76d5348774a731
6
+ metadata.gz: b3e3802edc175094efd45e4f1c041f16e0889c9ef8e5bf29c1cc67f0c8ef7207546efd69efe2eaf491b1a39a065e537867d7545d60816e2c025ee4a09cd07cf9
7
+ data.tar.gz: 5917e44780720e383bf7f97a9bfbe0f382cc62c35a03523ab71b4b9a35d13706af0f4b544ee2d517d0f23b2eed41024a4e1d5dbb5a5c975bfcf4cdf587655de3
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ ViennaRna
2
+ ------------------------
3
+
1
4
  A simple gem for facilitating bindings to the ViennaRNA package (http://www.tbi.univie.ac.at/~ivo/RNA/). Note that this gem makes no effort to build and install the ViennaRNA suite locally at this time, and instead relies on its presence on the host machine. Leverages the BioRuby gem (http://bioruby.open-bio.org/) libraries for file parsing.
2
5
 
3
6
  Simple use case:
@@ -16,4 +19,4 @@ Simple use case:
16
19
  > mfe_rna = RNA("CCUCGAGGGGAACCCGAAAGGGACCCGAGAGG").run(:fold).mfe_rna
17
20
  #=> echo CCUCGAGGGGAACCCGAAAGGGACCCGAGAGG | rnafold --noPS
18
21
  #=> Total runtime: 0.013 sec.
19
- #=> #<ViennaRna::Rna CCUCGAGGGGAACCCGAAAG... ((((..(((...(((....) [truncated]>
22
+ #=> #<ViennaRna::Rna CCUCGAGGGGAACCCGAAAG... ((((..(((...(((....) [truncated]>
@@ -4,17 +4,33 @@ module ViennaRna
4
4
  class << self
5
5
  def graph(&block)
6
6
  begin
7
- (yield r_instance = RinRuby.new).tap { ap r_instance.close }
7
+ (yield (r_instance = RinRuby.new)).tap { r_instance.close }
8
8
  rescue RuntimeError => e
9
9
  raise unless e.message == "Unsupported data type on R's end"
10
10
  end
11
11
  end
12
12
 
13
- def pdf(string)
13
+ def line_graph(data, title: nil, type: "l", x_label: "Independent", y_label: "Dependent", filename: false)
14
+ graph do |r|
15
+ r.assign("line_graph.x", data.map(&:first))
16
+ r.assign("line_graph.y", data.map(&:last))
14
17
 
18
+ if filename && (filename = filename.end_with?(".pdf") ? filename : filename + ".pdf")
19
+ r.eval <<-STR
20
+ pdf("#{filename}", 6, 6)
21
+ plot(line_graph.x, line_graph.y, xlab = "#{x_label}", ylab = "#{y_label}", main = "#{title || 'Line Graph'}", type = "#{type}")
22
+ dev.off()
23
+ STR
24
+ else
25
+ r.eval <<-STR
26
+ quartz("Histogram", 6, 6)
27
+ plot(line_graph.x, line_graph.y, xlab = "#{x_label}", ylab = "#{y_label}", main = "#{title || 'Line Graph'}", type = "#{type}")
28
+ STR
29
+ end
30
+ end
15
31
  end
16
32
 
17
- def histogram(data, title: nil, x_label: "Bins", bin_size: 1, filename: false)
33
+ def histogram(data, title: nil, x_label: "Bins", bin_size: 1, relative: false, filename: false)
18
34
  half = bin_size / 2.0
19
35
  range = Range.new((data.min - half).floor, (data.max + half).ceil)
20
36
  breaks = (range.min + half).step(range.max + half, bin_size).to_a
@@ -26,13 +42,13 @@ module ViennaRna
26
42
  if filename && (filename = filename.end_with?(".pdf") ? filename : filename + ".pdf")
27
43
  r.eval <<-STR
28
44
  pdf("#{filename}", 6, 6)
29
- hist(histogram.data, breaks = histogram.breaks, xlab = "#{x_label} (width: #{bin_size})", main = "#{title || 'Histogram'}")
45
+ hist(histogram.data, breaks = histogram.breaks, xlab = "#{x_label} (width: #{bin_size})", main = "#{title || 'Histogram'}", freq = #{relative ? 'FALSE' : 'TRUE'})
30
46
  dev.off()
31
47
  STR
32
48
  else
33
49
  r.eval <<-STR
34
50
  quartz("Histogram", 6, 6)
35
- hist(histogram.data, breaks = histogram.breaks, xlab = "#{x_label} (width: #{bin_size})", main = "#{title || 'Histogram'}")
51
+ hist(histogram.data, breaks = histogram.breaks, xlab = "#{x_label} (width: #{bin_size})", main = "#{title || 'Histogram'}", freq = #{relative ? 'FALSE' : 'TRUE'})
36
52
  STR
37
53
  end
38
54
  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.3
4
+ version: 0.5.4
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-06-20 00:00:00.000000000 Z
11
+ date: 2013-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio