rbbt-dm 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZmUyMjZiODkyY2RmODNkMmNkMGJmYWZiYWFmMThkMDIzOGIzZDE5OA==
5
- data.tar.gz: !binary |-
6
- MTQ4MjdiZDY3YTljZTU2ZTViODVjNjA1NTdmYTY1MDQ2OWMxYmIzNg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MjBjZGUxNzk2Y2M1NDU1MzNmZmI1MTk3ODdhOTMxMjA4Njk5NzhkNGM4Mjhh
10
- ODZmZmNiOWRjZGQ2ZjBlYTMzMDliZDM2ZDBkYjMzNDA2MThkNjdmNzJmOTNh
11
- MmRmN2Y5MzEzOGM0MDUwNWQzYzE2YmVjYTdjMmMzMzk0MTNhNjQ=
12
- data.tar.gz: !binary |-
13
- NTZkZGFiODMwZTljNDNhYzEyMWJiYzljNGE4OWYzNTFkNjg2OGRjY2Q1ZDQ5
14
- Y2QwZjMwNzgzNmUyYzI1NmJjNzkyYjhhZDU2M2ZmZjU0ZWY4Mjg3NGYxOGU4
15
- YTNmN2ZhYzhkMGQ1NWYxNjhjY2FkMzIzOGQwMWI5M2M0ZDE4NzU=
2
+ SHA1:
3
+ metadata.gz: 3b56aaf594c49cc2f9797e91bf732ba5014c0040
4
+ data.tar.gz: f229787d7456462c0ee538c19fd7f22750acb78d
5
+ SHA512:
6
+ metadata.gz: 1a26e288df24cbf18bc1b499ebc392e0310ed7447ad8c7ae7c14cabdfb56ecb79143c09c6441593711d30c441742b95d9eea6ab611d5745e7acf24d66dff2234
7
+ data.tar.gz: 01a7d232b15db85af6f8d00c4b4d329895b41ab207521a249f62059337f7fe89a3ef11fa1188f2f6346379a3ee7c111b210ff954b1bbfc9b6b43bfbdbe238d64
@@ -34,19 +34,19 @@ module FDR
34
34
  inline do |builder|
35
35
 
36
36
  builder.prefix <<-EOC_CODE
37
+
37
38
  //{{{ Make compatible with 1.9 and 1.8
38
39
  #ifndef RUBY_19
39
- #ifndef RFLOAT_VALUE
40
- #define RFLOAT_VALUE(v) (RFLOAT(v)->value)
41
- #endif
42
- #ifndef RARRAY_PTR
43
- #define RARRAY_PTR(v) (RARRAY(v)->ptr)
44
- #endif
45
- #ifndef RARRAY_LEN
46
- #define RARRAY_LEN(v) (RARRAY(v)->len)
40
+ # define RFLOAT_VALUE_SET(v) (((struct RFloat *)v)->float_value)
41
+ # ifndef RFLOAT_VALUE
42
+ # define RFLOAT_VALUE(v) (RFLOAT(v)->value)
43
+ # endif
44
+ # ifndef RARRAY_LEN
45
+ # define RARRAY_LEN(v) (RARRAY(v)->len)
46
+ # endif
47
+ #else
48
+ # define RFLOAT_VALUE_SET(v) RFLOAT_VALUE
47
49
  #endif
48
- #endif
49
- //}}} Make compatible with 1.9 and 1.8
50
50
  EOC_CODE
51
51
 
52
52
  c_code = <<-EOC_CODE
@@ -55,8 +55,10 @@ module FDR
55
55
  int total = (int) RARRAY_LEN(ps);
56
56
 
57
57
  double last_value = 0;
58
+ double p;
59
+
58
60
  for (idx = 0; idx < total; idx++){
59
- double p = (double) RFLOAT_VALUE(rb_ary_entry(ps, idx));
61
+ p = (double) RFLOAT_VALUE(rb_ary_entry(ps, idx));
60
62
 
61
63
  if (p > rate * (double) (idx + 1) / (double) total){
62
64
  return last_value;
@@ -76,18 +78,18 @@ module FDR
76
78
 
77
79
  int total = (int) RARRAY_LEN(ps);
78
80
 
79
- VALUE new = rb_ary_new();
80
-
81
81
  double last = 1;
82
+ VALUE current_value;
82
83
  for (idx = total - 1; idx >= 0 ; idx-- ){
83
- double p = (double) RFLOAT_VALUE(rb_ary_entry(ps, idx));
84
-
84
+ current_value = rb_ary_entry(ps, idx);
85
+
86
+ double p = (double) RFLOAT_VALUE(current_value);
85
87
 
86
88
  p = p * (double) total / (double) (idx + 1);
87
89
  if (p > last) p = last;
88
90
  last = p;
89
91
 
90
- RFLOAT_VALUE(rb_ary_entry(ps, idx)) = p;
92
+ RFLOAT_VALUE_SET(rb_ary_entry(ps, idx)) = p;
91
93
  }
92
94
 
93
95
  return ps;
@@ -101,21 +103,24 @@ module FDR
101
103
 
102
104
  int total = (int) RARRAY_LEN(ps);
103
105
 
104
- VALUE new = rb_ary_new();
106
+ VALUE new_ary = rb_ary_new();
107
+ VALUE f;
108
+
109
+ double p, last = 1;
105
110
 
106
- double last = 1;
107
111
  for (idx = total - 1; idx >= 0 ; idx-- ){
108
- double p = (double) RFLOAT_VALUE(rb_ary_entry(ps, idx));
112
+ p = (double) RFLOAT_VALUE(rb_ary_entry(ps, idx));
109
113
 
110
114
 
111
115
  p = p * (double) total / (double) (idx + 1);
112
116
  if (p > last) p = last;
113
117
  last = p;
114
118
 
115
- rb_ary_unshift(new,rb_float_new(p));
119
+ f = rb_float_new(p);
120
+ rb_ary_unshift(new_ary, f);
116
121
  }
117
122
 
118
- return new;
123
+ return new_ary;
119
124
  }
120
125
  EOC_CODE
121
126
  builder.c_singleton c_code
@@ -130,7 +135,7 @@ module FDR
130
135
  alias :step_up :step_up_fast
131
136
  end
132
137
 
133
- # This will change the values of the floats in situ
138
+ # This will change the values of the floats in-situ
134
139
  def self.adjust_hash!(data, field = nil)
135
140
  keys = []
136
141
  values = []
@@ -151,9 +156,15 @@ module FDR
151
156
  data.unnamed = unnamed
152
157
  end
153
158
 
154
- FDR.adjust!(values)
159
+ if RUBY_VERSION[0] == "2"
160
+ # I don't know why the RFLOAT_VALUE_SET for Ruby 2.1.0 does not work
161
+ values = FDR.adjust(values)
162
+ data = Hash[*keys.zip(values).flatten]
163
+ else
164
+ FDR.adjust!(values)
165
+ end
155
166
 
156
- data
167
+ data
157
168
  end
158
169
 
159
170
  end
@@ -249,7 +249,7 @@ module TSV
249
249
  pvalues[annotation] = RSRuby.instance.phyper(count - 1, counts[annotation], tsv_size - counts[annotation], total, false).to_f
250
250
  end
251
251
 
252
- FDR.adjust_hash! pvalues if options[:fdr]
252
+ pvalues = FDR.adjust_hash! pvalues if options[:fdr]
253
253
 
254
254
  pvalues.delete_if{|k, pvalue| pvalue > options[:cutoff] } if options[:cutoff]
255
255
 
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-dm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-03 00:00:00.000000000 Z
11
+ date: 2014-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: RubyInline
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: priority_queue
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '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'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: distribution
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
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: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: png
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
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'
83
83
  description: Data-mining and statistics
@@ -100,12 +100,12 @@ files:
100
100
  - lib/rbbt/statistics/rank_product.rb
101
101
  - lib/rbbt/vector/model.rb
102
102
  - lib/rbbt/vector/model/svm.rb
103
+ - test/rbbt/network/test_paths.rb
104
+ - test/rbbt/statistics/test_fdr.rb
103
105
  - test/rbbt/statistics/test_hypergeometric.rb
104
106
  - test/rbbt/statistics/test_random_walk.rb
105
- - test/rbbt/statistics/test_fdr.rb
106
- - test/rbbt/network/test_paths.rb
107
- - test/rbbt/vector/test_model.rb
108
107
  - test/rbbt/vector/model/test_svm.rb
108
+ - test/rbbt/vector/test_model.rb
109
109
  - test/test_helper.rb
110
110
  homepage: http://github.com/mikisvaz/rbbt-phgx
111
111
  licenses: []
@@ -116,25 +116,25 @@ require_paths:
116
116
  - lib
117
117
  required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ! '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ! '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.0.3
129
+ rubygems_version: 2.2.1
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Data-mining and statistics
133
133
  test_files:
134
- - test/rbbt/statistics/test_hypergeometric.rb
135
- - test/rbbt/statistics/test_random_walk.rb
136
- - test/rbbt/statistics/test_fdr.rb
137
134
  - test/rbbt/network/test_paths.rb
138
- - test/rbbt/vector/test_model.rb
135
+ - test/rbbt/statistics/test_fdr.rb
136
+ - test/rbbt/statistics/test_random_walk.rb
137
+ - test/rbbt/statistics/test_hypergeometric.rb
139
138
  - test/rbbt/vector/model/test_svm.rb
139
+ - test/rbbt/vector/test_model.rb
140
140
  - test/test_helper.rb