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
/
app.js
226 lines (189 loc) · 7.33 KB
/
app.js
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
const MVPHelp = {
'text': '<p class="lead">Purpose</p><p>The MVP visualization tool extends Galaxy-P\'s advantages into the ' +
'visualization of large, complex data sets. This allows researchers to quickly inspect and verify the quality ' +
'of the results as well offer an overview with visualization and a deeper understanding of underlying spectral data. ' +
' This can be especially valuable when results include inputs from possibly diverse domains.</p>' + '' +
'<p>With the incorporation of Integrated Genomics Viewer (IGV) and Lorikeet, the MVP platform is already merging ' +
'proteomic and genomic results into a single, accessible output. A user can, with relatively few keystrokes, ' +
'filter and order large datasets down to a manageable subset. Due to the tools use of server-side caching, ' +
'large data sets are handled as quickly as small datasets.</p>' +
'<p>You are first presented with an overview of peptide sequences identified in the MZSqlite input. From here, you can find ' +
'<ul><li>PSMs linked to specific peptide sequences</li><li>PSMs based on score filtering</li>' +
'<li>MSMS spectra used in the PSM identification</li><li>Mapping PSMs to the protein, and then mapping the protein to the genomic seqeunce.</li>' +
'<li>Save PSM details from curated MSMS scans back to the current Galaxy history</li></ul></p>' +
'<hr><p class="lead">Actions</p><p><dl>' +
'<dt>ID Scores</dt><dd>Distribution of spectral matching identification scores</dd>' +
'<dt>ID Features</dt><dd>Select identification features for display</dd>' +
'<dt>Export Scans</dt><dd>Exports list of verified PSMs to active history</dd>'
};
/**
* Mediator pattern as main application.
*/
var MVPApplication = (function (app) {
app.debug = false; //Listen in on event publish
app.galaxyConfiguration = {};
app.events = {};
app.userDefaults = null;
//Hold some basic defaults. User can override.
app.app_defaults = {
"tool_tip_visible": true
};
/**
* Allows objects to subscribe to an event.
* @param event name
* @param fn call back function for event
* @returns {subscribe}
*/
app.subscribe = function (event, fn) {
if (!app.events[event]) {
app.events[event] = [];
}
app.events[event].push({
context: this,
callback: fn
});
return this;
};
/**
* Unsubscribes from the event queue
* @param event
* @param fn
*/
app.unsubscribe = function (event) {
app.event[event].filter(function (cv) {
return this === cv.context;
}.bind(this));
};
/**
* Allows objects to broadcast the occurrence of an event.
* All subscribers to the event will have their callback functions
* called.
*
* @param event name
* @returns {*}
*/
app.publish = function (event) {
var args, subscription;
if (!app.events[event]) {
return false;
}
args = Array.prototype.slice.call(arguments, 1);
if (app.debug) {
console.log('APP PUBLISH: ' + event + ' ARGS: ' + args);
}
app.events[event].map(function (cv) {
subscription = cv;
subscription.callback.apply(subscription.context, args);
});
return this;
};
/**
* Adds the subscribe and publish functions to an object
* @param obj
*/
app.installTo = function (obj) {
obj.subscribe = app.subscribe;
obj.publish = app.publish;
obj.unsubscribe = app.unsubscribe;
};
//Load modules
app.init = function (confObj) {
this.galaxyConfiguration = confObj;
$('#dataset_name').text(this.galaxyConfiguration.dataName);
this.subscribe("ScoreSummaryComplete", function(){
console.log('Score summary complete, begin table construction');
ScoreDefaults.init();
PeptideView.init({
galaxyConfiguration: this.galaxyConfiguration,
baseDiv: 'overview_div'
});
});
this.subscribe("FDRDataPrepared", function(){
$('#fdr_module').removeAttr('disabled')
.on('click', function(){
$('#fdr_div').toggle();
$('html, body').animate({
scrollTop: ($('#fdr_div').offset().top)
},500);
$('#fdr_module').tooltip('hide')
});
});
this.subscribe('UserChangedDefaults', function(data){
Object.keys(data).forEach(function(k){
console.log('UserChangedDefaults ' + k + " : " + data[k]);
app.app_defaults[k] = data[k];
if (k === 'tool_tip_visible') {
if (data[k]) {
$('[data-toggle="tooltip"]').tooltip();
} else {
$('[data-toggle="tooltip"]').tooltip('destroy');
}
}
});
});
this.installTo(ScoreSummary);
this.installTo(PeptideView);
this.installTo(RenderPSM);
this.installTo(VerifiedScans);
this.installTo(PeptideSequenceFilter);
this.installTo(featureViewer);
this.installTo(gQuery);
this.installTo(ScoreDefaults);
this.installTo(FDRPresentation);
this.installTo(ScoreFilterModule);
this.installTo(IGVManager);
this.installTo(IGVTrackManager);
this.installTo(BuildHelpPanel);
this.installTo(ConfigModal);
ScoreFilterModule.init({});
gQuery.init({
href: this.galaxyConfiguration.href,
datasetID: this.galaxyConfiguration.datasetID
});
featureViewer.init({
galaxyConfiguration: this.galaxyConfiguration,
baseDiv: 'protein_viewer',
queryFunc: gQuery.query,
dbkey: this.galaxyConfiguration.dbkey
});
RenderPSM.init({
galaxyConfiguration: this.galaxyConfiguration
});
VerifiedScans.init({
galaxyConfiguration: this.galaxyConfiguration
});
PeptideSequenceFilter.init({
galaxyConfiguration: this.galaxyConfiguration
});
ScoreSummary.init({
href: this.galaxyConfiguration.href,
datasetID: this.galaxyConfiguration.datasetID
});
IGVManager.init({
galaxyConfiguration: this.galaxyConfiguration
});
IGVTrackManager.init({
galaxyConfiguration: this.galaxyConfiguration
});
if (("protein_detection_protocol" in confObj.tableRowCount)){
FDRPresentation.init({
href: this.galaxyConfiguration.href,
datasetID: this.galaxyConfiguration.datasetID,
divID: "fdr_div",
callBackFN: PeptideView.reBuildTable
});
}
$('[data-toggle="tooltip"]').tooltip();
$('#mvp_help').on('click', function(){
BuildHelpPanel.showHelp(MVPHelp.text);
});
$('#mvp_config').on('click', function(){
ConfigModal.showConfig();
});
};
return {
run: function(confbj) {
app.init(confbj);
}
}
}(MVPApplication || {})); // eslint-disable-line no-use-before-define