From d19a0643d50c405995df23ef9d29f18e0204e87c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 6 Dec 2005 17:14:57 +0000 Subject: [PATCH] Make ImageMap for features as well as groups --- src/jalview/gui/AlignmentPanel.java | 100 ++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 19 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ed00d33..e3bc620 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -809,6 +809,11 @@ public class AlignmentPanel extends GAlignmentPanel int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30; int width = idPanel.getWidth() + (av.alignment.getWidth() * av.charWidth); + if (idPanel.getWidth() == 0) + { + width += calculateIdWidth().getWidth() + 4; + } + if (av.getWrapAlignment()) { height = getWrappedHeight(); @@ -897,45 +902,102 @@ public class AlignmentPanel extends GAlignmentPanel { try { + int s, sSize = av.alignment.getHeight(), + res, alwidth = av.alignment.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("" + ""); - for (int s = 0; s < av.alignment.getHeight(); s++) + for (s = 0; s < sSize; s++) { + sy = s * av.charHeight + scaleHeight; + SequenceI seq = av.alignment.getSequenceAt(s); + java.util.Vector features = seq.getDatasetSequence().getSequenceFeatures(); SequenceGroup[] groups = av.alignment.findAllGroups(seq); - for (int i = 0; i < groups.length; i++) + for(res =0; resres) + text.append("
" + groups[g].getName() + ""); + } - out.println( - "" + groups[i].getName() + - "')\"; onMouseOut=\"toolTip()\"; " - + " href=\"#\">"); + + alIndex + " " + triplet ); + } + fSize = features.size(); + for (f = 0; f < fSize; f++) + { + SequenceFeature sf = (SequenceFeature) features.elementAt(f); + + if ( (sf.getBegin() <= seq.findPosition(res)) && + (sf.getEnd() >= seq.findPosition(res))) + { + if (sf.getType().equals("disulfide bond")) + { + if (sf.getBegin() == seq.findPosition(res) + || sf.getEnd() == seq.findPosition(res)) + { + text.append("
disulfide bond " + sf.getBegin() + ":" + + sf.getEnd()); + } + } + else + { + text.append("
"); + text.append(sf.getType()); + if (sf.getDescription() != null && !sf.getType().equals(sf.getDescription())) + text.append(" " + sf.getDescription()); + + if (sf.getStatus() != null && sf.getStatus().length()>0) + { + text.append(" (" + sf.getStatus() + ")"); + } + } + } + + } + } + if(text.length()>1) + { + text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); + out.println(text.toString()); + } } } - } - out.println("
"); out.close(); -- 1.7.10.2