diff --git a/api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java b/api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java
index 707128d44..73d10893e 100644
--- a/api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java
+++ b/api-src/org/labkey/api/targetedms/model/QCMetricConfiguration.java
@@ -24,7 +24,6 @@ public class QCMetricConfiguration implements Comparable
private String _name;
private String _queryName;
private boolean _precursorScoped;
- private String _enabledQueryName;
private QCMetricStatus _status;
private String _traceName;
private Double _minTimeValue;
@@ -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;
@@ -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);
}
diff --git a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorAccuracy.sql b/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorAccuracy.sql
deleted file mode 100644
index f35643bdb..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorAccuracy.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfoAnnotation WHERE Name = 'PrecursorAccuracy')
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOD.sql b/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOD.sql
deleted file mode 100644
index 65dcf6b0a..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOD.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfoAnnotation WHERE Name = 'LOD')
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOQ.sql b/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOQ.sql
deleted file mode 100644
index c49c4f0f7..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorLOQ.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfoAnnotation WHERE Name = 'LOQ')
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorRSquared.sql b/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorRSquared.sql
deleted file mode 100644
index a392b3fc4..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_IsotopologuePrecursorRSquared.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfoAnnotation WHERE Name = 'RSquared')
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_isotopeDotp.sql b/resources/queries/targetedms/QCMetricEnabled_isotopeDotp.sql
deleted file mode 100644
index 1fbdec14c..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_isotopeDotp.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfo WHERE IsotopeDotp IS NOT NULL)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_lhRatio.sql b/resources/queries/targetedms/QCMetricEnabled_lhRatio.sql
deleted file mode 100644
index dfa290189..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_lhRatio.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorAreaRatio)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_libraryDotp.sql b/resources/queries/targetedms/QCMetricEnabled_libraryDotp.sql
deleted file mode 100644
index 47cb1422f..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_libraryDotp.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.PrecursorChromInfo WHERE LibraryDotp IS NOT NULL)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_massErrorPrecursor.sql b/resources/queries/targetedms/QCMetricEnabled_massErrorPrecursor.sql
deleted file mode 100644
index 4b935593a..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_massErrorPrecursor.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.TransitionChromInfo WHERE MassErrorPPM IS NOT NULL AND TransitionId.Charge IS NULL)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_massErrorTransition.sql b/resources/queries/targetedms/QCMetricEnabled_massErrorTransition.sql
deleted file mode 100644
index 9fa98891e..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_massErrorTransition.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT 1 AS E WHERE EXISTS (SELECT Id FROM targetedms.TransitionChromInfo WHERE MassErrorPPM IS NOT NULL AND TransitionId.Charge IS NOT NULL)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetricEnabled_precursorAndTransitionAreas.sql b/resources/queries/targetedms/QCMetricEnabled_precursorAndTransitionAreas.sql
deleted file mode 100644
index 0705cc577..000000000
--- a/resources/queries/targetedms/QCMetricEnabled_precursorAndTransitionAreas.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2016-2019 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--- We need both transition and precursor areas
-SELECT 1 AS E
-WHERE
- EXISTS (SELECT E FROM QCMetricEnabled_precursorArea)
- AND EXISTS (SELECT E FROM QCMetricEnabled_transitionArea)
diff --git a/resources/queries/targetedms/QCMetric_massErrorTransition.sql b/resources/queries/targetedms/QCMetric_massErrorTransition.sql
index ba627d5ce..20127dc67 100644
--- a/resources/queries/targetedms/QCMetric_massErrorTransition.sql
+++ b/resources/queries/targetedms/QCMetric_massErrorTransition.sql
@@ -18,7 +18,7 @@ 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
@@ -26,3 +26,4 @@ SELECT * FROM (
ORDER BY Area DESC, Id LIMIT 1) AS MetricValue FROM PrecursorChromInfo pci
) X
WHERE MetricValue IS NOT NULL
+AND MetricValue != -100000
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetric_peakArea.sql b/resources/queries/targetedms/QCMetric_peakArea.sql
index f131b6931..0244e9302 100644
--- a/resources/queries/targetedms/QCMetric_peakArea.sql
+++ b/resources/queries/targetedms/QCMetric_peakArea.sql
@@ -17,4 +17,9 @@ SELECT
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalArea AS MetricValue
-FROM PrecursorChromInfo
\ No newline at end of file
+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)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetric_precursorArea.sql b/resources/queries/targetedms/QCMetric_precursorArea.sql
index 008b1c536..38b866020 100644
--- a/resources/queries/targetedms/QCMetric_precursorArea.sql
+++ b/resources/queries/targetedms/QCMetric_precursorArea.sql
@@ -14,7 +14,9 @@
* limitations under the License.
*/
SELECT
- Id AS PrecursorChromInfoId,
- SampleFileId AS SampleFileId,
- TotalPrecursorArea AS MetricValue
-FROM PrecursorChromInfo
\ No newline at end of file
+ Id AS PrecursorChromInfoId,
+ SampleFileId AS SampleFileId,
+ TotalPrecursorArea AS MetricValue
+FROM PrecursorChromInfo
+WHERE
+ EXISTS (SELECT * FROM QCMetricEnabled_precursorArea)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCMetric_transitionArea.sql b/resources/queries/targetedms/QCMetric_transitionArea.sql
index 0629c06ab..9eb7d8d70 100644
--- a/resources/queries/targetedms/QCMetric_transitionArea.sql
+++ b/resources/queries/targetedms/QCMetric_transitionArea.sql
@@ -17,4 +17,6 @@ SELECT
Id AS PrecursorChromInfoId,
SampleFileId AS SampleFileId,
TotalNonPrecursorArea AS MetricValue
-FROM PrecursorChromInfo
\ No newline at end of file
+FROM PrecursorChromInfo
+WHERE
+ EXISTS (SELECT * FROM QCMetricEnabled_transitionArea)
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCRunMetricEnabled_iRTCorrelation.sql b/resources/queries/targetedms/QCRunMetricEnabled_iRTCorrelation.sql
deleted file mode 100644
index 0b3d07909..000000000
--- a/resources/queries/targetedms/QCRunMetricEnabled_iRTCorrelation.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT Id FROM targetedms.SampleFile WHERE IRTCorrelation IS NOT NULL
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCRunMetricEnabled_iRTIntercept.sql b/resources/queries/targetedms/QCRunMetricEnabled_iRTIntercept.sql
deleted file mode 100644
index 0512c072f..000000000
--- a/resources/queries/targetedms/QCRunMetricEnabled_iRTIntercept.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT Id FROM targetedms.SampleFile WHERE IRTIntercept IS NOT NULL
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCRunMetricEnabled_iRTSlope.sql b/resources/queries/targetedms/QCRunMetricEnabled_iRTSlope.sql
deleted file mode 100644
index 9a6aa8440..000000000
--- a/resources/queries/targetedms/QCRunMetricEnabled_iRTSlope.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT Id FROM targetedms.SampleFile WHERE IRTSlope IS NOT NULL
\ No newline at end of file
diff --git a/resources/queries/targetedms/QCRunMetricEnabled_ticArea.sql b/resources/queries/targetedms/QCRunMetricEnabled_ticArea.sql
deleted file mode 100644
index 68a4ebb49..000000000
--- a/resources/queries/targetedms/QCRunMetricEnabled_ticArea.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2019 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-SELECT Id FROM targetedms.SampleFile WHERE TicArea IS NOT NULL
diff --git a/resources/queries/targetedms/qcMetricsConfig.sql b/resources/queries/targetedms/qcMetricsConfig.sql
index 2a4ff616d..d1f1248ef 100644
--- a/resources/queries/targetedms/qcMetricsConfig.sql
+++ b/resources/queries/targetedms/qcMetricsConfig.sql
@@ -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,
diff --git a/resources/schemas/dbscripts/postgresql/targetedms-25.005-25.006.sql b/resources/schemas/dbscripts/postgresql/targetedms-25.005-25.006.sql
new file mode 100644
index 000000000..4e7d0a41d
--- /dev/null
+++ b/resources/schemas/dbscripts/postgresql/targetedms-25.005-25.006.sql
@@ -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;
\ No newline at end of file
diff --git a/resources/schemas/targetedms.xml b/resources/schemas/targetedms.xml
index fac2bdef5..ab3cba8e1 100644
--- a/resources/schemas/targetedms.xml
+++ b/resources/schemas/targetedms.xml
@@ -1349,7 +1349,6 @@
-
@@ -1940,4 +1939,14 @@
+
diff --git a/resources/views/configureQCMetric.html b/resources/views/configureQCMetric.html
index d0880f74f..9a608a2c5 100644
--- a/resources/views/configureQCMetric.html
+++ b/resources/views/configureQCMetric.html
@@ -4,7 +4,8 @@
Loading...
-
+
+