From abb6a42bd20af71788ee997e352f2cbb7160c940 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 21 Jan 2019 15:32:06 +0000 Subject: [PATCH] JAL-3187 draw complement features on alignment / structure --- .../renderer/seqfeatures/FeatureRenderer.java | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index d833a19..ac8f6d9 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -275,7 +275,8 @@ public class FeatureRenderer extends FeatureRendererModel * if columns are all gapped, or sequence has no features, nothing to do */ Range visiblePositions = seq.findPositions(start+1, end+1); - if (visiblePositions == null || !seq.getFeatures().hasFeatures()) + if (visiblePositions == null || (!seq.getFeatures().hasFeatures() + && !av.isShowComplementFeatures())) { return null; } @@ -396,6 +397,30 @@ public class FeatureRenderer extends FeatureRendererModel } } + /* + * if configured to do so, find and show complement's features + */ + if (av.isShowComplementFeatures()) + { + AlignViewportI comp = av.getCodingComplement(); + FeatureRenderer fr2 = Desktop.getAlignFrameFor(comp) + .getFeatureRenderer(); + for (int pos = visiblePositions.start; pos <= visiblePositions.end; pos++) + { + int column = seq.findIndex(pos); + // TODO ensure these are in complement's render order (last on top) + List features = fr2 + .findComplementFeaturesAtResidue(seq, pos); + for (SequenceFeature sf : features) + { + FeatureColourI fc = fr2.getFeatureStyle(sf.getType()); + Color featureColour = fr2.getColor(sf, fc); + renderFeature(g, seq, column - 1, column - 1, featureColour, + start, end, y1, colourOnly); + } + } + } + if (transparency != 1.0f && g != null) { /* -- 1.7.10.2