Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class QCMetricConfiguration implements Comparable<QCMetricConfiguration>
private String _yAxisLabel;
private Double _upperBound;
private Double _lowerBound;
private String _annotationName;

public int getId()
{
Expand Down Expand Up @@ -164,6 +165,16 @@ public void setLowerBound(Double lowerBound)
_lowerBound = lowerBound;
}

public String getAnnotationName()
{
return _annotationName;
}

public void setAnnotationName(String annotationName)
{
_annotationName = annotationName;
}

public JSONObject toJSON(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", _id);
Expand Down Expand Up @@ -195,6 +206,9 @@ public JSONObject toJSON(){
if (_upperBound != null) {
jsonObject.put("upperBound", _upperBound);
}
if (_annotationName != null) {
jsonObject.put("annotationName", _annotationName);
}

return jsonObject;
}
Expand Down
3 changes: 2 additions & 1 deletion resources/queries/targetedms/qcMetricsConfig.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ SELECT
qmc.MaxTimeValue,
qmc.TimeValueOption,
qmc.TraceName,
qmc.YAxisLabel
qmc.YAxisLabel,
qmc.AnnotationName
FROM
qcmetricconfiguration qmc
FULL JOIN qcenabledmetrics qem
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN AnnotationName VARCHAR(255);
1 change: 1 addition & 0 deletions resources/schemas/targetedms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@
<column columnName="TimeValueOption"/>
<column columnName="TraceName"/>
<column columnName="YAxisLabel"/>
<column columnName="AnnotationName"/>
</columns>
</table>
<table tableName="QCMetricExclusion" tableDbType="TABLE">
Expand Down
70 changes: 43 additions & 27 deletions resources/views/configureQCMetric.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
LABKEY.internal = {};

LABKEY.internal.ConfigureQCMetrics = new function () {
const METRIC_TYPE_CUSTOM = 'custom';
const METRIC_TYPE_TRACE = 'trace';
const METRIC_TYPE_ANNOTATION = 'annotation';

let qcMetrics;
let qcMetricsTable ='';
let configRows = [];
Expand All @@ -36,7 +40,7 @@
qcMetricsTable += '<tr class="' + rowClass + '">';

qcMetricsTable += '<td>' + (editLock ? '<a id="editLink' + row.id + '" href="#">' : '' ) + LABKEY.Utils.encodeHtml(row.name) + '</td>' + (editLock ? '</a>' : '' );
qcMetricsTable += '<td>' + (row.PrecursorScoped ? 'Precursor' : 'Run') + '</td>';
qcMetricsTable += '<td>' + (row.PrecursorScoped ? 'Precursor' : 'Replicate') + '</td>';

if (row.EffectiveStatus === 'NoData') {
qcMetricsTable += '<td id=\"' + LABKEY.Utils.encodeHtml(row.name) + '\">No data in this folder</td>';
Expand All @@ -59,11 +63,14 @@
});

qcMetricsTable += '</table><br>' +
'<button type="button" class="labkey-button primary" id="saveButton" style="margin-right: 20px;">Save</button>' +
'<button type="button" class="labkey-button" id="cancelButton" style="margin-right: 20px;">Cancel</button>' +
'<button type="button" class="labkey-button" id="createNewCustomMetricButton" style="margin-right: 20px;">Add New Custom Metric</button>' +
'<button type="button" class="labkey-button" id="createNewTraceMetricButton" style="margin-right: 20px;">Add New Trace Metric</button>' +
'<div style="display:flex;flex-wrap:wrap;gap:8px;">' +
'<button type="button" class="labkey-button primary" id="saveButton">Save</button>' +
'<button type="button" class="labkey-button" id="cancelButton">Cancel</button>' +
'<button type="button" class="labkey-button" id="createNewCustomMetricButton">Add New Custom Metric</button>' +
'<button type="button" class="labkey-button" id="createNewTraceMetricButton">Add New Trace Metric</button>' +
'<button type="button" class="labkey-button" id="createNewAnnotationMetricButton">Add Annotation-Backed Metric</button>' +
'<button type="button" class="labkey-button" id="clearCacheButton">Clear Cached Metric Values</button>' +
'</div>' +
'</form><br>Edits to queries backing existing custom metrics require a manual cache clearing to display the updated results.</p>';

jQuery('#qcMetricsTable').html(qcMetricsTable);
Expand All @@ -77,10 +84,13 @@
LABKEY.internal.ConfigureQCMetrics.resetQCMetrics();
});
jQuery('#createNewCustomMetricButton').click(function() {
LABKEY.internal.ConfigureQCMetrics.addNewMetric('custom');
LABKEY.internal.ConfigureQCMetrics.addNewMetric(METRIC_TYPE_CUSTOM);
});
jQuery('#createNewTraceMetricButton').click(function() {
LABKEY.internal.ConfigureQCMetrics.addNewMetric('trace')
LABKEY.internal.ConfigureQCMetrics.addNewMetric(METRIC_TYPE_TRACE);
});
jQuery('#createNewAnnotationMetricButton').click(function() {
LABKEY.internal.ConfigureQCMetrics.addNewMetric(METRIC_TYPE_ANNOTATION);
});
jQuery('#clearCacheButton').click(function() {
jQuery('#qcMetricsError').text('Clearing cached metrics...');
Expand Down Expand Up @@ -169,7 +179,10 @@

const op = 'update';
if (clickedQcMetricConfig.TraceName) {
LABKEY.internal.ConfigureQCMetrics.showTraceMetricWindow(op, clickedQcMetricConfig)
LABKEY.internal.ConfigureQCMetrics.showTraceMetricWindow(op, clickedQcMetricConfig);
}
else if (clickedQcMetricConfig.AnnotationName) {
LABKEY.internal.ConfigureQCMetrics.showAnnotationMetricWindow(op, clickedQcMetricConfig);
}
else {
LABKEY.internal.ConfigureQCMetrics.showCustomMetricWindow(op, clickedQcMetricConfig);
Expand All @@ -181,22 +194,11 @@
},

showCustomMetricWindow: function (op, clickedMetric) {
LABKEY.Query.getSchemas({
scope: this,
containerPath: LABKEY.container.id,
success: function(schemasInfo) {
const windowConfig = {
parent: this,
schemas: schemasInfo.schemas,
operation: op
};

if (clickedMetric) {
windowConfig.metric = clickedMetric;
}
Ext4.create('Panorama.Window.AddCustomMetricWindow', windowConfig).show();
}
});
const windowConfig = { operation: op };
if (clickedMetric) {
windowConfig.metric = clickedMetric;
}
Panorama.Window.AddCustomMetricWindow.show(windowConfig);
},

showTraceMetricWindow: function (op, clickedMetric) {
Expand Down Expand Up @@ -242,13 +244,27 @@
});
},

showAnnotationMetricWindow: function (op, clickedMetric) {
const windowConfig = {
parent: this,
operation: op
};
if (clickedMetric) {
windowConfig.metric = clickedMetric;
}
Panorama.Window.AddAnnotationMetricWindow.show(windowConfig);
},

addNewMetric: function (metricType) {
const op = 'insert';
if (metricType === 'custom') {
if (metricType === METRIC_TYPE_CUSTOM) {
this.showCustomMetricWindow(op);
}
else if (metricType === 'trace') {
this.showTraceMetricWindow(op)
else if (metricType === METRIC_TYPE_TRACE) {
this.showTraceMetricWindow(op);
}
else if (metricType === METRIC_TYPE_ANNOTATION) {
this.showAnnotationMetricWindow(op);
}
},

Expand Down
1 change: 1 addition & 0 deletions resources/views/configureQCMetric.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<dependency path="Ext4"/>
<dependency path="PanoramaPremium/window/AddNewMetricWindow.js"/>
<dependency path="PanoramaPremium/window/AddNewTraceMetricWindow.js"/>
<dependency path="PanoramaPremium/window/AddNewAnnotationMetricWindow.js"/>
<dependency path="TargetedMS/js/misc.js"/>
</dependencies>
</view>
Loading
Loading