package jalview.renderer.seqfeatures;
import jalview.api.AlignViewportI;
+import jalview.datamodel.Range;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
return null;
}
- SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
-
- if (sequenceFeatures == null || sequenceFeatures.length == 0)
- {
- return null;
- }
-
if (Comparison.isGap(seq.getCharAt(column)))
{
return Color.white;
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;
}
transparency));
}
- int startPos = seq.findPosition(start);
- int endPos = seq.findPosition(end);
+ /*
+ * get range of sequence positions within column range
+ */
+ Range seqRange = seq.findPositions(start, end);
+ if (seqRange == null)
+ {
+ return null;
+ }
Color drawnColour = null;
continue;
}
- List<SequenceFeature> overlaps = seq.findFeatures(type, startPos, endPos);
+ List<SequenceFeature> overlaps = seq.findFeatures(seqRange.start,
+ seqRange.end, type);
for (SequenceFeature sequenceFeature : overlaps)
{
/*
Color featureColour = getColour(sequenceFeature);
boolean isContactFeature = sequenceFeature.isContactFeature();
+ // todo overload findIndex using Location data
+ int featureStartCol = seq.findIndex(sequenceFeature.begin);
+ int featureEndCol = seq.findIndex(sequenceFeature.end);
if (isContactFeature)
{
boolean drawn = renderFeature(g, seq,
- seq.findIndex(sequenceFeature.begin) - 1,
- seq.findIndex(sequenceFeature.begin) - 1, featureColour,
+ featureStartCol - 1,
+ featureStartCol - 1, featureColour,
start, end, y1, colourOnly);
drawn |= renderFeature(g, seq,
- seq.findIndex(sequenceFeature.end) - 1,
- seq.findIndex(sequenceFeature.end) - 1, featureColour,
+ featureEndCol - 1,
+ featureEndCol - 1, featureColour,
start, end, y1, colourOnly);
if (drawn)
{
{
*/
boolean drawn = renderFeature(g, seq,
- seq.findIndex(sequenceFeature.begin) - 1,
- seq.findIndex(sequenceFeature.end) - 1, featureColour,
+ featureStartCol - 1,
+ featureEndCol - 1, featureColour,
start, end, y1, colourOnly);
if (drawn)
{
}
/**
- * Answers true if the feature belongs to a feature group which is not
- * currently displayed, else false
- *
- * @param sequenceFeature
- * @return
- */
- protected boolean featureGroupNotShown(
- final SequenceFeature sequenceFeature)
- {
- return featureGroups != null
- && sequenceFeature.featureGroup != null
- && sequenceFeature.featureGroup.length() != 0
- && featureGroups.containsKey(sequenceFeature.featureGroup)
- && !featureGroups.get(sequenceFeature.featureGroup)
- .booleanValue();
- }
-
- /**
* Called when alignment in associated view has new/modified features to
* discover and display.
*
continue;
}
- List<SequenceFeature> overlaps = seq.findFeatures(type, pos, pos);
+ List<SequenceFeature> overlaps = seq.findFeatures(pos, pos, type);
for (SequenceFeature sequenceFeature : overlaps)
{
if (!featureGroupNotShown(sequenceFeature))