forked from intermine/cytoscape-intermine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (89 loc) · 3.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!doctype html>
<html>
<head>
<title>Cytoscape Intermine</title>
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ To show the export table button, ensure that imtables is available in
+ the DOM before this script is loaded. The 'show in table' button
+ will automatically appear.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<script src="http://cdn.intermine.org/js/intermine/im-tables/2.0.0-beta/imtables.js" charset="UTF-8"></script>
<script src="http://cdn.intermine.org/js/intermine/imjs/3.15.0/im.min.js" charset="UTF-8"></script>
<link rel="stylesheet" href="http://cdn.intermine.org/js/intermine/im-tables/2.0.0-beta/main.sandboxed.css">
<link href="dist/style.css" rel="stylesheet" type="text/css">
<script src="dist/bundle.js"></script>
</head>
<body>
<!-- This form is for demo purposes only, and not required to run the script -->
<form id="searchForm" name="searchForm">
<input type="text" id="searchOn" name="searchOn" placeholder="Search for another gene"></input>
<div class="nodeType">
<div>
<label><input type="radio" name="proteinOrGene" value="Protein"> Protein</label>
</div>
<div>
<label><input type="radio" name="proteinOrGene" value="Gene" checked="checked"> Gene</label>
</div>
</div>
<button>Search!</button>
</form>
<!-- End demo form -->
<div id="myAwesomeElement"></div> <!--this is where the graph will display. -->
<div id="cymine"></div> <!--this is where the graph would display if we didn't specify that myAwesomeElement is the parentElem -->
<script>
cymine({
//optional. Will default to '#cymine' if not specified:
parentElem : document.getElementById('myAwesomeElement'),
//required. can't query without this! :) must be a valid
//intermine API URL
service : {root : 'http://www.humanmine.org/humanmine/service/'},
//required. needs value : "whatever", optionally extraValue : "whatever".
queryOn : {
"value": "pparg",
"extraValue": "H. sapiens"
},
nodeType : "Gene", //valid options are Gene or Protein. Optional, will default to Gene.
compact:true //optional. Only relevant for error messages. Displays compact 1.5 em 'no results found' message rather than taking up the normal amount of space.
});
//EVERYTHING BELOW THIS LINE IS COMPLETELY OPTIONAL. IT JUST CREATES THE
//GENE SEARCH BOX, FOR DEMO PURPOSES:
var search = document.getElementById('searchForm');
search.addEventListener('submit', function(e) {
e.preventDefault(); //don't be silly, we don't need to reload the page
var searchOn = e.target.searchOn.value;
//remove any crazy stuff from the input before we send it
searchOn = searchOn.replace(/[^\w_]/g,"");
nodeType = search.proteinOrGene.value;
cymine({
parentElem : document.getElementById('myAwesomeElement'),
service : {root : 'http://www.humanmine.org/humanmine/service/'},
queryOn : {
"value": searchOn,
"extraValue": "H. sapiens"
},
nodeType: nodeType
});
});
</script>
<style>
#searchForm {
text-align:left;
padding:1em;
display:flex;
justify-content:center;
}
#searchOn, #searchForm button {
border-radius:4px;
padding:0.5em;
border:solid 1px #ccc;
}
#myAwesomeElement {
min-height:470px;
box-sizing:border-box;
}
.nodeType {
padding:0em 1em;
}
</style>
</body>
</html>