From: gmungoc Date: Wed, 31 May 2017 09:59:58 +0000 (+0100) Subject: JAL-2574 preparation for Sequence.findFeatures(col1, col2) X-Git-Tag: Release_2_10_3b1~221 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=93cdde7955263e9c0fc81621d73cd3157c02b944;p=jalview.git JAL-2574 preparation for Sequence.findFeatures(col1, col2) --- diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index e7733e9..bddf6e3 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -760,8 +760,8 @@ public class AlignmentSorter int endResidue = seqs[i].findPosition(endCol); String[] types = featureTypes == null ? null : featureTypes .toArray(new String[featureTypes.size()]); - List sfs = seqs[i].getFeatures().findFeatures( - startResidue, endResidue, types); + List sfs = seqs[i].findFeatures(startResidue, + endResidue, types); seqScores[i] = 0; scores[i] = 0.0; diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index d1d61d2..33683fd 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -242,8 +242,7 @@ public class AlignViewController implements AlignViewControllerI { int ist = sq.findPosition(sqcol.getStartRes()); int iend = sq.findPosition(sqcol.getEndRes()); // see JAL-2526 - List sfs = sq.getFeatures().findFeatures(ist, - iend, featureType); + List sfs = sq.findFeatures(ist, iend, featureType); boolean overlap = false; for (SequenceFeature sf : sfs) { diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index f3e2733..f32dd7b 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1507,8 +1507,8 @@ public class AlignmentPanel extends GAlignmentPanel implements } if (!Comparison.isGap(seq.getCharAt(res))) { - List features = seq.getFeatures() - .findFeatures(seqPos, seqPos); + List features = seq.findFeatures(seqPos, + seqPos); for (SequenceFeature sf : features) { if (sf.isContactFeature()) diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index 5dce2b8..950d0cd 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -302,23 +302,23 @@ public class FeatureRenderer extends FeatureRendererModel List overlaps = seq.findFeatures(seqRange.start, seqRange.end, type); - for (SequenceFeature sequenceFeature : overlaps) + for (SequenceFeature sf : overlaps) { /* * a feature type may be flagged as shown but the group * an instance of it belongs to may be hidden */ - if (featureGroupNotShown(sequenceFeature)) + if (featureGroupNotShown(sf)) { continue; } - Color featureColour = getColour(sequenceFeature); - boolean isContactFeature = sequenceFeature.isContactFeature(); + Color featureColour = getColour(sf); + boolean isContactFeature = sf.isContactFeature(); - // todo overload findIndex using Location data - int featureStartCol = seq.findIndex(sequenceFeature.begin); - int featureEndCol = seq.findIndex(sequenceFeature.end); + int featureStartCol = seq.findIndex(sf.begin); + int featureEndCol = sf.begin == sf.end ? featureStartCol : seq + .findIndex(sf.end); if (isContactFeature) { boolean drawn = renderFeature(g, seq, @@ -334,7 +334,7 @@ public class FeatureRenderer extends FeatureRendererModel drawnColour = featureColour; } } - else if (showFeature(sequenceFeature)) + else if (showFeature(sf)) { /* * showing feature score by height of colour diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index a8e8989..eb47a80 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -280,8 +280,8 @@ public abstract class FeatureRendererModel implements * include features at the position provided their feature type is * displayed, and feature group is null or marked for display */ - List features = sequence.getFeatures().findFeatures( - res, res, visibleTypes); + List features = sequence.findFeatures(res, res, + visibleTypes); for (SequenceFeature sf : features) {