From 08b496fd543b6cf3b564e470d961bf0807800ef0 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 19 Aug 2008 13:34:10 +0000 Subject: [PATCH] fix for arrayoutofbounds bug when secondary structure element extends whole width of alignment (eg. PF00037 stockholm file) --- src/jalview/appletgui/AnnotationPanel.java | 7 +++++-- src/jalview/gui/AnnotationPanel.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index ec5fbd8..909ce78 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -555,7 +555,7 @@ public class AnnotationPanel int lastSSX; int iconOffset = av.charHeight / 2; boolean validRes = false; - + boolean validEnd = false; boolean[] graphGroupDrawn = new boolean[aa.length]; //\u03B2 \u03B1 @@ -765,6 +765,9 @@ public class AnnotationPanel if (column >= row.annotations.length) { column = row.annotations.length - 1; + validEnd = false; + } else { + validEnd = true; } // x ++; @@ -812,7 +815,7 @@ public class AnnotationPanel case 'E': g.setColor(SHEET_COLOUR); - if (row.annotations[endRes] == null + if (!validEnd || row.annotations[endRes] == null || row.annotations[endRes].secondaryStructure != 'E') { g.fillRect(lastSSX, y + 4 + iconOffset, diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 2226e8b..6371e86 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -727,7 +727,7 @@ public class AnnotationPanel int lastSSX; int iconOffset = 0; boolean validRes = false; - + boolean validEnd = false; boolean[] graphGroupDrawn = new boolean[aa.length]; //\u03B2 \u03B1 @@ -980,6 +980,9 @@ public class AnnotationPanel if (column >= row.annotations.length) { column = row.annotations.length - 1; + validEnd = false; + } else { + validEnd = true; } // x ++; @@ -1027,7 +1030,7 @@ public class AnnotationPanel case 'E': g.setColor(SHEET_COLOUR); - if (row.annotations[endRes] == null + if (!validEnd || row.annotations[endRes] == null || row.annotations[endRes].secondaryStructure != 'E') { g.fillRect(lastSSX, y + 4 + iconOffset, -- 1.7.10.2