From 7b2f004da1302ca4cb155c7470c0fe47f6bb2a49 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 17 Nov 2016 11:05:43 +0000 Subject: [PATCH] JAL-2327 disulfide bond abstracted to SequenceFeature.isContactFeature --- src/jalview/gui/AlignmentPanel.java | 52 ++++++++++---------- src/jalview/io/SequenceAnnotationReport.java | 5 +- .../renderer/seqfeatures/FeatureRenderer.java | 7 +-- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 9f1162f..687361d 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1315,8 +1315,8 @@ public class AlignmentPanel extends GAlignmentPanel implements if (onscreen || (idwidth = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null) { - return (getIdPanel().getWidth() > 0 ? getIdPanel().getWidth() - : calculateIdWidth().width + 4); + int w = getIdPanel().getWidth(); + return (w > 0 ? w : calculateIdWidth().width + 4); } return idwidth.intValue() + 4; } @@ -1463,7 +1463,7 @@ public class AlignmentPanel extends GAlignmentPanel implements public void makePNGImageMap(File imgMapFile, String imageName) { - // /////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS + // /////ONLY WORKS WITH NON WRAPPED ALIGNMENTS // //////////////////////////////////////////// int idWidth = getVisibleIdWidth(false); FontMetrics fm = getFontMetrics(av.getFont()); @@ -1477,7 +1477,6 @@ public class AlignmentPanel extends GAlignmentPanel implements { int s, sSize = av.getAlignment().getHeight(), res, alwidth = av .getAlignment().getWidth(), g, gSize, f, fSize, sy; - StringBuffer text = new StringBuffer(); PrintWriter out = new PrintWriter(new FileWriter(imgMapFile)); out.println(jalview.io.HTMLOutput.getImageMapHTML()); out.println(" res) { - text.append("
" + groups[g].getName() + ""); + text.append("
").append(groups[g].getName()) + .append(""); } } @@ -1536,12 +1537,13 @@ public class AlignmentPanel extends GAlignmentPanel implements { if (text.length() < 1) { - text.append("= seq.findPosition(res))) { - if (features[f].getType().equals("disulfide bond")) + if (features[f].isContactFeature()) { if (features[f].getBegin() == seq.findPosition(res) || features[f].getEnd() == seq .findPosition(res)) { - text.append("
disulfide bond " - + features[f].getBegin() + ":" - + features[f].getEnd()); + text.append("
").append(features[f].getType()) + .append(" ").append(features[f].getBegin()) + .append(":").append(features[f].getEnd()); } } else @@ -1569,13 +1571,13 @@ public class AlignmentPanel extends GAlignmentPanel implements && !features[f].getType().equals( features[f].getDescription())) { - text.append(" " + features[f].getDescription()); + text.append(" ").append(features[f].getDescription()); } if (features[f].getValue("status") != null) { - text.append(" (" + features[f].getValue("status") - + ")"); + text.append(" (").append(features[f].getValue("status")) + .append(")"); } } } diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 89f1068..702a107 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -79,7 +79,7 @@ public class SequenceAnnotationReport void appendFeature(final StringBuffer sb, int rpos, Map minmax, SequenceFeature feature) { - if ("disulfide bond".equals(feature.getType())) + if (feature.isContactFeature()) { if (feature.getBegin() == rpos || feature.getEnd() == rpos) { @@ -87,7 +87,8 @@ public class SequenceAnnotationReport { sb.append("
"); } - sb.append("disulfide bond ").append(feature.getBegin()).append(":") + sb.append(feature.getType()).append(" ").append(feature.getBegin()) + .append(":") .append(feature.getEnd()); } } diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index 07d97d0..1ccb673 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -365,7 +365,8 @@ public class FeatureRenderer extends FeatureRendererModel } Color featureColour = getColour(sequenceFeature); - boolean isDisulfideBond = "disulfide bond".equals(sequenceFeature.type); + boolean isContactFeature = sequenceFeature.isContactFeature(); + if (offscreenRender && offscreenImage == null) { /* @@ -375,7 +376,7 @@ public class FeatureRenderer extends FeatureRendererModel */ boolean featureIsAtPosition = sequenceFeature.begin <= start && sequenceFeature.end >= start; - if (isDisulfideBond) + if (isContactFeature) { featureIsAtPosition = sequenceFeature.begin == start || sequenceFeature.end == start; @@ -392,7 +393,7 @@ public class FeatureRenderer extends FeatureRendererModel } } - else if (isDisulfideBond) + else if (isContactFeature) { renderFeature(g, seq, seq.findIndex(sequenceFeature.begin) - 1, seq.findIndex(sequenceFeature.begin) - 1, featureColour, -- 1.7.10.2