git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2015 JAL-1956 rollout of FeatureColourI in place of
[jalview.git]
/
src
/
jalview
/
io
/
SequenceAnnotationReport.java
diff --git
a/src/jalview/io/SequenceAnnotationReport.java
b/src/jalview/io/SequenceAnnotationReport.java
index
6fba9c6
..
6573a7f
100644
(file)
--- 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.
*
*
* This file is part of Jalview.
*
@@
-20,15
+20,15
@@
*/
package jalview.io;
*/
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 jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.util.UrlLink;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
/**
* generate HTML reports for a sequence
*
/**
* generate HTML reports for a sequence
*
@@
-54,30
+54,29
@@
public class SequenceAnnotationReport
* TODO refactor to Jalview 'utilities' somehow.
*/
public void appendFeatures(final StringBuffer tooltipText2, int rpos,
* TODO refactor to Jalview 'utilities' somehow.
*/
public void appendFeatures(final StringBuffer tooltipText2, int rpos,
- SequenceFeature[] features)
+ List<SequenceFeature> features)
{
appendFeatures(tooltipText2, rpos, features, null);
}
public void appendFeatures(final StringBuffer tooltipText2, int rpos,
{
appendFeatures(tooltipText2, rpos, features, null);
}
public void appendFeatures(final StringBuffer tooltipText2, int rpos,
- SequenceFeature[] features, Hashtable minmax)
+ List<SequenceFeature> features, Map<String, float[][]> map)
{
String tmpString;
if (features != null)
{
{
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("<br>");
}
{
if (tooltipText2.length() > 6)
{
tooltipText2.append("<br>");
}
- tooltipText2.append("disulfide bond " + features[i].getBegin()
- + ":" + features[i].getEnd());
+ tooltipText2.append("disulfide bond " + feature.getBegin()
+ + ":" + feature.getEnd());
}
}
else
}
}
else
@@
-87,25
+86,24
@@
public class SequenceAnnotationReport
tooltipText2.append("<br>");
}
// TODO: remove this hack to display link only features
tooltipText2.append("<br>");
}
// TODO: remove this hack to display link only features
- boolean linkOnly = features[i].getValue("linkonly") != null;
+ boolean linkOnly = feature.getValue("linkonly") != null;
if (!linkOnly)
{
if (!linkOnly)
{
- tooltipText2.append(features[i].getType() + " ");
+ tooltipText2.append(feature.getType() + " ");
if (rpos != 0)
{
// we are marking a positional feature
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]
- .getType()))
+ if (feature.getDescription() != null
+ && !feature.description.equals(feature.getType()))
{
{
- tmpString = features[i].getDescription();
+ tmpString = feature.getDescription();
String tmp2up = tmpString.toUpperCase();
int startTag = tmp2up.indexOf("<HTML>");
if (startTag > -1)
String tmp2up = tmpString.toUpperCase();
int startTag = tmp2up.indexOf("<HTML>");
if (startTag > -1)
@@
-150,27
+148,27
@@
public class SequenceAnnotationReport
}
}
// check score should be shown
}
}
// 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()));
+ float[][] rng = (map == null) ? null : (map.get(feature
+ .getType()));
if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
{
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)
{
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)
{
{
if (linkImageURL != null)
{
@@
-178,7
+176,7
@@
public class SequenceAnnotationReport
}
else
{
}
else
{
- for (String urlstring : (Vector<String>) features[i].links)
+ for (String urlstring : feature.links)
{
try
{
{
try
{
@@
-232,9
+230,8
@@
public class SequenceAnnotationReport
{
// collect matching db-refs
{
// collect matching db-refs
- DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(seq.getDBRef(),
- new String[]
- { target });
+ DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(seq.getDBRefs(),
+ new String[] { target });
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
@@
-261,8
+258,8
@@
public class SequenceAnnotationReport
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- urlSets.add(new String[]
- { target, label, urls[u], urls[u + 1] });
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
uniques.add(unq);
}
}
uniques.add(unq);
}
}
@@
-280,8
+277,8
@@
public class SequenceAnnotationReport
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- urlSets.add(new String[]
- { target, label, urls[u], urls[u + 1] });
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
uniques.add(unq);
}
}
uniques.add(unq);
}
}
@@
-298,8
+295,8
@@
public class SequenceAnnotationReport
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- urlSets.add(new String[]
- { target, label, urls[u], urls[u + 1] });
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
uniques.add(unq);
}
}
uniques.add(unq);
}
}
@@
-314,18
+311,17
@@
public class SequenceAnnotationReport
{
uniques.add(unq);
// Add a non-dynamic link
{
uniques.add(unq);
// Add a non-dynamic link
- urlSets.add(new String[]
- { target, label, null, urlLink.getUrl_prefix() });
+ urlSets.add(new String[] { target, label, null,
+ urlLink.getUrl_prefix() });
}
}
}
}
- return urlSets.toArray(new String[][]
- {});
+ return urlSets.toArray(new String[][] {});
}
public void createSequenceAnnotationReport(final StringBuffer tip,
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
}
public void createSequenceAnnotationReport(final StringBuffer tip,
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
- Hashtable minmax)
+ Map<String, float[][]> minmax)
{
createSequenceAnnotationReport(tip, sequence, showDbRefs, showNpFeats,
true, minmax);
{
createSequenceAnnotationReport(tip, sequence, showDbRefs, showNpFeats,
true, minmax);
@@
-333,7
+329,7
@@
public class SequenceAnnotationReport
public void createSequenceAnnotationReport(final StringBuffer tip,
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
public void createSequenceAnnotationReport(final StringBuffer tip,
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
- boolean tableWrap, Hashtable minmax)
+ boolean tableWrap, Map<String, float[][]> map)
{
String tmp;
tip.append("<i>");
{
String tmp;
tip.append("<i>");
@@
-350,7
+346,7
@@
public class SequenceAnnotationReport
{
ds = ds.getDatasetSequence();
}
{
ds = ds.getDatasetSequence();
}
- DBRefEntry[] dbrefs = ds.getDBRef();
+ DBRefEntry[] dbrefs = ds.getDBRefs();
if (showDbRefs && dbrefs != null)
{
for (int i = 0; i < dbrefs.length; i++)
if (showDbRefs && dbrefs != null)
{
for (int i = 0; i < dbrefs.length; i++)
@@
-363,8
+359,7
@@
public class SequenceAnnotationReport
}
// ADD NON POSITIONAL SEQUENCE INFO
}
// 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++)
if (showNpFeats && features != null)
{
for (int i = 0; i < features.length; i++)
@@
-372,8
+367,9
@@
public class SequenceAnnotationReport
if (features[i].begin == 0 && features[i].end == 0)
{
int sz = -tip.length();
if (features[i].begin == 0 && features[i].end == 0)
{
int sz = -tip.length();
- tfeat[0] = features[i];
- appendFeatures(tip, 0, tfeat, minmax);
+ List<SequenceFeature> tfeat = new ArrayList<SequenceFeature>();
+ tfeat.add(features[i]);
+ appendFeatures(tip, 0, tfeat, map);
sz += tip.length();
maxWidth = Math.max(maxWidth, sz);
}
sz += tip.length();
maxWidth = Math.max(maxWidth, sz);
}