Attachment 'kegg_relation_mapper_for_bioruby_console.rb'
Download 1 include_class 'cytoscape.Cytoscape'
2 include_class 'cytoscape.CyNode'
3 include_class 'cytoscape.CyEdge'
4 include_class 'cytoscape.CyNetwork'
5 include_class 'cytoscape.layout.CyLayouts'
6
7 if pathway_id == nil
8 puts 'Warning: Specify target pathway!'
9 return
10 end
11
12 puts '\n\n Target Pathway: ' + pathway_id
13
14 species = pathway_id[5..7]
15
16 elm = keggapi.get_elements_by_pathway(pathway_id)
17 rel = keggapi.get_element_relations_by_pathway(pathway_id)
18
19 kegg_id_map = Hash.new
20
21 # Extract name and ID
22 elm.each do |e|
23 kegg_id_map[e.element_id] = e.names
24 end
25
26 # Create pathway
27 pathway = Cytoscape.createNetwork("KEGG Pathway #{pathway_id}")
28 rel.each do |r|
29 node_id1 = "#{pathway_id}:#{r.element_id1}"
30 node_id2 = "#{pathway_id}:#{r.element_id2}"
31 node1 = Cytoscape.getCyNode( node_id1, true)
32 node2 = Cytoscape.getCyNode( node_id2, true)
33 edge = Cytoscape.getCyEdge(node1, node2, "interaction", r['type'], true)
34 pathway.addEdge(edge)
35 kegg_id1 = kegg_id_map[r.element_id1][0]
36 kegg_id2 = kegg_id_map[r.element_id2][0]
37 Cytoscape.getNodeAttributes.setAttribute(node_id1, 'KEGG ID', kegg_id1)
38 Cytoscape.getNodeAttributes.setAttribute(node_id2, 'KEGG ID', kegg_id2)
39
40 if kegg_id1.index(species) != nil
41 Cytoscape.getNodeAttributes.setAttribute(node_id1, 'Entrez Gene ID', kegg_id1.sub(/#{species}\:/, ""))
42 end
43
44 if kegg_id2.index(species) != nil
45 Cytoscape.getNodeAttributes.setAttribute(node_id2, 'Entrez Gene ID', kegg_id2.sub(/#{species}\:/, ""))
46 end
47 end
48
49 # Layout nodes
50 CyLayouts.getLayout("force-directed").doLayout();
51 Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
52
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2011-10-20 20:44:40, 16.4 KB) [[attachment:agilent1.png]]
- [get | view] (2011-10-20 20:44:40, 89.4 KB) [[attachment:agilent2.png]]
- [get | view] (2011-10-20 20:44:40, 7.0 KB) [[attachment:agilent3.png]]
- [get | view] (2011-10-20 20:44:40, 15.1 KB) [[attachment:entrez_ruby1.png]]
- [get | view] (2011-10-20 20:44:40, 106.8 KB) [[attachment:entrez_ruby2.png]]
- [get | view] (2011-10-20 20:44:40, 85.5 KB) [[attachment:gpml1.png]]
- [get | view] (2011-10-20 20:44:40, 127.9 KB) [[attachment:gpml2.png]]
- [get | view] (2011-10-20 20:44:40, 21.5 KB) [[attachment:intact1.png]]
- [get | view] (2011-10-20 20:44:40, 101.4 KB) [[attachment:intact2.png]]
- [get | view] (2011-10-20 20:44:40, 311.3 KB) [[attachment:intact3.png]]
- [get | view] (2011-10-20 20:44:40, 43.7 KB) [[attachment:kegg1.png]]
- [get | view] (2011-10-20 20:44:40, 67.8 KB) [[attachment:kegg2.png]]
- [get | view] (2011-10-20 20:44:40, 17.6 KB) [[attachment:kegg3.png]]
- [get | view] (2011-10-20 20:44:40, 1.6 KB) [[attachment:kegg_relation_mapper_for_bioruby_console.rb]]
- [get | view] (2011-10-20 20:44:40, 710.8 KB) [[attachment:merge_final.png]]
- [get | view] (2011-10-20 20:44:40, 507.6 KB) [[attachment:ncbi1.png]]
- [get | view] (2011-10-20 20:44:40, 3.8 KB) [[attachment:ncbi2.png]]
- [get | view] (2011-10-20 20:44:40, 26.3 KB) [[attachment:ncbi3.png]]
- [get | view] (2011-10-20 20:44:40, 46.3 KB) [[attachment:ncbi35.png]]
- [get | view] (2011-10-20 20:44:40, 112.1 KB) [[attachment:ncbi4.png]]
- [get | view] (2011-10-20 20:44:40, 132.0 KB) [[attachment:ncbi_gene_list1.png]]
- [get | view] (2011-10-20 20:44:40, 92.4 KB) [[attachment:ncbi_gene_list2.png]]
- [get | view] (2011-10-20 20:44:40, 2.8 KB) [[attachment:ncbi_gene_list3.png]]
- [get | view] (2011-10-20 20:44:40, 178.4 KB) [[attachment:ncbi_gene_list4-1.png]]
- [get | view] (2011-10-20 20:44:40, 8.3 KB) [[attachment:ncbi_gene_list4.png]]
- [get | view] (2011-10-20 20:44:40, 16.0 KB) [[attachment:ncbi_gene_list5.png]]
- [get | view] (2011-10-20 20:44:40, 190.0 KB) [[attachment:ncbi_gene_list6.png]]
- [get | view] (2011-10-20 20:44:40, 3731.2 KB) [[attachment:sampleSession1.cys]]
You are not allowed to attach a file to this page.