From 9ccd0ca3146f4b7fe41b7d7bc307501d2ccd9a31 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 12 May 2017 14:32:33 +0100 Subject: [PATCH] JAL-2480 efficient test for features present on sequence --- src/jalview/gui/SequenceFetcher.java | 10 +++------- src/jalview/renderer/seqfeatures/FeatureRenderer.java | 12 ++---------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index bf0ab70..da026b5 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -1006,15 +1006,11 @@ public class SequenceFetcher extends JPanel implements Runnable { for (SequenceI sq : alsqs) { - if ((sfs = sq.getSequenceFeatures()) != null) + if (sq.getFeatures().hasFeatures()) { - if (sfs.length > 0) - { - af.setShowSeqFeatures(true); - break; - } + af.setShowSeqFeatures(true); + break; } - } } diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index f4648c4..d6be4c2 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -215,13 +215,6 @@ public class FeatureRenderer extends FeatureRendererModel return null; } - SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures(); - - if (sequenceFeatures == null || sequenceFeatures.length == 0) - { - return null; - } - if (Comparison.isGap(seq.getCharAt(column))) { return Color.white; @@ -270,8 +263,7 @@ public class FeatureRenderer extends FeatureRendererModel final SequenceI seq, int start, int end, int y1, boolean colourOnly) { - SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures(); - if (sequenceFeatures == null || sequenceFeatures.length == 0) + if (!seq.getFeatures().hasFeatures()) { return null; } @@ -286,7 +278,7 @@ public class FeatureRenderer extends FeatureRendererModel } int startPos = seq.findPosition(start); - int endPos = seq.findPosition(end); + int endPos = seq.findPosition(end);// todo a performant overload of this! Color drawnColour = null; -- 1.7.10.2