X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FSequenceAnnotationReport.java;h=dd0664b1e0396964edb3637c55aebe74a8058f07;hb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;hp=9c42c9e31610a21ecac7de66d135b00e9e74429a;hpb=a8f483d04205bb8273ee311c12968b7e86d205fa;p=jalview.git
diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java
index 9c42c9e..dd0664b 100644
--- a/src/jalview/io/SequenceAnnotationReport.java
+++ b/src/jalview/io/SequenceAnnotationReport.java
@@ -1,32 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Vector;
-
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.io.gff.GffConstants;
+import jalview.util.DBRefUtils;
import jalview.util.UrlLink;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
/**
* generate HTML reports for a sequence
*
@@ -42,167 +46,187 @@ public class SequenceAnnotationReport
}
/**
- * appends the features at rpos to the given stringbuffer ready for display in
- * a tooltip
+ * Append text for the list of features to the tooltip
*
* @param tooltipText2
- * @param linkImageURL
* @param rpos
* @param features
- * TODO refactor to Jalview 'utilities' somehow.
+ * @param minmax
*/
public void appendFeatures(final StringBuffer tooltipText2, int rpos,
- SequenceFeature[] features)
+ List features, Map minmax)
{
- appendFeatures(tooltipText2, rpos, features, null);
+ if (features != null)
+ {
+ for (SequenceFeature feature : features)
+ {
+ appendFeature(tooltipText2, rpos, minmax, feature);
+ }
+ }
}
- public void appendFeatures(final StringBuffer tooltipText2, int rpos,
- SequenceFeature[] features, Hashtable minmax)
+ /**
+ * Appends text for one sequence feature to the string buffer
+ *
+ * @param sb
+ * @param rpos
+ * @param minmax
+ * {{min, max}, {min, max}} positional and non-positional feature
+ * scores for this type
+ * @param feature
+ */
+ void appendFeature(final StringBuffer sb, int rpos,
+ Map minmax, SequenceFeature feature)
{
- String tmpString;
- if (features != null)
+ if ("disulfide bond".equals(feature.getType()))
{
- for (int i = 0; i < features.length; i++)
+ if (feature.getBegin() == rpos || feature.getEnd() == rpos)
{
- if (features[i].getType().equals("disulfide bond"))
+ if (sb.length() > 6)
{
- if (features[i].getBegin() == rpos
- || features[i].getEnd() == rpos)
- {
- if (tooltipText2.length() > 6)
- {
- tooltipText2.append("
");
- }
- tooltipText2.append("disulfide bond " + features[i].getBegin()
- + ":" + features[i].getEnd());
- }
+ sb.append("
");
+ }
+ sb.append("disulfide bond ").append(feature.getBegin()).append(":")
+ .append(feature.getEnd());
+ }
+ }
+ else
+ {
+ if (sb.length() > 6)
+ {
+ sb.append("
");
+ }
+ // TODO: remove this hack to display link only features
+ boolean linkOnly = feature.getValue("linkonly") != null;
+ if (!linkOnly)
+ {
+ sb.append(feature.getType()).append(" ");
+ if (rpos != 0)
+ {
+ // we are marking a positional feature
+ sb.append(feature.begin);
+ }
+ if (feature.begin != feature.end)
+ {
+ sb.append(" " + feature.end);
}
- else
+
+ if (feature.getDescription() != null
+ && !feature.description.equals(feature.getType()))
{
- if (tooltipText2.length() > 6)
+ String tmpString = feature.getDescription();
+ String tmp2up = tmpString.toUpperCase();
+ final int startTag = tmp2up.indexOf("");
+ if (startTag > -1)
{
- tooltipText2.append("
");
+ tmpString = tmpString.substring(startTag + 6);
+ tmp2up = tmp2up.substring(startTag + 6);
}
- // TODO: remove this hack to display link only features
- boolean linkOnly = features[i].getValue("linkonly") != null;
- if (!linkOnly)
+ // TODO strips off but not - is that intended?
+ int endTag = tmp2up.indexOf("");
+ if (endTag > -1)
{
- tooltipText2.append(features[i].getType() + " ");
- if (rpos != 0)
- {
- // we are marking a positional feature
- tooltipText2.append(features[i].begin);
- }
- if (features[i].begin != features[i].end)
- {
- tooltipText2.append(" " + features[i].end);
- }
-
- if (features[i].getDescription() != null
- && !features[i].description.equals(features[i]
- .getType()))
- {
- tmpString = features[i].getDescription();
- String tmp2up = tmpString.toUpperCase();
- int startTag = tmp2up.indexOf("");
- if (startTag > -1)
- {
- tmpString = tmpString.substring(startTag + 6);
- tmp2up = tmp2up.substring(startTag + 6);
- }
- int endTag = tmp2up.indexOf("");
- if (endTag > -1)
- {
- tmpString = tmpString.substring(0, endTag);
- tmp2up = tmp2up.substring(0, endTag);
- }
- endTag = tmp2up.indexOf("