This repository has been archived by the owner on Oct 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
154 lines (134 loc) · 5.39 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="src/css/datatables.min.css" rel="stylesheet">
<link href="src/css/app.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12"><h2>MVP POC</h2></div>
<div class="col-md-12"><strong>Filter on Peptide Sequence(s): </strong><input id="sequence-filter" type="text" size="50"></div>
</div>
<table id="data-table" class="table table-bordered" cellspacing="0" width="100%"></table>
<div></div>
<table id="detail-table" class="table table-bordered" cellspacing="0" width="100%"></table>
</div>
<script src="src/js/lib/jquery.min.js"></script>
<script src="src/js/lib/datatables.min.js"></script>
<script src="src/js/modules/AjaxDataProvider.js"></script>
<script>
$(document).ready(function () {
var dp = new AjaxDataProvider({
rowIDField: 'Peptide_pkid',
baseQuery: {
'SELECT': 'pe.Peptide_pkid, Peptide.sequence, COUNT(DISTINCT(pe.DBSequence_pkid)) AS ProteinCount, COUNT(DISTINCT(pe.SpectrumIdentification_pkid)) AS SpectralCount',
'FROM': 'PeptideEvidence pe, Peptide',
'WHERE': 'pe.Peptide_pkid = Peptide.pkid',
'GROUPBY': 'pe.Peptide_pkid',
},
href: 'http://localhost:8080',
historyID: 'ebfb8f50c6abde6d',
datasetID: 'ebfb8f50c6abde6d',
searchColumn: 'Peptide.sequence',
searchTable: 'Peptide',
columnNames: [{
'data': 'Peptide_pkid',
'title': 'Peptide_pkid'
},
{
'data': 'ProteinCount',
'title': 'ProteinCount'
},
{
'data': 'SpectralCount',
'title': 'SpectralCount'
},
{
'data': 'sequence',
'title': 'sequence'
}
]
})
// Note: use dom option to hide the search/filter input box
// need to run the search from our own input box.
var table = $('#data-table').DataTable({
dom: 'lrtip',
order: [
[2, 'DESC']
],
processing: true,
serverSide: true,
ajax: function (data, callback) {
dp.provideData(data, callback)
},
columns: dp.getColumnNames()
});
$('#data-table tbody').on('click', 'tr', function () {
$(this).toggleClass('selected-peptide');
var scoreDP = new AjaxDataProvider({
rowIDField: 'Score.pkid',
baseQuery: {
'SELECT': 'DISTINCT(Score.pkid) AS pkid, Score."PeptideShaker PSM confidence type" AS PSMConfType,Score."OMSSA:evalue" AS OMSSAEv,Score."PeptideShaker PSM score" AS PSMScore,Score."X!Tandem:expect" AS XTandemEx',
'FROM': 'PeptideEvidence pe, Score',
'WHERE': 'pe.Peptide_pkid = 19996 AND Score.SpectrumIdentification_pkid = pe.SpectrumIdentification_pkid'
},
href: 'http://localhost:8080',
historyID: 'ebfb8f50c6abde6d',
datasetID: 'ebfb8f50c6abde6d',
columnNames: [
{
'data': 'pkid',
'title': 'pkid'
},
{
'data': 'PSMConfType',
'title': 'PSMConfType'
},
{
'data': 'OMSSAEv',
'title': 'OMSSAEv'
},
{
'data': 'PSMScore',
'title': 'PSMScore'
},
{
'data': 'XTandemEx',
'title': 'XTandemEx'
},
{
'data': 'PSMScore',
'title': 'PSMScore'
},
{
'data': 'PSMScore',
'title': 'PSMScore'
}
]
});
var detailTable = $('#detail-table').DataTable({
dom: 'lrtip',
processing: true,
serverSide: true,
ajax: function (data, callback) {
scoreDP.provideData(data, callback)
},
columns: scoreDP.getColumnNames()
});
console.log(table.row(this).data());
});
});
// React to change in filter input box value
$('#sequence-filter').on('change', function(){
var table = $('#data-table').DataTable();
console.log('It changed.');
table.search( this.value ).draw();
})
</script>
</body>
</html>