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
13 changes: 13 additions & 0 deletions resources/queries/protein/Sequences.query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="Sequences" tableDbType="TABLE">
<columns>
<column columnName="ProtSequence">
<displayWidth>200</displayWidth>
</column>
</columns>
</table>
</tables>
</metadata>
</query>
16 changes: 16 additions & 0 deletions resources/queries/targetedms/Protein/.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
label="Proteins" canOverride="true">
<columns>
<column name="Label" />
<column name="Description" />
<column name="Accession" />
<column name="PreferredName" />
<column name="Gene" />
<column name="Species" />

<column name="SequenceId/ProtSequence" />
<column name="Note" />

</columns>

</customView>
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,34 @@
ALTER TABLE targetedms.Runs ADD COLUMN ProteinCount INT;

UPDATE targetedms.Runs r
SET ProteinCount = (
SELECT COUNT(*)
FROM targetedms.Protein p
JOIN targetedms.PeptideGroup pg ON p.PeptideGroupId = pg.Id
WHERE pg.RunId = r.Id
);

-- Redefine PeptideGroupCount: groups containing at least one peptide
UPDATE targetedms.Runs r
SET PeptideGroupCount = (
SELECT COUNT(DISTINCT pg.Id)
FROM targetedms.PeptideGroup pg
JOIN targetedms.GeneralMolecule gm ON gm.PeptideGroupId = pg.Id
JOIN targetedms.Peptide p ON p.Id = gm.Id
WHERE pg.RunId = r.Id
);

ALTER TABLE targetedms.Runs ADD COLUMN MoleculeGroupCount INT;

UPDATE targetedms.Runs r
SET MoleculeGroupCount = (
SELECT COUNT(DISTINCT pg.Id)
FROM targetedms.PeptideGroup pg
JOIN targetedms.GeneralMolecule gm ON gm.PeptideGroupId = pg.Id
JOIN targetedms.Molecule m ON m.Id = gm.Id
WHERE pg.RunId = r.Id
);

ALTER TABLE targetedms.Runs ALTER COLUMN MoleculeGroupCount SET NOT NULL;
ALTER TABLE targetedms.Runs ALTER COLUMN PeptideGroupCount SET NOT NULL;
ALTER TABLE targetedms.Runs ALTER COLUMN ProteinCount SET NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN AnnotationName VARCHAR(255);
15 changes: 12 additions & 3 deletions resources/schemas/targetedms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,23 @@
<column columnName="DocumentGUID"/>
<column columnName="PeptideGroupCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showPeptideGroupList.view?id=${Id}</url>
</column>
<column columnName="MoleculeGroupCount">
<formatString>#,###</formatString>
<url>/targetedms-showMoleculeGroupList.view?id=${Id}</url>
</column>
<column columnName="ProteinCount">
<formatString>#,###</formatString>
<url>/targetedms-showProteinList.view?id=${Id}</url>
</column>
<column columnName="PeptideCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showPeptideList.view?id=${Id}</url>
</column>
<column columnName="SmallMoleculeCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showMoleculeList.view?id=${Id}</url>
</column>
<column columnName="PrecursorCount">
<formatString>#,###</formatString>
Expand Down Expand Up @@ -1358,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