X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FSequenceAnnotationReport.java;h=6d8ce5f9daeca0021b745e8fec3696c0b2ae15bd;hb=d131f05c68757d57e5e4a1f440196ae1b70f3b8a;hp=6fba9c62ef64e28b902b8954f25b7d65d4d509c4;hpb=47168f025aefdaa044802bd5f8f510ffe43a4808;p=jalview.git diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 6fba9c6..6d8ce5f 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -1,6 +1,6 @@ /* - * 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-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,15 +20,17 @@ */ 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.util.UrlLink; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + + /** * generate HTML reports for a sequence * @@ -54,30 +56,30 @@ public class SequenceAnnotationReport * TODO refactor to Jalview 'utilities' somehow. */ public void appendFeatures(final StringBuffer tooltipText2, int rpos, - SequenceFeature[] features) + List features) { appendFeatures(tooltipText2, rpos, features, null); } public void appendFeatures(final StringBuffer tooltipText2, int rpos, - SequenceFeature[] features, Hashtable minmax) + List features, Hashtable minmax) { String tmpString; if (features != null) { - for (int i = 0; i < features.length; i++) + for (SequenceFeature feature:features) { - if (features[i].getType().equals("disulfide bond")) + if (feature.getType().equals("disulfide bond")) { - if (features[i].getBegin() == rpos - || features[i].getEnd() == rpos) + if (feature.getBegin() == rpos + || feature.getEnd() == rpos) { if (tooltipText2.length() > 6) { tooltipText2.append("
"); } - tooltipText2.append("disulfide bond " + features[i].getBegin() - + ":" + features[i].getEnd()); + tooltipText2.append("disulfide bond " + feature.getBegin() + + ":" + feature.getEnd()); } } else @@ -87,25 +89,25 @@ public class SequenceAnnotationReport tooltipText2.append("
"); } // TODO: remove this hack to display link only features - boolean linkOnly = features[i].getValue("linkonly") != null; + boolean linkOnly = feature.getValue("linkonly") != null; if (!linkOnly) { - tooltipText2.append(features[i].getType() + " "); + tooltipText2.append(feature.getType() + " "); if (rpos != 0) { // we are marking a positional feature - tooltipText2.append(features[i].begin); + tooltipText2.append(feature.begin); } - if (features[i].begin != features[i].end) + if (feature.begin != feature.end) { - tooltipText2.append(" " + features[i].end); + tooltipText2.append(" " + feature.end); } - if (features[i].getDescription() != null - && !features[i].description.equals(features[i] + if (feature.getDescription() != null + && !feature.description.equals(feature .getType())) { - tmpString = features[i].getDescription(); + tmpString = feature.getDescription(); String tmp2up = tmpString.toUpperCase(); int startTag = tmp2up.indexOf(""); if (startTag > -1) @@ -150,27 +152,27 @@ public class SequenceAnnotationReport } } // check score should be shown - if (features[i].getScore() != Float.NaN) + if (!Float.isNaN(feature.getScore())) { float[][] rng = (minmax == null) ? null : ((float[][]) minmax - .get(features[i].getType())); + .get(feature.getType())); if (rng != null && rng[0] != null && rng[0][0] != rng[0][1]) { - tooltipText2.append(" Score=" + features[i].getScore()); + tooltipText2.append(" Score=" + feature.getScore()); } } - if (features[i].getValue("status") != null) + if (feature.getValue("status") != null) { - String status = features[i].getValue("status").toString(); + String status = feature.getValue("status").toString(); if (status.length() > 0) { - tooltipText2.append("; (" + features[i].getValue("status") + tooltipText2.append("; (" + feature.getValue("status") + ")"); } } } } - if (features[i].links != null) + if (feature.links != null) { if (linkImageURL != null) { @@ -178,7 +180,7 @@ public class SequenceAnnotationReport } else { - for (String urlstring : (Vector) features[i].links) + for (String urlstring : feature.links) { try { @@ -363,8 +365,7 @@ public class SequenceAnnotationReport } // ADD NON POSITIONAL SEQUENCE INFO - SequenceFeature[] features = ds.getSequenceFeatures(); - SequenceFeature[] tfeat = new SequenceFeature[1]; + SequenceFeature[] features = sequence.getSequenceFeatures(); if (showNpFeats && features != null) { for (int i = 0; i < features.length; i++) @@ -372,7 +373,8 @@ public class SequenceAnnotationReport if (features[i].begin == 0 && features[i].end == 0) { int sz = -tip.length(); - tfeat[0] = features[i]; + List tfeat = new ArrayList(); + tfeat.add(features[i]); appendFeatures(tip, 0, tfeat, minmax); sz += tip.length(); maxWidth = Math.max(maxWidth, sz);