rbbt-util 5.17.75 → 5.17.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/entity.rb +7 -2
- data/lib/rbbt/util/R/plot.rb +5 -1
- data/lib/rbbt/workflow/step/run.rb +2 -1
- data/share/Rlib/util.R +42 -0
- data/test/rbbt/test_entity.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7c82572a3836b322f205a0244a4f29440ecaa94
|
4
|
+
data.tar.gz: 38e3e52b6284fd289652ab74e0ce40c72af08744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4103bd134db485801a2357481671267df121661602bd2e5bdfa420d85adba2feb1a685bfae7aac5aa49ce3867b6ad4ef164b22abe642bacd59ce0273793cf012
|
7
|
+
data.tar.gz: 4199d15dffe1e0c61438233f806ed90856a81d22d3a1be00f6621b243de301c7a72cee07dca042970ec68a666eba188dbf0d9ec5422bd93011d1497f2d770172
|
data/lib/rbbt/entity.rb
CHANGED
@@ -68,7 +68,7 @@ module Entity
|
|
68
68
|
@entity_property_cache = dir
|
69
69
|
end
|
70
70
|
|
71
|
-
attr_accessor :all_formats
|
71
|
+
attr_accessor :all_formats, :all_properties
|
72
72
|
def self.extended(base)
|
73
73
|
base.extend Annotation
|
74
74
|
Entity.formats[base.to_s] = base
|
@@ -122,6 +122,10 @@ module Entity
|
|
122
122
|
}
|
123
123
|
end
|
124
124
|
|
125
|
+
def all_properties
|
126
|
+
annotation_types.select{|m| Entity === m}.collect{|e| e.all_properties}.flatten.uniq
|
127
|
+
end
|
128
|
+
|
125
129
|
def self.property(name, &block)
|
126
130
|
case
|
127
131
|
when (Hash === name and name.size == 1)
|
@@ -174,8 +178,9 @@ module Entity
|
|
174
178
|
end
|
175
179
|
else
|
176
180
|
raise "Type not undestood in property: #{ type }"
|
177
|
-
|
178
181
|
end
|
182
|
+
@all_properties ||= []
|
183
|
+
@all_properties << name
|
179
184
|
end
|
180
185
|
|
181
186
|
def self.persist(method_name, type = nil, options = {})
|
data/lib/rbbt/util/R/plot.rb
CHANGED
@@ -36,7 +36,11 @@ module R
|
|
36
36
|
":NA"
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
if field_classes.any?
|
40
|
+
options[:R_open] ||= "colClasses=c('character'," + field_classes * ", " + ')'
|
41
|
+
else
|
42
|
+
options[:R_open] ||= "colClasses=c('character')"
|
43
|
+
end
|
40
44
|
|
41
45
|
TmpFile.with_file nil, true, :extension => 'svg' do |tmpfile|
|
42
46
|
data.R <<-EOF, sources, options
|
@@ -292,7 +292,7 @@ class Step
|
|
292
292
|
raise "Error in job: #{status}"
|
293
293
|
end
|
294
294
|
end
|
295
|
-
clean if dirty?
|
295
|
+
clean if dirty? or not running?
|
296
296
|
run(true) unless started?
|
297
297
|
join unless done?
|
298
298
|
self
|
@@ -424,6 +424,7 @@ class Step
|
|
424
424
|
def abort
|
425
425
|
_abort
|
426
426
|
log(:aborted, "Job aborted") unless aborted? or error?
|
427
|
+
self
|
427
428
|
end
|
428
429
|
|
429
430
|
def join_stream
|
data/share/Rlib/util.R
CHANGED
@@ -447,3 +447,45 @@ rbbt.model.inpute <- function(data, formula, ...){
|
|
447
447
|
# data$Prediction = NULL
|
448
448
|
data
|
449
449
|
}
|
450
|
+
|
451
|
+
rbbt.tsv.melt <- function(tsv, key_field = 'ID'){
|
452
|
+
tsv[key_field] = rownames(tsv)
|
453
|
+
return(melt(tsv))
|
454
|
+
}
|
455
|
+
|
456
|
+
rbbt.ranks <- function(x){
|
457
|
+
l = sum(!is.na(x))
|
458
|
+
i = sort(x, index.return=T, na.last=NA)$ix
|
459
|
+
vv = rep(NA,length(x))
|
460
|
+
|
461
|
+
c = 1
|
462
|
+
for (pos in i){
|
463
|
+
vv[pos] = c / l
|
464
|
+
c = c + 1
|
465
|
+
}
|
466
|
+
return(vv)
|
467
|
+
}
|
468
|
+
|
469
|
+
rbbt.ranks <- function(x){
|
470
|
+
x = as.numeric(x)
|
471
|
+
missing = is.na(x)
|
472
|
+
l = sum(!missing)
|
473
|
+
x.fixed = x[!missing]
|
474
|
+
x.i = sort(x.fixed, index.return=T, na.last=NA)$ix
|
475
|
+
|
476
|
+
vv = rep(NA,length(x))
|
477
|
+
|
478
|
+
c = 1
|
479
|
+
for (pos in x.i){
|
480
|
+
vv[pos] = c / l
|
481
|
+
c = c + 1
|
482
|
+
}
|
483
|
+
|
484
|
+
vv.complete = rep(NA,length(x))
|
485
|
+
vv.complete[!missing] = vv
|
486
|
+
return(vv.complete)
|
487
|
+
}
|
488
|
+
|
489
|
+
rbbt.default_code <- function(organism){
|
490
|
+
return(organism + "/feb2014")
|
491
|
+
}
|
data/test/rbbt/test_entity.rb
CHANGED
@@ -182,4 +182,9 @@ class TestEntity < Test::Unit::TestCase
|
|
182
182
|
assert ! string.clean_annotations.respond_to?(:reverse_text_single)
|
183
183
|
|
184
184
|
end
|
185
|
+
|
186
|
+
def test_all_properties
|
187
|
+
puts ReversableString.setup("TEST").all_properties
|
188
|
+
puts ReversableString.all_properties
|
189
|
+
end
|
185
190
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.17.
|
4
|
+
version: 5.17.76
|
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-09-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|