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: 0 additions & 14 deletions api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class QCMetricConfiguration implements Comparable<QCMetricConfiguration>
private String _name;
private String _queryName;
private boolean _precursorScoped;
private String _enabledQueryName;
private QCMetricStatus _status;
private String _traceName;
private Double _minTimeValue;
Expand Down Expand Up @@ -75,16 +74,6 @@ public void setPrecursorScoped(boolean precursorScoped)
_precursorScoped = precursorScoped;
}

public String getEnabledQueryName()
{
return _enabledQueryName;
}

public void setEnabledQueryName(String enabledQueryName)
{
_enabledQueryName = enabledQueryName;
}

public QCMetricStatus getStatus()
{
return _status;
Expand Down Expand Up @@ -182,9 +171,6 @@ public JSONObject toJSON(){
jsonObject.put("queryName", _queryName);
jsonObject.put("precursorScoped", _precursorScoped);
jsonObject.put("metricStatus", getStatus() == null ? QCMetricStatus.DEFAULT.toString() : getStatus().toString());
if (_enabledQueryName != null) {
jsonObject.put("enabledQueryName", _enabledQueryName);
}
if (_traceName != null) {
jsonObject.put("traceName", _traceName);
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion resources/queries/targetedms/QCMetricEnabled_lhRatio.sql

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ SELECT * FROM (
pci.Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
-- Use the error from the most intense transition associated with the precursor
(SELECT COALESCE(MassErrorPPM, -1000) AS MetricValue
(SELECT COALESCE(MassErrorPPM, -100000) AS MetricValue
FROM TransitionChromInfo tci
WHERE TransitionId.Charge IS NOT NULL
AND tci.PrecursorChromInfoId = pci.Id
AND Area IS NOT NULL
ORDER BY Area DESC, Id LIMIT 1) AS MetricValue FROM PrecursorChromInfo pci
) X
WHERE MetricValue IS NOT NULL
AND MetricValue != -100000
7 changes: 6 additions & 1 deletion resources/queries/targetedms/QCMetric_peakArea.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ SELECT
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalArea AS MetricValue
FROM PrecursorChromInfo
FROM PrecursorChromInfo
WHERE
-- Ensure we have precursor areas for peptides or small molecules
EXISTS (SELECT * FROM QCMetricEnabled_precursorArea)
-- Ensure we have transition areas for peptides or small molecules
AND EXISTS (SELECT * FROM QCMetricEnabled_transitionArea)
10 changes: 6 additions & 4 deletions resources/queries/targetedms/QCMetric_precursorArea.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/
SELECT
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalPrecursorArea AS MetricValue
FROM PrecursorChromInfo
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalPrecursorArea AS MetricValue
FROM PrecursorChromInfo
WHERE
EXISTS (SELECT * FROM QCMetricEnabled_precursorArea)
4 changes: 3 additions & 1 deletion resources/queries/targetedms/QCMetric_transitionArea.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ SELECT
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalNonPrecursorArea AS MetricValue
FROM PrecursorChromInfo
FROM PrecursorChromInfo
WHERE
EXISTS (SELECT * FROM QCMetricEnabled_transitionArea)

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions resources/queries/targetedms/QCRunMetricEnabled_ticArea.sql

This file was deleted.

1 change: 0 additions & 1 deletion resources/queries/targetedms/qcMetricsConfig.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ SELECT
qmc.QueryName,
qmc.PrecursorScoped,
qmc.Container, -- including to lock out editing pre-configured qc metrics,
qmc.EnabledQueryName,
qem.Status,
CASE WHEN qem.metric IS NULL THEN FALSE
ELSE TRUE END AS Inserted,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CREATE TABLE targetedms.QCMetricCache
(
Container entityid NOT NULL,
MetricId INT NOT NULL,
PrecursorChromInfoId BIGINT,
SampleFileId BIGINT NOT NULL,
MetricValue REAL,
SeriesLabel VARCHAR(200),

CONSTRAINT PK_QCMetricCache PRIMARY KEY (Container, MetricId, PrecursorChromInfoId),
CONSTRAINT FK_QCMetricCache_PrecursorChromInfoId FOREIGN KEY (PrecursorChromInfoId) REFERENCES targetedms.PrecursorChromInfo(Id),
CONSTRAINT FK_QCMetricCache_SampleFileId FOREIGN KEY (SampleFileId) REFERENCES targetedms.SampleFile(Id),
CONSTRAINT FK_QCMetricCache_MetricIdId FOREIGN KEY (MetricId) REFERENCES targetedms.QCMetricConfiguration(Id),
CONSTRAINT FK_QCMetricCache_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId)
);

CREATE INDEX IDX_QCMetricCache_PrecursorChromInfoId ON targetedms.QCMetricCache(PrecursorChromInfoId);
CREATE INDEX IDX_QCMetricCache_SampleFileId ON targetedms.QCMetricCache(SampleFileId);
CREATE INDEX IDX_QCMetricCache_MetricId ON targetedms.QCMetricCache(MetricId);

ALTER TABLE targetedms.QCMetricConfiguration DROP COLUMN EnabledQueryName;
11 changes: 10 additions & 1 deletion resources/schemas/targetedms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,6 @@
<column columnName="Name"/>
<column columnName="QueryName"/>
<column columnName="PrecursorScoped"/>
<column columnName="EnabledQueryName"/>
<column columnName="TraceValue"/>
<column columnName="MinTimeValue"/>
<column columnName="MaxTimeValue"/>
Expand Down Expand Up @@ -1940,4 +1939,14 @@
<column columnName="Nickname"/>
</columns>
</table>
<table tableName="QCMetricCache" tableDbType="TABLE">
<columns>
<column columnName="Container"/>
<column columnName="MetricId"/>
<column columnName="PrecursorChromInfoId"/>
<column columnName="SampleFileId"/>
<column columnName="MetricValue"/>
<column columnName="SeriesLabel"/>
</columns>
</table>
</tables>
64 changes: 42 additions & 22 deletions resources/views/configureQCMetric.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
</p>

<div id="qcMetricsTable">Loading...</div>
<div id="qcMetricsError"></div>
<div id="qcMetricsError" class="labkey-error"></div>
<div id="linkToRawTable"></div>
<script type="text/javascript" nonce="<%=scriptNonce%>">

if (!LABKEY.internal)
Expand All @@ -28,9 +29,9 @@
'</tr>';

jQuery.each(qcMetrics, function (index, row) {
var rowClass = index % 2 === 1 ? "labkey-row" : "labkey-alternate-row";
const rowClass = index % 2 === 1 ? "labkey-row" : "labkey-alternate-row";
configRows.push({metric: row.id, name: row.name, Status: row.Status, Inserted: row.Inserted});
var editLock = row.Container === LABKEY.container.id;
const editLock = row.Container === LABKEY.container.id;

qcMetricsTable += '<tr class="' + rowClass + '">';

Expand All @@ -57,12 +58,13 @@
qcMetricsTable += '</tr>';
});

qcMetricsTable += '</table>' + '<br>' +
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">Add New Trace Metric</button>' +
'</form>';
'<button type="button" class="labkey-button" id="createNewTraceMetricButton" style="margin-right: 20px;">Add New Trace Metric</button>' +
'<button type="button" class="labkey-button" id="clearCacheButton">Clear Cached Metric Values</button>' +
'</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 @@ -80,14 +82,25 @@
jQuery('#createNewTraceMetricButton').click(function() {
LABKEY.internal.ConfigureQCMetrics.addNewMetric('trace')
});
jQuery('#clearCacheButton').click(function() {
jQuery('#qcMetricsError').text('Clearing cached metrics...');
LABKEY.Ajax.request({
url: LABKEY.ActionURL.buildURL('targetedms', 'clearQCMetricsCache.api'),
method: 'POST',
success: function() {
jQuery('#qcMetricsError').text('Cleared cached metrics.');
},
failure: LABKEY.Utils.getCallbackWrapper(LABKEY.internal.ConfigureQCMetrics.onError, this, true)
});
});

jQuery.each(qcMetrics, function (index, row) {
jQuery('#editLink' + row.id).click(function (e) {
e.preventDefault();
LABKEY.internal.ConfigureQCMetrics.editMetric(jQuery('#editLink' + row.id).text());
return false;
});
jQuery('#select-' + row.id).change(function (e) {
jQuery('#select-' + row.id).change(function () {
refreshBoundsInputs(qcMetrics);
});
});
Expand All @@ -103,7 +116,7 @@
}

function getReturnUrl() {
var returnUrl = LABKEY.ActionURL.getParameter('returnUrl');
const returnUrl = LABKEY.ActionURL.getParameter('returnUrl');

if(returnUrl) {
return returnUrl;
Expand All @@ -125,30 +138,36 @@
qcMetrics = result.rows;
showQCMetrics();
},
failure: LABKEY.Utils.getCallbackWrapper(LABKEY.internal.ConfigureQCMetrics.onError, this, true)
failure: LABKEY.Utils.getCallbackWrapper(LABKEY.internal.ConfigureQCMetrics.onErrorClearLoading, this, true)
});
},

onErrorClearLoading: function(exception, responseObj, response2){
this.onError(exception, responseObj, response2);
jQuery('#qcMetricsTable').text('');
},

onError: function(exception, responseObj, response2){
console.error(arguments);

var msg = LABKEY.Utils.getMsgFromError(response2, exception, {
const msg = LABKEY.Utils.getMsgFromError(response2, exception, {
showExceptionClass: false,
msgPrefix: 'Error: '
});

jQuery('#qcMetricsError').text(msg);
jQuery('#linkToRawTable').html(LABKEY.Utils.textLink({href: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'targetedms', queryName: 'QCMetricConfiguration'}), text: 'View QC metrics table'}));
},

editMetric: function (metricName) {
var clickedQcMetricConfig = {};
let clickedQcMetricConfig = {};
jQuery.each(qcMetrics, function (index, row) {
if (row.name === metricName) {
clickedQcMetricConfig = row;
}
});

var op = 'update';
const op = 'update';
if (clickedQcMetricConfig.TraceName) {
LABKEY.internal.ConfigureQCMetrics.showTraceMetricWindow(op, clickedQcMetricConfig)
}
Expand All @@ -166,7 +185,7 @@
scope: this,
containerPath: LABKEY.container.id,
success: function(schemasInfo) {
var windowConfig = {
const windowConfig = {
parent: this,
schemas: schemasInfo.schemas,
operation: op
Expand All @@ -188,25 +207,26 @@
filterArray: [LABKEY.Filter.create('TextId', null, LABKEY.Filter.Types.NOT_MISSING)],
success: function (sampleFileChromInfos) {

var tracesPresent = false;
let tracesPresent = false;
let traces;
if (sampleFileChromInfos.rows && sampleFileChromInfos.rows.length > 0) {
var rows = sampleFileChromInfos.rows;
var uniqueTraces = [];
var trace = {};
const rows = sampleFileChromInfos.rows;
const uniqueTraces = [];
const trace = {};

for (var i in rows) {
for (let i in rows) {
trace[rows[i]['TextId']] = rows[i];
}

for (i in trace) {
for (let i in trace) {
uniqueTraces.push(trace[i]);
}

traces = uniqueTraces;
tracesPresent = true;
}

var windowConfig = {
const windowConfig = {
parent: this,
traces: tracesPresent ? traces : {} ,
tracesPresent: tracesPresent,
Expand All @@ -223,7 +243,7 @@
},

addNewMetric: function (metricType) {
var op = 'insert';
const op = 'insert';
if (metricType === 'custom') {
this.showCustomMetricWindow(op);
}
Expand Down Expand Up @@ -294,7 +314,7 @@
LABKEY.Query.saveRows({
commands: commands,
method: 'POST',
success: function (data) {
success: function () {
window.location = getReturnUrl();
},
failure: LABKEY.Utils.getCallbackWrapper(LABKEY.internal.ConfigureQCMetrics.onError, this, true)
Expand Down
Loading