rbbt-rest 1.8.100 → 1.8.101

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: 6e300de985d4e401a9ade4802219274d354e318b
4
- data.tar.gz: 698553ac0867819d9ac1b63eebfa92111125adc0
3
+ metadata.gz: fc57d8156b2175378706469776115cc8394a8c56
4
+ data.tar.gz: c81bb2d8f99fecbc182b6e24079a18df9fed3764
5
5
  SHA512:
6
- metadata.gz: bb8f336021a91d2fd6ca900416a147d272a054efeabdde75744e57f95609f305bd80ab08746b24b1a57e85b50fb316bfce1779216dc4ab0e2bbb28712059d06b
7
- data.tar.gz: 897331ed434c75939f6fa368b61b66705f10566d28dafdf90fc9bae35ac6be2c3924300a8677653a9e76d8df39205bcf9cb08773e804d3d4084125962a6c2def
6
+ metadata.gz: 90cf4c082961fd9e7efe46307230355154d93e838a4124b80615ec8aedf2fa4d3948515bb4730769572b980d11292629a74748f4a6baacaaddd0b51a90ff067e
7
+ data.tar.gz: f3c03f11cd8a830e5226ecc43a38f653b1b8dfe8df3f527898c51ed838842737e9cb537de7df9dbd387ec7c52f2452ab6db3c76907bbab8cfdea0a50ab555bca
@@ -216,7 +216,11 @@ module RbbtRESTHelpers
216
216
  if filter and filter.to_s != "false"
217
217
  filter.split(";;").each do |f|
218
218
  key, value = f.split("~")
219
+ orig_key = key
220
+ format = Entity.formats.find(key)
221
+ type = Entity.formats[format] if format
219
222
  next if value.nil? or value.empty?
223
+
220
224
  value = Entity::REST.restore_element(value)
221
225
 
222
226
  #invert
@@ -235,6 +239,7 @@ module RbbtRESTHelpers
235
239
  name = false
236
240
  end
237
241
 
242
+ #length
238
243
  if value =~ /^:length:\s*(.*)/
239
244
  value = $1
240
245
  length = true
@@ -261,6 +266,11 @@ module RbbtRESTHelpers
261
266
  end
262
267
 
263
268
  case
269
+ when value =~ /^(%in%)\s*(.*)/
270
+ raise "Entity type not recognized for field: #{orig_key}" if type.nil?
271
+ list_name = $2
272
+ list = Entity::List.load_list(type, list_name)
273
+ tsv = tsv.select(key, invert){|k| k = k.first if Array === k; (k.nil? or (String === k and k.empty?)) ? false : list.include?(k)}
264
274
  when value =~ /^([<>]=?)(.*)/
265
275
  tsv = tsv.select(key, invert){|k| k = k.first if Array === k; (k.nil? or (String === k and k.empty?)) ? false : k.to_f.send($1, $2.to_f)}
266
276
  when value =~ /^\/(.+)\/.{0,2}\s*$/
@@ -451,7 +461,7 @@ module RbbtRESTHelpers
451
461
  tsv, table_options = load_tsv(file)
452
462
  end
453
463
 
454
- table_options[:heatmap] = tsv.cast && %w(to_i to_f).include?(tsv.cast.to_s) unless table_options.include? :heatmap
464
+ table_options[:heatmap] = (tsv.cast && %w(to_i to_f).include?(tsv.cast.to_s) && tsv.fields.length > 1) unless table_options.include? :heatmap
455
465
 
456
466
  table_options = default_table_options.merge(table_options)
457
467
 
@@ -15,7 +15,7 @@ module Entity
15
15
  id = Entity::REST.clean_element(id)
16
16
  id = Misc.sanitize_filename(id)
17
17
 
18
- entity_type = entity_type.split(":").first
18
+ entity_type = entity_type.to_s.split(":").first
19
19
 
20
20
  raise "Ilegal list id: #{ id }" unless Misc.path_relative_to Entity.entity_list_cache, File.join(Entity.entity_list_cache, id)
21
21
 
@@ -19,6 +19,7 @@
19
19
  - *String of text*: perfect match (e.g. `'Cancer'`)
20
20
  - *Regular expression*: flexible match (e.g. `'/(bladder|breast)\s+cancer/i'`)
21
21
  - *Numeric comparison*: lower of grater than (e.g. `'< 0.1'` or `'>= 2'`)
22
+ - *In an Entity List*: for lists that match the entity implied by the header (e.g. '%in% \<list name\>')
22
23
  - *Names*: for entities having 'human-friendly' names, such as genes or pathways; regular expression accepted (e.g. `':name: SF3B1'` or `':name: /CDK\d/'`)
23
24
  - *Length*: for lists (e.g. `':length: > 2'`)
24
25
  - *Negation*: Any of the rules above can be negated by prepending the `!` character (e.g. `'!:name:/^IG/'`)
@@ -5,7 +5,10 @@ rbbt.mlog = function(data){
5
5
 
6
6
  // AJAX
7
7
 
8
- rbbt.ajax = function(params){
8
+ rbbt.ajax = function(params, complete){
9
+ if (undefined === params.complete){
10
+ params.complete = complete
11
+ }
9
12
  if (undefined === params.method) params.method = "GET"
10
13
  if (rbbt.proxy && params.url.indexOf('//') < 0 && params.url.indexOf('/') == 0){
11
14
  params.url = rbbt.proxy + params.url
@@ -121,6 +124,9 @@ rbbt.get = function(url, params){
121
124
 
122
125
  rbbt.post = function(url, data, params){
123
126
  var request_params
127
+ if (typeof params === 'function'){
128
+ params = {complete: params}
129
+ }
124
130
  if (typeof url === 'object'){
125
131
  request_params = url
126
132
  if (data) request_params.data = data
@@ -63,3 +63,13 @@ rbbt.url_add_script_name = function(url){
63
63
 
64
64
  return url
65
65
  }
66
+
67
+ rbbt.link_add_script_name = function(link){
68
+
69
+ console.log(link)
70
+ var l = $(link)
71
+ console.log(l)
72
+ l.attr('href', rbbt.url_add_script_name(l.attr('href')))
73
+ return l[0].outerHTML;
74
+ }
75
+
@@ -41,6 +41,7 @@ ModalComponent = function(element){
41
41
  }
42
42
 
43
43
  ctrl.show_url = function(url, title){
44
+ url = rbbt.url_add_script_name(url)
44
45
  if (typeof url == 'string') params = {url: url, method: 'GET',deserialize: function(v){return v}}
45
46
  else params = url
46
47
 
@@ -57,6 +57,8 @@ body.on('click', 'a.intersect_lists', function(){
57
57
  var list_id = rbbt.page.list().id;
58
58
  var params = "other_list_id=" + clean_element(other_list_id)
59
59
  var url = "/entity_list/intersect/" + clean_element(type) + "/" + clean_element(list_id) + "?" + params
60
+
61
+ url = rbbt.url_add_script_name(url)
60
62
  window.location= url
61
63
  })
62
64
 
@@ -67,6 +69,8 @@ body.on('click', 'a.remove_list', function(){
67
69
  var list_id = rbbt.page.list().id;
68
70
  var params = "other_list_id=" + clean_element(other_list_id)
69
71
  var url = "/entity_list/remove/" + clean_element(type) + "/" + clean_element(list_id) + "?" + params
72
+
73
+ url = rbbt.url_add_script_name(url)
70
74
  window.location= url
71
75
  })
72
76
 
@@ -77,6 +81,7 @@ body.on('click', 'a.add_list', function(){
77
81
  var list_id = rbbt.page.list().id;
78
82
  var params = "other_list_id=" + clean_element(other_list_id)
79
83
  var url = "/entity_list/add/" + clean_element(type) + "/" + clean_element(list_id) + "?" + params
84
+ url = rbbt.url_add_script_name(url)
80
85
  window.location= url
81
86
  })
82
87
 
@@ -87,6 +92,7 @@ body.on('click', 'a.edit_list', function(){
87
92
  var list_id = rbbt.page.list().id;
88
93
 
89
94
  var url = '/entity_list/' + clean_element(entity_type) + '/edit/' + clean_element(list_id)
95
+ url = rbbt.url_add_script_name(url)
90
96
 
91
97
  rbbt.modal.controller.show_url(url, "Edit list")
92
98
 
@@ -126,6 +132,7 @@ body.on('click', '.edit_list input[type=submit]', function(){
126
132
 
127
133
  var url = '/entity_list/' + clean_element(entity_type) + '/' + clean_element(new_list_id )
128
134
 
135
+ url = rbbt.url_add_script_name(url)
129
136
  get_ajax({url: url, type: 'POST', async: false, data: {annotations: JSON.stringify(annotations), entities: entities}}, function(){ window.location = url })
130
137
 
131
138
  return false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.100
4
+ version: 1.8.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2018-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake