From 457478300feb669620d4d18b8e4ce77ebbfdc4ae Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 21 Oct 2022 16:04:44 +0100 Subject: [PATCH] JAL-4033 - heuristic threshold for pAE matrix - mark any column where pAE values for column+8.. lie outside threshold - definitely better to do a watershed or other type of clustering --- src/jalview/datamodel/ColumnSelection.java | 52 +++++++++++++++++++++------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 309aabf..db83e76 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -566,6 +566,45 @@ public class ColumnSelection // JBPNote - this method needs to be refactored to become independent of // viewmodel package this.clear(); + + if (ann_row.graph == AlignmentAnnotation.CUSTOMRENDERER && (filterParams + .getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD + || filterParams + .getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD)) + { + float tVal = filterParams.getThresholdValue(); + if (ann_row.sequenceRef != null) + { + // TODO - get ContactList from AlignmentView for non-seq-ref associatd + for (int column = 0; column < annotations.length; column++) + { + if (ann_row.annotations[column] == null) + { + continue; + } + + int cpos = ann_row.sequenceRef.findPosition(column) - 1; + ContactListI clist = ann_row.sequenceRef + .getContactListFor(ann_row, cpos); + for (int row = column + 8, + rowEnd = clist.getContactHeight(); row < rowEnd; row++) + { + if (filterParams + .getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD + ? (clist.getContactAt(row) > tVal) + : (clist.getContactAt(row) < tVal)) + { + addElement(column); + break; + // int column_forrowpos = ann_row.sequenceRef.findIndex(row + 1); + // addElement(column_forrowpos); + } + } + } + } + return selection.size(); + } + int addedCount = 0; int column = 0; do @@ -580,19 +619,6 @@ public class ColumnSelection * filter may have multiple conditions - * these are or'd until a match is found */ - if (ann_row.graph == AlignmentAnnotation.CUSTOMRENDERER) - { - if (ann_row.sequenceRef != null) - { - int cpos = ann_row.sequenceRef.findPosition(column) - 1; - ContactListI clist = ann_row.sequenceRef - .getContactListFor(ann_row, cpos); - ContactRange crange = clist.getRangeFor(0, - clist.getContactHeight()); - value = (float) crange.getMean(); - } - } - if (filterParams .getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD && value > filterParams.getThresholdValue()) -- 1.7.10.2