From 3d7da9caa8446fc497d10d53f5e9a599f556e2ad Mon Sep 17 00:00:00 2001 From: Cristian Goina Date: Tue, 3 Sep 2024 13:58:04 -0400 Subject: [PATCH] use objective too when matching published images --- .../janelia/colormipsearch/model/PublishedLMImageFields.java | 4 ++++ .../janelia/colormipsearch/cmd/jacsdata/ColorDepthMIP.java | 4 ++++ .../colormipsearch/cmd/jacsdata/PublishedDataGetter.java | 1 + 3 files changed, 9 insertions(+) diff --git a/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/PublishedLMImageFields.java b/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/PublishedLMImageFields.java index 8b068b73..ec670697 100644 --- a/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/PublishedLMImageFields.java +++ b/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/PublishedLMImageFields.java @@ -87,6 +87,10 @@ public void setObjective(String objective) { this.objective = objective; } + public boolean hasObjective() { + return StringUtils.isNotBlank(objective); + } + public String getAlignmentSpace() { return alignmentSpace; } diff --git a/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/ColorDepthMIP.java b/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/ColorDepthMIP.java index 9706a437..fb46c4b7 100644 --- a/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/ColorDepthMIP.java +++ b/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/ColorDepthMIP.java @@ -104,6 +104,10 @@ public String lmObjective() { return objective; } + public boolean hasLmObjective() { + return StringUtils.isNotBlank(objective); + } + public boolean lmIsNotStaged() { if (sample == null) { // really cannot tell if the sample has been published to staging diff --git a/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/PublishedDataGetter.java b/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/PublishedDataGetter.java index c9bf5742..e9de4d11 100644 --- a/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/PublishedDataGetter.java +++ b/colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/jacsdata/PublishedDataGetter.java @@ -81,6 +81,7 @@ private PublishedLMImage findPublishedImage(ColorDepthMIP colorDepthMIP, List pi.getAlignmentSpace().equals(colorDepthMIP.alignmentSpace) || (CollectionUtils.isNotEmpty(aliasesForAlignmentSpace) && aliasesForAlignmentSpace.contains(pi.getAlignmentSpace()))) + .filter(pi -> !pi.hasObjective() || !colorDepthMIP.hasLmObjective() || pi.getObjective().equals(colorDepthMIP.objective)) .findFirst() .orElseGet(() -> { LOG.warn("No published image found for {}:sample={}:as={}",