Skip to content

Easy metrics based on replicate and precursor annotation values#1210

Open
ankurjuneja wants to merge 9 commits into
release26.3-SNAPSHOTfrom
26.3_fb_Item1046
Open

Easy metrics based on replicate and precursor annotation values#1210
ankurjuneja wants to merge 9 commits into
release26.3-SNAPSHOTfrom
26.3_fb_Item1046

Conversation

@ankurjuneja
Copy link
Copy Markdown
Contributor

Rationale

https://github.com/LabKey/internal-issues/issues/1046

Related Pull Requests

Changes

  • Add AnnotationName column to QCMetricConfiguration to store the backing annotation name for annotation-based metrics
  • Extend OutlierGenerator SQL generation to join ReplicateAnnotation (run-scoped) or PrecursorChromInfoAnnotation (precursor-scoped) when a metric has an AnnotationName.
  • Add plain JS/jQuery dialog (AddNewAnnotationMetricWindow.js) for creating and editing annotation-backed metrics.

@ankurjuneja ankurjuneja marked this pull request as ready for review May 18, 2026 20:43
Copy link
Copy Markdown
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor suggestions and a larger request to make one of the other metric dialogs consistent with this new approach.

@@ -0,0 +1 @@
ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN AnnotationName VARCHAR(200);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should match other tables.

Suggested change
ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN AnnotationName VARCHAR(200);
ALTER TABLE targetedms.QCMetricConfiguration ADD COLUMN AnnotationName VARCHAR(255);

});
jQuery('#createNewTraceMetricButton').click(function() {
LABKEY.internal.ConfigureQCMetrics.addNewMetric('trace')
LABKEY.internal.ConfigureQCMetrics.addNewMetric('trace');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a constant here and other places, including for annotation

filterArray.push(LABKEY.Filter.create('id', _config.metric.id, LABKEY.Filter.Types.NOT_EQUAL));
}
LABKEY.Query.selectRows({
containerPath: LABKEY.container.id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this should work in practice, better to use the path.

Suggested change
containerPath: LABKEY.container.id,
containerPath: LABKEY.container.path,

else if (configuration.getAnnotationName() != null)
{
// annotation-backed metrics: escape the annotation name for SQL string literal
String escapedName = configuration.getAnnotationName().replace("'", "''");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the metric name instead of the annotation name.

function getAnnotationTarget() {
return $('input[name="annotationType"]:checked').val() === 'precursor'
? 'precursor_result'
: 'replicate';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the custom query metric dialog and in the table of metrics we use "run" instead of "replicate". I think "replicate" is better. Can you update the other dialog and table to be consistent with the Precursor and Replicate?

const isPrecursor = op === 'update' && metric.PrecursorScoped;
const title = op === 'insert' ? 'Add Annotation-Backed Metric' : 'Edit Annotation-Backed Metric';

return '<div id="' + DIALOG_ID + '" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;">'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat frustratingly inconsistent with the query based custom metric dialog, which has almost identical controls. The fields are in different orders, we use a radio vs a drop-down for replicate vs precursor, and the button layout is different.

While I'd like to refactor all of this into React soon, can you adapt the query metric dialog to use this plain HTML/JS approach too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants