rbbt-rest 1.6.14 → 1.6.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/workflow/jobs.rb +0 -1
- data/share/views/compass/app.sass +33 -0
- data/share/views/layout/footer.haml +0 -34
- data/share/views/layout/top_menu.haml +7 -6
- data/share/views/public/js/helpers.js +27 -0
- data/share/views/public/js/rbbt.entity.js +10 -10
- data/share/views/public/js/rbbt.entity_list.js +10 -11
- data/share/views/public/js/rbbt.entity_map.js +16 -16
- data/share/views/public/js/rbbt.favourites.js +7 -12
- data/share/views/public/js/rbbt.modal.js +2 -0
- metadata +2 -3
- data/share/views/tools/cytoscape.haml +0 -312
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc4a9b93a28766b814c3dbb6d08f85c021603760
|
4
|
+
data.tar.gz: 975818bfe4d4439652a52744bed51bd171c8bf85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4da80d08b5243a647ad31296c4027de08bf63355fb2c2f9d6dd7a51f0b8473b84b61494fa77161f6b519bdad9d5eea0f20d2cd6c5191bc3779cf6bc444b1a8e
|
7
|
+
data.tar.gz: 0a18077ebf5a6a70b6bffe253909c405c585f40ccb4923638736c8df06979b43efdc6cc304e6444a5d6a7f513228d9eac37146edccaaf123a8b795d5eed9209d
|
@@ -109,7 +109,6 @@ module WorkflowRESTHelpers
|
|
109
109
|
when :entities
|
110
110
|
tsv = tsv_process(load_tsv(job.path).first)
|
111
111
|
list = tsv.column_values(tsv.fields.first).flatten
|
112
|
-
iif list
|
113
112
|
if not AnnotatedArray === list and Annotated === list.first
|
114
113
|
list.first.annotate list
|
115
114
|
list.extend AnnotatedArray
|
@@ -323,3 +323,36 @@ label[title]
|
|
323
323
|
&.error
|
324
324
|
.header
|
325
325
|
color: red
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
#footer
|
330
|
+
clear: both
|
331
|
+
|
332
|
+
border: none !important
|
333
|
+
padding: 0px !important
|
334
|
+
margin: 0px !important
|
335
|
+
.card
|
336
|
+
width: 100%
|
337
|
+
height: 100%
|
338
|
+
.contact
|
339
|
+
&:before
|
340
|
+
content: "Contact: "
|
341
|
+
font-weight: bold
|
342
|
+
span.where:before
|
343
|
+
content: " at "
|
344
|
+
.image
|
345
|
+
font-size: 0px
|
346
|
+
width: 241px
|
347
|
+
.content
|
348
|
+
width: calc(100% - 241px -8px)
|
349
|
+
.image, .content
|
350
|
+
display: inline-block
|
351
|
+
margin-left: 8px
|
352
|
+
|
353
|
+
.ui.segment:after
|
354
|
+
content: " "
|
355
|
+
display:inline-block
|
356
|
+
float:left
|
357
|
+
clear:both
|
358
|
+
|
@@ -1,37 +1,3 @@
|
|
1
|
-
:sass
|
2
|
-
|
3
|
-
#footer
|
4
|
-
clear: both
|
5
|
-
|
6
|
-
border: none !important
|
7
|
-
padding: 0px !important
|
8
|
-
margin: 0px !important
|
9
|
-
.card
|
10
|
-
width: 100%
|
11
|
-
height: 100%
|
12
|
-
.contact
|
13
|
-
&:before
|
14
|
-
content: "Contact: "
|
15
|
-
font-weight: bold
|
16
|
-
span.where:before
|
17
|
-
content: " at "
|
18
|
-
.image
|
19
|
-
font-size: 0px
|
20
|
-
width: 241px
|
21
|
-
.content
|
22
|
-
width: calc(100% - 241px -8px)
|
23
|
-
.image, .content
|
24
|
-
//float: left
|
25
|
-
display: inline-block
|
26
|
-
margin-left: 8px
|
27
|
-
|
28
|
-
.ui.segment
|
29
|
-
&:after
|
30
|
-
content: " "
|
31
|
-
display:inline-block
|
32
|
-
float:left
|
33
|
-
clear:both
|
34
|
-
|
35
1
|
.ui.segment
|
36
2
|
.image
|
37
3
|
%a(href="http://www.cnio.es/")
|
@@ -1,17 +1,22 @@
|
|
1
1
|
:sass
|
2
2
|
#top_menu
|
3
|
+
.favourite
|
4
|
+
width: 100%
|
3
5
|
& > .dropdown
|
4
6
|
display: inline-block !important
|
5
7
|
min-width: 10em
|
6
8
|
& > .favourite > .dropdown, & > .favourite > .item.pointer
|
7
9
|
display: inline-block !important
|
8
|
-
|
9
|
-
width: 100%
|
10
|
+
|
10
11
|
#top_menu.ui.fixed.menu
|
11
12
|
%a.header.item(href='/')= $title
|
12
13
|
|
13
14
|
%span.favourite
|
14
15
|
|
16
|
+
- if settings.respond_to?(:finder) and settings.finder and settings.finder.instances.any?
|
17
|
+
.finder.right.item
|
18
|
+
%form.collapse(action='/find' method="POST")
|
19
|
+
%input(type="search" name="term" placeholder='Search')
|
15
20
|
|
16
21
|
- if defined? Sinatra::RbbtRESTWorkflow and Sinatra::RbbtRESTWorkflow::WORKFLOWS
|
17
22
|
- expoted_workflows = Sinatra::RbbtRESTWorkflow::WORKFLOWS.collect do |workflow|
|
@@ -27,10 +32,6 @@
|
|
27
32
|
- expoted_workflows.each do |workflow|
|
28
33
|
%a.item(href='#{'/' + workflow.to_s}')= workflow.to_s
|
29
34
|
|
30
|
-
- if settings.respond_to?(:finder) and settings.finder and settings.finder.instances.any?
|
31
|
-
.finder.right.item
|
32
|
-
%form.collapse(action='/find' method="POST")
|
33
|
-
%input(type="search" name="term" placeholder='Search')
|
34
35
|
|
35
36
|
%a.item.login.right(href='/login')
|
36
37
|
%i.icon.user
|
@@ -137,3 +137,30 @@ function unique(arrayName) {
|
|
137
137
|
return newArray;
|
138
138
|
}
|
139
139
|
|
140
|
+
function forHash(obj, fn, thisObj){
|
141
|
+
var key, i = 0;
|
142
|
+
function exec(fn, obj, key, thisObj){
|
143
|
+
return fn.call(thisObj, key, obj[key], obj);
|
144
|
+
}
|
145
|
+
for (key in obj) {
|
146
|
+
if (exec(fn, obj, key, thisObj) === false) {
|
147
|
+
break;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
return forHash;
|
151
|
+
}
|
152
|
+
|
153
|
+
function forArray(obj, fn, thisObj){
|
154
|
+
var key, i = 0;
|
155
|
+
function exec(fn, obj, prop, thisObj){
|
156
|
+
return fn.call(thisObj, obj[prop], obj);
|
157
|
+
}
|
158
|
+
for (var prop in obj) {
|
159
|
+
if (obj.hasOwnProperty(prop)) {
|
160
|
+
if (exec(fn, obj, prop, thisObj) === false) {
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
return forArray;
|
166
|
+
}
|
@@ -38,19 +38,19 @@ var FavouriteEntities = function(by_type){
|
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
|
+
|
41
42
|
FavouriteEntities.deserialize = function(data){
|
42
43
|
data = JSON.parse(data)
|
43
44
|
favourite_entities = {}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
45
|
+
|
46
|
+
forHash(data, function(type, type_data){
|
47
|
+
favourite_entities[type] = {}
|
48
|
+
forHash(type_data, function(code, info){
|
49
|
+
info.code = code
|
50
|
+
info.type = type
|
51
|
+
favourite_entities[type][code] = new Entity(info)
|
52
|
+
})
|
53
|
+
})
|
54
54
|
return favourite_entities
|
55
55
|
}
|
56
56
|
|
@@ -39,16 +39,15 @@ FavouriteLists.get = function(){
|
|
39
39
|
FavouriteLists.deserialize = function(data){
|
40
40
|
data = JSON.parse(data)
|
41
41
|
favourite_lists = {}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
42
|
+
|
43
|
+
forHash(data, function(type, type_data){
|
44
|
+
favourite_lists[type] = {}
|
45
|
+
forArray(type_data, function(id){
|
46
|
+
var info = {}
|
47
|
+
info.id = id
|
48
|
+
info.type = type
|
49
|
+
favourite_lists[type][id] = new EntityList(info)
|
50
|
+
})
|
51
|
+
})
|
53
52
|
return favourite_lists
|
54
53
|
}
|
@@ -9,7 +9,7 @@ var EntityMap = function(data){
|
|
9
9
|
}
|
10
10
|
|
11
11
|
this.url = function(){
|
12
|
-
var url = "/entity_map/" + this.full_type() + "/" + this.column + "/" + this.id
|
12
|
+
var url = "/entity_map/" + this.full_type() + "/" + clean_element(this.column) + "/" + clean_element(this.id)
|
13
13
|
return url
|
14
14
|
}
|
15
15
|
|
@@ -33,20 +33,20 @@ FavouriteMaps.get = function(){
|
|
33
33
|
FavouriteMaps.deserialize = function(data){
|
34
34
|
data = JSON.parse(data)
|
35
35
|
favourite_maps = {}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
}
|
36
|
+
|
37
|
+
forHash(data, function(type, type_data){
|
38
|
+
favourite_maps[type] = {}
|
39
|
+
forHash(type_data, function(column, column_data){
|
40
|
+
forArray(column_data, function(id){
|
41
|
+
var info = {}
|
42
|
+
info.id = id
|
43
|
+
info.column = column
|
44
|
+
info.type = type
|
45
|
+
favourite_maps[type][id] = new EntityMap(info)
|
46
|
+
})
|
47
|
+
})
|
48
|
+
})
|
51
49
|
return favourite_maps
|
52
50
|
}
|
51
|
+
|
52
|
+
|
@@ -37,8 +37,6 @@ fav_module.isFavourite_map = function(map){
|
|
37
37
|
|
38
38
|
fav_module.toggleFavourite_entity = function(){
|
39
39
|
var entity = rbbt.page.entity();
|
40
|
-
console.log(entity)
|
41
|
-
console.log(entity.code)
|
42
40
|
|
43
41
|
if (fav_module.isFavourite_entity(entity)){
|
44
42
|
rbbt.post({url: '/remove_favourite_entity/' + entity.type + '/' + clean_element(entity.code)}).then(fav_module.update)
|
@@ -68,16 +66,12 @@ fav_module.toggleFavourite_map = function(){
|
|
68
66
|
}
|
69
67
|
|
70
68
|
fav_module.toggleFavourite = function(){
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
return
|
75
|
-
|
76
|
-
fav_module.toggleFavourite_map()
|
77
|
-
else
|
78
|
-
fav_module.toggleFavourite_list()
|
79
|
-
else
|
80
|
-
fav_module.toggleFavourite_entity()
|
69
|
+
if (rbbt.page.entity())
|
70
|
+
return fav_module.toggleFavourite_entity()
|
71
|
+
if (rbbt.page.list())
|
72
|
+
return fav_module.toggleFavourite_list()
|
73
|
+
if (rbbt.page.map())
|
74
|
+
return fav_module.toggleFavourite_map()
|
81
75
|
}
|
82
76
|
|
83
77
|
//{{{ VIEWS
|
@@ -280,5 +274,6 @@ fav_module.hooks = function(){
|
|
280
274
|
}
|
281
275
|
|
282
276
|
fav_module.update = function(){
|
277
|
+
//fav_module.update_favourites().then(fav_module.view).then(function(){ $('.dropdown:not([tabindex])').dropdown()}).then(fav_module.hooks)
|
283
278
|
fav_module.update_favourites().then(fav_module.view).then(function(){ $('.dropdown:not([tabindex])').dropdown()}).then(fav_module.hooks)
|
284
279
|
}
|
@@ -28,6 +28,7 @@ rbbt.modal.controller = function(){
|
|
28
28
|
controller._set(content, title)
|
29
29
|
$(rbbt.modal.element).addClass('active')
|
30
30
|
m.redraw()
|
31
|
+
update_rbbt()
|
31
32
|
}
|
32
33
|
|
33
34
|
controller.error = function(content, title){
|
@@ -35,6 +36,7 @@ rbbt.modal.controller = function(){
|
|
35
36
|
$(rbbt.modal.element).addClass('active')
|
36
37
|
$(rbbt.modal.element).addClass('error')
|
37
38
|
m.redraw()
|
39
|
+
update_rbbt()
|
38
40
|
}
|
39
41
|
|
40
42
|
|
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.6.
|
4
|
+
version: 1.6.15
|
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-07-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -1828,7 +1828,6 @@ files:
|
|
1828
1828
|
- share/views/public/plugins/springy/springyui.js
|
1829
1829
|
- share/views/public/plugins/underscore/js/underscore.js
|
1830
1830
|
- share/views/tasks.haml
|
1831
|
-
- share/views/tools/cytoscape.haml
|
1832
1831
|
- share/views/wait.haml
|
1833
1832
|
homepage: http://github.com/mikisvaz/rbbt-rest
|
1834
1833
|
licenses:
|
@@ -1,312 +0,0 @@
|
|
1
|
-
- id = "rand" << (rand * 1000).to_i.to_s unless defined? id and not (id.nil? or id.empty?)
|
2
|
-
- id = Misc.snake_case(id)
|
3
|
-
- static = false unless defined? static and not static.nil?
|
4
|
-
- knowledge_base = nil unless defined? knowledge_base and not knowledge_base.nil?
|
5
|
-
- kb_name = 'user' unless defined? kb_name and not kb_name.nil?
|
6
|
-
|
7
|
-
= link_css '/stylesheets/cytoscape'
|
8
|
-
|
9
|
-
- syndications = {}
|
10
|
-
- databases = []
|
11
|
-
- cytoscape.knowledge_base.all_databases.each do |database|
|
12
|
-
- database = database.to_s
|
13
|
-
- name, synd = database.split("@")
|
14
|
-
- if synd
|
15
|
-
- syndications[synd] ||= []
|
16
|
-
- syndications[synd] << database
|
17
|
-
- else
|
18
|
-
- databases << database
|
19
|
-
|
20
|
-
:sass
|
21
|
-
.tab.content
|
22
|
-
position: relative
|
23
|
-
.cytoscape_tool .window
|
24
|
-
height: 700px
|
25
|
-
.cytoscape_tool.fixable.preload(id=id)
|
26
|
-
|
27
|
-
.controls.ui.top.attached.tabular.menu
|
28
|
-
.ui.item(data-tab='Close')
|
29
|
-
%i.icon.close
|
30
|
-
.ui.item(data-tab='Edges') Edges
|
31
|
-
.ui.item(data-tab='Entities') Entities
|
32
|
-
.ui.item(data-tab='Aesthetics') Aesthetics
|
33
|
-
.ui.item(data-tab='Help') Help
|
34
|
-
.ui.tab.bottom.attached.very.basic.segment.content(data-tab='Close')
|
35
|
-
.ui.tab.bottom.attached.segment.content(data-tab='Edges')
|
36
|
-
.database_edges
|
37
|
-
|
38
|
-
%h5 Add edges between entities
|
39
|
-
.action_parameters
|
40
|
-
%form.action_parameter_form
|
41
|
-
- if databases.any?
|
42
|
-
.input.multiple.database
|
43
|
-
- databases.each do |database|
|
44
|
-
- name, *rest = database.split "@"
|
45
|
-
%span.cchoice
|
46
|
-
%label(for="database[#{database}]")=name
|
47
|
-
%input(id="database[#{database}]" type="checkbox" value="true" name="database[#{database}]")
|
48
|
-
- if syndications.any?
|
49
|
-
%dl.rbbt_tabs.subtle(style="margin:1em")
|
50
|
-
- syndications.each do |synd, databases|
|
51
|
-
%dt.next=synd
|
52
|
-
%dd
|
53
|
-
.input.database.multiple
|
54
|
-
- databases.each do |database|
|
55
|
-
- name, *rest = database.split "@"
|
56
|
-
%span.choice
|
57
|
-
%label(for="database[#{database}]")=name
|
58
|
-
%input(id="database[#{database}]" type="checkbox" value="true" name="database[#{database}]")
|
59
|
-
|
60
|
-
.input.submit
|
61
|
-
%input(type="submit")
|
62
|
-
|
63
|
-
.ui.tab.bottom.attached.segment.content(data-tab='Entities')
|
64
|
-
.add_gene_list
|
65
|
-
%h5 Add entities from a list
|
66
|
-
= action_parameters nil, {:klass => ''}, :action => '#' do
|
67
|
-
- input :entities, :select, "Entities to add", nil, :html_options => {:class => 'favourite_lists', :type => 'All'}
|
68
|
-
|
69
|
-
.database_neighbours
|
70
|
-
%h5 Add neighbours of entities
|
71
|
-
.action_parameters.ui.raised.segment
|
72
|
-
%form.ui.form
|
73
|
-
.field.input.select.database
|
74
|
-
%label knowledgebase
|
75
|
-
%select(type="All" name="database")
|
76
|
-
- databases.each do |database|
|
77
|
-
- name, *rest = database.split "@"
|
78
|
-
%option(value=database)=name
|
79
|
-
- syndications.each do |synd, databases|
|
80
|
-
%option(disabled=true)=synd
|
81
|
-
- databases.each do |database|
|
82
|
-
- name, *rest = database.split "@"
|
83
|
-
%option(value=database)=name
|
84
|
-
.field.submit
|
85
|
-
%input.ui.submit.button(type="submit")
|
86
|
-
|
87
|
-
.ui.tab.bottom.attached.segment.content(data-tab='Aesthetics')
|
88
|
-
.maps
|
89
|
-
%h5 Map entity aesthetic
|
90
|
-
= action_parameters nil, {:klass => ''}, :action => '#' do
|
91
|
-
- input :elem, :select, "Type of element", :nodes, :select_options => [:nodes, :edges]
|
92
|
-
- input :aesthetic, :select, "Aesthetic to map to", :opacity, :select_options => [:shape, :size, :color, :opacity, :borderWidth]
|
93
|
-
- input :field, :string, "Attribute to map", 'id', :select_options => {:textarea => "Use textarea"}, :html_options => {:class => 'favourite_maps', :type => 'All'}
|
94
|
-
- input :map, :select, "Select map to use", nil, :select_options => {:textarea => "Use textarea"}, :html_options => {:class => 'favourite_maps', :type => 'All'}
|
95
|
-
- input :map_tsv, :text, "Map", nil, :no_file => true
|
96
|
-
|
97
|
-
.select_gene_list
|
98
|
-
%h5 Highlight entities from a list
|
99
|
-
= action_parameters nil, {:klass => ''}, :action => '#' do
|
100
|
-
- input :entities, :select, "Genes to add", nil, :html_options => {:class => 'favourite_lists', :type => 'All'}
|
101
|
-
|
102
|
-
.ui.tab.bottom.attached.segment.content(data-tab='Help')
|
103
|
-
|
104
|
-
:documentation
|
105
|
-
|
106
|
-
### Edges
|
107
|
-
|
108
|
-
You can connect your nodes using any of the databases in the `knowledgebase`.
|
109
|
-
This is configured in the `Edges` menu: check the databases you want to use,
|
110
|
-
if none is selected (by default) all of them are used.
|
111
|
-
|
112
|
-
### Entities
|
113
|
-
|
114
|
-
The network comes preloaded with a list of entities (nodes), but you
|
115
|
-
can remove them or add new ones. To remove them use the context menu
|
116
|
-
(right-click over cytoscape window); you can remove one node, or the
|
117
|
-
selected list of nodes.
|
118
|
-
|
119
|
-
Adding nodes can be done using the `Entity` menu. You can add entities from
|
120
|
-
your `favourite` lists or add the neighbours of your entities using any of
|
121
|
-
the databases in the `knowledgebase`.
|
122
|
-
|
123
|
-
### Aesthetics
|
124
|
-
|
125
|
-
Use the `Aesthetics` menu to change how your network looks. This can
|
126
|
-
help represent different sources of information. For now it works only
|
127
|
-
on nodes. You can change the value of different aesthetics, like
|
128
|
-
color, border width, size, shape, and opacity. You can `map` these
|
129
|
-
aesthetics to favourite `Entity Maps`, or use a custom mapping
|
130
|
-
in-place, as a space-separated TSV file (see example below). The
|
131
|
-
mappings can consider the identity of the node (type `id` in `field`;
|
132
|
-
default) or the type of node (type `entity_type` in `field`). For
|
133
|
-
instance:
|
134
|
-
|
135
|
-
aesthetic: color
|
136
|
-
field: entity_type
|
137
|
-
map: use_textarea
|
138
|
-
map_tsv:
|
139
|
-
GOTerm red
|
140
|
-
KeggPathway blue
|
141
|
-
Gene yellow
|
142
|
-
|
143
|
-
Another example use is to gather the `mutation/protein size` column on
|
144
|
-
the `COSMIC Overview` analysis bellow, and map it to the `opacity`
|
145
|
-
aesthetic of the genes (using the `id` as `field`).
|
146
|
-
|
147
|
-
.window.fixed_size(id="#{id}_window")
|
148
|
-
|
149
|
-
|
150
|
-
:deferjs
|
151
|
-
var cytoscape_id = '##{id}';
|
152
|
-
|
153
|
-
require_js(['/js/cytoscape/js/src/AC_OETags.js', '/js/cytoscape/js/src/cytoscapeweb.js', '/js/cytoscape'], function(){
|
154
|
-
|
155
|
-
$('.preload').removeClass('preload')
|
156
|
-
|
157
|
-
var tool = $(cytoscape_id).cytoscape_tool({
|
158
|
-
knowledge_base: '#{kb_name}',
|
159
|
-
namespace: '#{cytoscape.namespace}',
|
160
|
-
entities: #{cytoscape.entities.to_json},
|
161
|
-
network: #{cytoscape.network.to_json},
|
162
|
-
aesthetics: #{cytoscape.aesthetics.to_json},
|
163
|
-
|
164
|
-
node_click: function(event){
|
165
|
-
var target = event.target;
|
166
|
-
|
167
|
-
for (var i in target.data){
|
168
|
-
var variable_name = i;
|
169
|
-
var variable_value = target.data[i];
|
170
|
-
}
|
171
|
-
|
172
|
-
for (var i in target.data) {
|
173
|
-
var variable_name = i;
|
174
|
-
var variable_value = target.data[i];
|
175
|
-
}
|
176
|
-
|
177
|
-
var url = target.data.url;
|
178
|
-
|
179
|
-
$('#modal').modal('show_url', url, undefined, function(){
|
180
|
-
$('#modal').find(' > .header > .title').attr('entity', target.data.id).attr('type', target.data.entity_type)
|
181
|
-
})
|
182
|
-
return(false)
|
183
|
-
},
|
184
|
-
|
185
|
-
edge_click: function(event){
|
186
|
-
var target = event.target;
|
187
|
-
for (var i in target.data){
|
188
|
-
var variable_name = i;
|
189
|
-
var variable_value = target.data[i];
|
190
|
-
}
|
191
|
-
|
192
|
-
var pair = [target.data.source, target.data.target].join("~")
|
193
|
-
tool.cytoscape_tool('show_info', "user", target.data.database, pair);
|
194
|
-
|
195
|
-
return(false)
|
196
|
-
}
|
197
|
-
|
198
|
-
});
|
199
|
-
|
200
|
-
require_js('/js/controls/context_menu', function(){
|
201
|
-
cytoscape_context_menu(tool)
|
202
|
-
})
|
203
|
-
|
204
|
-
require_js('/js/controls/placement', function(){
|
205
|
-
cytoscape_placement(tool)
|
206
|
-
})
|
207
|
-
|
208
|
-
require_js('/js/controls/save', function(){
|
209
|
-
cytoscape_save(tool)
|
210
|
-
})
|
211
|
-
|
212
|
-
|
213
|
-
///////////////////////////////////
|
214
|
-
//{{{ NETWORK INIT
|
215
|
-
|
216
|
-
tool.cytoscape_tool('draw');
|
217
|
-
|
218
|
-
//////////////////////////////////////////////////////////////////
|
219
|
-
//{{{ Controls
|
220
|
-
|
221
|
-
$('.cytoscape_tool .database_edges input[type=submit]').click(function(){
|
222
|
-
var form =$(this).parents('form').first()
|
223
|
-
var inputs = form.find('.input.database.multiple')
|
224
|
-
var databases = $.map(inputs.find('input[type=checkbox]:checked'), function(e){
|
225
|
-
return $(e).attr('name').match(/\[(.*)\]/)[1];
|
226
|
-
})
|
227
|
-
|
228
|
-
tool.cytoscape_tool('set_edges', databases)
|
229
|
-
tool.cytoscape_tool('draw');
|
230
|
-
|
231
|
-
return false;
|
232
|
-
})
|
233
|
-
|
234
|
-
$('.cytoscape_tool .database_neighbours input[type=submit]').click(function(){
|
235
|
-
var databases = $.map($(this).parents('form').first().find('.input.database').find('input[type=checkbox]:checked'), function(e){
|
236
|
-
return $(e).attr('name').match(/\[(.*)\]/)[1];
|
237
|
-
})
|
238
|
-
var option = $(this).closest('form').find('select').find('option:selected');
|
239
|
-
var database = option.attr('value')
|
240
|
-
|
241
|
-
tool.cytoscape_tool('add_neighbours', database)
|
242
|
-
tool.cytoscape_tool('draw');
|
243
|
-
|
244
|
-
return false;
|
245
|
-
})
|
246
|
-
|
247
|
-
|
248
|
-
$('.cytoscape_tool .add_gene_list input[type=submit]').click(function(){
|
249
|
-
var option = $(this).closest('form').find('select.favourite_lists').find('option:selected');
|
250
|
-
var type = option.attr('attr-entity_type')
|
251
|
-
var list_id = $(this).parents('form').first().find('select').val();
|
252
|
-
var list = list_entities(type, list_id);
|
253
|
-
var info = list_info(type, list_id);
|
254
|
-
|
255
|
-
tool.cytoscape_tool('add_entities', type, list)
|
256
|
-
tool.cytoscape_tool('draw');
|
257
|
-
|
258
|
-
return false;
|
259
|
-
})
|
260
|
-
|
261
|
-
$('.cytoscape_tool .select_gene_list input[type=submit]').click(function(){
|
262
|
-
var option = $(this).closest('form').find('select.favourite_lists').find('option:selected');
|
263
|
-
var type = option.attr('attr-entity_type')
|
264
|
-
var list_id = $(this).parents('form').first().find('select').val();
|
265
|
-
var list = list_entities(type, list_id);
|
266
|
-
|
267
|
-
tool.cytoscape_tool('select_entities', list)
|
268
|
-
|
269
|
-
return false;
|
270
|
-
})
|
271
|
-
|
272
|
-
$('.cytoscape_tool .maps input[type=submit]').click(function(){
|
273
|
-
var form = $(this).closest('form')
|
274
|
-
|
275
|
-
|
276
|
-
var elem = form.first().find('div.input.elem select').val();
|
277
|
-
var map_id = form.first().find('div.input.map select').val();
|
278
|
-
var field = form.first().find('div.input.field input').val();
|
279
|
-
var map_content = form.first().find('div.input.map_tsv textarea').val();
|
280
|
-
var option = form.first().find('div.input.map option:selected');
|
281
|
-
var type = option.attr('attr-entity_type')
|
282
|
-
var column = form.first().find('div.input.map select').find('option:selected').attr('attr-column');
|
283
|
-
var aesthetic = form.first().find('div.input.aesthetic select').val();
|
284
|
-
|
285
|
-
var map;
|
286
|
-
|
287
|
-
if (map_id == 'textarea'){
|
288
|
-
map_content = "#: :type=:single#:sep=/\\s/#:identifiers=Hsa/jan2013\n" + map_content
|
289
|
-
rbbt_job('TSVWorkflow', 'to_json', {tsv: map_content}, function(data){
|
290
|
-
var map = JSON.parse(data)
|
291
|
-
tool.cytoscape_tool('aesthetic', elem, aesthetic, map, field)
|
292
|
-
tool.cytoscape_tool('draw')
|
293
|
-
})
|
294
|
-
}else{
|
295
|
-
entity_map(type, column, map_id, function(map){
|
296
|
-
tool.cytoscape_tool('aesthetic', elem, aesthetic, map, field)
|
297
|
-
tool.cytoscape_tool('draw')
|
298
|
-
});
|
299
|
-
}
|
300
|
-
|
301
|
-
return false;
|
302
|
-
})
|
303
|
-
})
|
304
|
-
:javascript
|
305
|
-
$('.item[data-tab]').tab()
|
306
|
-
$('.item[data-tab=Close]').click(function(item){
|
307
|
-
var tool = $(this).parents('.cytoscape_tool').first()
|
308
|
-
tool.find('.tab.active, .item.active').removeClass('active')
|
309
|
-
return false
|
310
|
-
})
|
311
|
-
|
312
|
-
|