rbbt-dm 1.1.6 → 1.1.7

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: 7a4d1889c790a3df527cb658469c4507765fd55a
4
- data.tar.gz: b3fba784b73403c4eb130e6f21e39a3040ae938f
3
+ metadata.gz: 2a64441aa1cd02aa113a218e75d8a45e8679404d
4
+ data.tar.gz: 3d8ec7e4202bdb5ec1f79baa95e534ad84270369
5
5
  SHA512:
6
- metadata.gz: ed2f7a8490762d392caa8f1e2bd4d53891a80d1414748c199f67b53492ba3fbcd018c87be368c41941af00d10c284988337a78c22a964ce914e4ebd453cd9235
7
- data.tar.gz: b433ca84f94cb88eb2510a0195498a9f7df24897b927d672d18170ffd6efb9ea7a234f155c1ced83499b7c59760eb6db93d0cacb977b4afa55db3031cab79a07
6
+ metadata.gz: 79dde04bbfa4955f595c6bc702c9c5791029ed0a52e5720cf8e453036cfa6279ac1aea49fd5eba399fc68e1a8fcdc2db7428beba21cf5fec68bb3f93653b5533
7
+ data.tar.gz: f43dc00fa73c817da58a807163feba66b3ce2275ff4b1c51f42ba458f3c8448047cc013da82c8be6aadd3cd57111dbe376a39166985497328867e34c0c0880ab
@@ -6,9 +6,28 @@ class Matrix
6
6
  main_samples, contrast_samples = comparison main, contrast
7
7
  end
8
8
 
9
- Persist.persist(data_file, :tsv, :other => {:main => main_samples, :contrast => contrast_samples}, :prefix => "GENE", :dir => Matrix.matrix_dir, :no_load => true, :path => path) do |file|
10
- log2 = value_type == "count"
11
- GE.analyze(data_file, main_samples, contrast_samples, log2, path, format)
9
+ name = data_file =~ /:>/ ? File.basename(data_file) : data_file
10
+ Persist.persist(name, :tsv, :update => true,
11
+ :other => {:main => main_samples, :contrast => contrast_samples},
12
+ :prefix => "Diff", :dir => Matrix.matrix_dir.differential, :no_load => true) do |file|
13
+
14
+ log2 = value_type.nil? or value_type == "count"
15
+ log2 = false
16
+ two_channel = false
17
+ FileUtils.mkdir_p File.dirname(file) unless file.nil? or File.exists? File.dirname(file)
18
+ cmd = "source('#{Rbbt.share.R["MA.R"].find}'); rbbt.dm.matrix.differential(#{ R.ruby2R data_file }, main = #{R.ruby2R(main_samples)}, contrast = #{R.ruby2R(contrast_samples)}, log2=#{ R.ruby2R log2 }, outfile = #{R.ruby2R path}, key.field = #{R.ruby2R format}, two.channel = #{R.ruby2R two_channel})"
19
+ R.run(cmd)
20
+ nil
12
21
  end
13
22
  end
14
23
  end
24
+
25
+
26
+ #def self.analyze(datafile, main, contrast = nil, log2 = false, outfile = nil, key_field = nil, two_channel = nil)
27
+ # FileUtils.mkdir_p File.dirname(outfile) unless outfile.nil? or File.exists? File.dirname(outfile)
28
+ # GE.run_R("rbbt.GE.process(#{ R.ruby2R datafile }, main = #{R.ruby2R(main, :strings => true)}, contrast = #{R.ruby2R(contrast, :strings => true)}, log2=#{ R.ruby2R log2 }, outfile = #{R.ruby2R outfile}, key.field = #{R.ruby2R key_field}, two.channel = #{R.ruby2R two_channel})")
29
+ #end
30
+ #def self.barcode(datafile, outfile, factor = 2)
31
+ # FileUtils.mkdir_p File.dirname(outfile) unless outfile.nil? or File.exists? File.dirname(outfile)
32
+ # GE.run_R("rbbt.GE.barcode(#{ R.ruby2R datafile }, #{ R.ruby2R outfile }, #{ R.ruby2R factor })")
33
+ #end
data/lib/rbbt/matrix.rb CHANGED
@@ -92,7 +92,10 @@ class Matrix
92
92
 
93
93
  def to_gene(identifiers = nil)
94
94
  require 'rbbt/tsv/change_id'
95
- file = Persist.persist(data_file, :tsv, :prefix => "GENE", :dir => Matrix.matrix_dir, :no_load => true) do
95
+
96
+ name = data_file =~ /:>/ ? File.basename(data_file) : data_file
97
+
98
+ file = Persist.persist(data_file, :tsv, :prefix => "Gene", :dir => Matrix.matrix_dir.values, :no_load => true) do
96
99
  identifiers = [Organism.identifiers(organism), @identifiers, identifiers].compact.uniq
97
100
 
98
101
  data_file.tsv(:cast => :to_f).change_key("Ensembl Gene ID", :identifiers => identifiers) do |v|
@@ -257,17 +257,18 @@ module RandomWalk
257
257
  end
258
258
 
259
259
  def self.persisted_permutations(size, total, missing = 0, times = 10_000)
260
- repo_file = "/tmp/rw_repo5"
260
+ repo_file = "/tmp/rw_repo7"
261
261
  repo = Persist.open_tokyocabinet(repo_file, false, :float_array)
262
262
  key = Misc.digest([size, total, missing, times, scoring_method].inspect)
263
+ repo.read
263
264
  if repo[key]
264
265
  repo[key]
265
266
  else
266
267
  p = permutations(size, total, missing, times)
267
- repo.write
268
- repo[key] = p
269
- repo.read
270
- repo[key]
268
+ repo.write_and_close do
269
+ repo[key] = p
270
+ end
271
+ p
271
272
  end
272
273
  end
273
274
 
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.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util