From e276157fe1ba0055652596f3e5e2f8a6968e8239 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Thu, 21 Jan 2016 17:00:16 +0000 Subject: [PATCH] JAL-1479 JAL-1979 bugfix to check entire annotation property of a resDetail object for NOT_OBSERVED rather than just the topmost value. Intially thought the multiplicity was 0..1 rather than 0..* which it turned out to be following the N2NScan test --- src/jalview/ws/sifts/SiftsClient.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index 9f7bc52..5b03ddb 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -630,16 +630,18 @@ public class SiftsClient implements SiftsClientI */ private boolean isResidueObserved(Residue residue) { - String annotation = getResidueAnnotaiton(residue, + HashSet annotations = getResidueAnnotaitons(residue, ResidueDetailType.ANNOTATION); - if (annotation == null) + if (annotations == null || annotations.isEmpty()) { return true; } - if (!annotation.equalsIgnoreCase(NOT_FOUND) - && annotation.equalsIgnoreCase(NOT_OBSERVED)) + for (String annotation : annotations) { - return false; + if (annotation.equalsIgnoreCase(NOT_OBSERVED)) + { + return false; + } } return true; } @@ -651,18 +653,19 @@ public class SiftsClient implements SiftsClientI * @param type * @return */ - private String getResidueAnnotaiton(Residue residue, + private HashSet getResidueAnnotaitons(Residue residue, ResidueDetailType type) { + HashSet foundAnnotations = new HashSet(); List resDetails = residue.getResidueDetail(); for (ResidueDetail resDetail : resDetails) { if (resDetail.getProperty().equalsIgnoreCase(type.getCode())) { - return resDetail.getContent(); + foundAnnotations.add(resDetail.getContent()); } } - return NOT_FOUND; + return foundAnnotations; } @Override -- 1.7.10.2