vienna_rna 0.9.1 → 0.9.2

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: a899fb4d340d38517ca0ea8a6cf40972c633f943
4
- data.tar.gz: 61102bfc0d277cdb89da81c7114f2f4a1a370eff
3
+ metadata.gz: 75269157e25be08827f08546fffdb90af43be397
4
+ data.tar.gz: a8b2094c492af287894e3219e3328233ecf31340
5
5
  SHA512:
6
- metadata.gz: d105473a36561ba4d1cc9b49f4d95af0ce2d571682d1239af88ea2c7a5b37b004c00cabc3fb96eb6a9b8f9ab97b99a89d91564fa352661774d6e8d84615777c0
7
- data.tar.gz: 7afc4799420d2ad31c116e3d9f9c6a65f91bbea83ca86f840e1c3d10d98cae9c0dad5ba2facd6050cc3629d14a53cf88b0f484a653ab86257a557887716f7b27
6
+ metadata.gz: 26a7068d00b8181041fc0ea12d38a25b65724ff3eb0dd2e910821bbea27c4bfa7317835956242881cac3e1cc64442e6cfc3a23e3135d5e16f2382c0648dbaa7a
7
+ data.tar.gz: bd6799d8ca85f2ddf712fac00e97eb17700b01218e2a99579a0aba94ee2d0fd7a899bff56a473b8b719f7eec8112ab110dd02372a43f5326b19d107aac4ea829
@@ -46,7 +46,7 @@ module ViennaRna
46
46
  end
47
47
 
48
48
  def initialize(sequence: "", structure: "", second_structure: "", raw_data: {})
49
- @sequence, @raw_data = sequence, raw_data
49
+ @sequence, @raw_data = sequence.kind_of?(Rna) ? sequence.seq : sequence, raw_data
50
50
 
51
51
  [:structure, :second_structure].each do |structure_symbol|
52
52
  instance_variable_set(
@@ -55,6 +55,12 @@ module ViennaRna
55
55
  when :empty then empty_structure
56
56
  when :mfe then RNA(sequence).run(:fold).mfe_rna.structure
57
57
  when String then structure_value
58
+ when Hash then
59
+ if structure_value.keys.count > 1
60
+ ViennaRna.debugger { "The following options hash has more than one key. This will probably produce unpredictable results: %s" % structure_value.inspect }
61
+ end
62
+
63
+ RNA(sequence).run(*structure_value.keys, *structure_value.values).mfe_rna.structure
58
64
  end
59
65
  )
60
66
  end
@@ -26,7 +26,7 @@ module ViennaRna
26
26
 
27
27
  r.assign("legend.titles", data.each_with_index.map { |hash, index| hash[:legend] || "Line #{index + 1}" })
28
28
  r.eval("line.colors <- rainbow(%d)" % data.size)
29
- r.eval("plot(0, 0, type = 'n', cex = .75, xlab = '', ylab = '', xlim = c(%d, %d), ylim = c(%d, %d))" % [
29
+ r.eval("plot(0, 0, type = 'n', cex = .75, cex.axis = .9, xlab = '', ylab = '', xlim = c(%d, %d), ylim = c(%d, %d))" % [
30
30
  x_range.min, x_range.max, y_range.min, y_range.max
31
31
  ])
32
32
 
@@ -47,9 +47,11 @@ module ViennaRna
47
47
 
48
48
  r.eval <<-STR
49
49
  title(
50
- xlab = "#{x_label}",
51
- ylab = "#{y_label}",
52
- main = "#{title || 'Line Graph'}"
50
+ xlab = "#{x_label}",
51
+ ylab = "#{y_label}",
52
+ main = "#{title || 'Line Graph'}",
53
+ cex.main = .9,
54
+ cex.lab = .9
53
55
  )
54
56
  STR
55
57
 
@@ -61,7 +63,8 @@ module ViennaRna
61
63
  bty = "n",
62
64
  col = line.colors,
63
65
  lty = rep(1, #{data.size}),
64
- pch = 0:#{data.size}
66
+ pch = 0:#{data.size},
67
+ cex = .9
65
68
  )
66
69
  STR
67
70
  end
@@ -74,10 +77,10 @@ module ViennaRna
74
77
  overlay([{ data: data }], title: title, type: type, x_label: x_label, y_label: y_label, legend: false, filename: filename)
75
78
  end
76
79
 
77
- def histogram(data, title: nil, x_label: "Bins", bin_size: 1, relative: false, filename: false)
80
+ def histogram(data, title: nil, x_label: "Bins", num_bins: false, bin_size: 1, x_arrow: false, relative: false, filename: false)
78
81
  half = bin_size / 2.0
79
82
  range = Range.new((data.min - half).floor, (data.max + half).ceil)
80
- breaks = (range.min + half).step(range.max + half, bin_size).to_a
83
+ breaks = num_bins ? num_bins : (range.min + half).step(range.max + half, bin_size).to_a
81
84
 
82
85
  graph do |r|
83
86
  r.assign("histogram.data", data)
@@ -91,13 +94,18 @@ module ViennaRna
91
94
  r.eval <<-STR
92
95
  hist(
93
96
  histogram.data,
94
- breaks = histogram.breaks,
95
- xlab = "#{x_label} (width: #{bin_size})",
96
- main = "#{title || 'Histogram'}",
97
- freq = #{relative ? 'FALSE' : 'TRUE'}
97
+ breaks = histogram.breaks,
98
+ xlab = "#{x_label}",
99
+ main = "#{title || 'Histogram'}",
100
+ freq = #{relative ? 'F' : 'T'},
101
+ cex.main = 0.9,
102
+ cex.lab = 0.9,
103
+ cex.axis = 0.9
98
104
  )
99
105
  STR
100
106
 
107
+ r.eval("abline(v = #{x_arrow}, lty = 'dashed')") if x_arrow
108
+
101
109
  r.eval("dev.off()") if writing_file?(filename)
102
110
  end
103
111
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vienna_rna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
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-09-19 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: shuffle
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.1.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rinruby
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.0.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.0.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rroc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.1.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.1.1
83
83
  description: A Ruby 2.0 API for interacting with command line tools involving RNA
@@ -113,17 +113,17 @@ require_paths:
113
113
  - lib
114
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.1.2
126
+ rubygems_version: 2.1.4
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Bindings to the Vienna RNA package, and other major command line utilities