rbbt-dm 1.1.17 → 1.1.18

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: 02a66fdb598d5f2ebbf7bdbb966e333828c25c74
4
- data.tar.gz: a661e1801711f0de053b622449d0ac201cafef7e
3
+ metadata.gz: ba8688bb3e7913ef167e240940388ab69fa33e5c
4
+ data.tar.gz: 40f43f13ce557e8ae994e651cd11ab7e054ae3b0
5
5
  SHA512:
6
- metadata.gz: 2dc3a421c78c79619ee01fdaadef01136da9bd6231fa8223be5184e6041e233ed2e8c7643000d055a8c79fe50c93d871fefabaaee625ac8e0bb46d57f2b20b23
7
- data.tar.gz: d48a85fdbd66651cdead6cb3516c20b44f6a3190d95cfb98dad6d00434b114d96457bf7cee58b260fe5facb75ca979d5171569608108c255fdf1ea4dfe2d7a9a
6
+ metadata.gz: 8ed0a89e1c2d6a449b86c68536c1a55626f7a7f074714f227d8a862d1974096a40027041c254482fce4edecdd53f2518da72ce29e0ac4f106934f629fb8e29fe
7
+ data.tar.gz: e26cd0ce1e3ab61b2774f89f7a0c83ae63d440b4016abcb6118421a56126a21ef5f40fd1fcf3846aaa128fe508d4cffb8c89edd426affac0d36ab1002642f174
@@ -31,12 +31,18 @@ class Matrix
31
31
  log2 = true
32
32
  trend = true
33
33
  two_channel = false
34
- else
34
+ when 'log2 ratio', 'transformed count'
35
35
  log2 = false
36
- trend = true
36
+ trend = false
37
+ two_channel = false
38
+ else
39
+ Log.warn "Unkown value_type: #{value_type}"
40
+ log2 = true
41
+ trend = false
37
42
  two_channel = false
38
43
  end
39
44
 
45
+ file = file.find if Path === file
40
46
  FileUtils.mkdir_p File.dirname(file) unless file.nil? or File.exists? File.dirname(file)
41
47
 
42
48
  cmd = <<-EOS
data/lib/rbbt/matrix.rb CHANGED
@@ -33,6 +33,10 @@ class Matrix
33
33
  @samples ||= TSV.parse_header(@data_file).fields
34
34
  end
35
35
 
36
+ def subsets=(subsets)
37
+ @subsets = subsets
38
+ end
39
+
36
40
  def subsets
37
41
  @subsets ||= begin
38
42
  subsets = {}
@@ -138,6 +142,9 @@ class Matrix
138
142
  Misc.mean(v.compact)
139
143
  end
140
144
  end
141
- Matrix.new file, labels, value_type, "Ensembl Gene ID", organism
145
+ subsets = self.subsets
146
+ matrix = Matrix.new file, labels, value_type, "Ensembl Gene ID", organism
147
+ matrix.subsets = subsets
148
+ matrix
142
149
  end
143
150
  end
@@ -276,16 +276,20 @@ module RandomWalk
276
276
  end
277
277
  end
278
278
 
279
- def self.permutations_up_down(size_up, size_down, total, missing = 0, times = 10000)
280
- (1..times).collect do
281
- score_up_down(Array.new(size_up){ (rand * total).to_i }.sort, Array.new(size_down){ (rand * total).to_i }.sort, total, missing).abs
279
+ def self.persisted_permutations(size, total, missing = 0, times = 10_000)
280
+ require 'rbbt/util/tc_cache'
281
+ repo_file = "/tmp/rw_repo9"
282
+ key = Misc.digest([size, total, missing, times, scoring_method].inspect)
283
+ cache = TCCache.open(repo_file, :float_array)
284
+ p = cache.cache(key) do
285
+ permutations(size, total, missing, times)
282
286
  end
287
+ p
283
288
  end
284
289
 
285
290
  def self.pvalue(permutations, score)
286
291
  score = score.abs
287
292
  permutations.inject(1){|acc, per|
288
-
289
293
  acc += 1 if per > score
290
294
  acc
291
295
  }.to_f / permutations.length
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-dm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.17
4
+ version: 1.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util