*/
package jalview.io;
-import java.util.Locale;
import java.util.ArrayList;
-import java.util.Arrays;
+
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
-import com.google.common.collect.Lists;
-
import jalview.api.FeatureColourI;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.GeneLociI;
private static String linkImageURL;
- // public static final String[][] PRIMARY_SOURCES moved to DBRefSource.java
+ // public static final String[][] PRIMARY_SOURCES moved to DBRefSource.java
/*
* Comparator to order DBRefEntry by Source + accession id (case-insensitive),
{
return 1;
}
- int comp = s1 == null ? -1
- : (s2 == null ? 1 : s1.compareToIgnoreCase(s2));
+ int comp = s1 == null ? -1 : (s2 == null ? 1 : s1
+ .compareToIgnoreCase(s2));
if (comp == 0)
{
String a1 = ref1.getAccessionId();
String a2 = ref2.getAccessionId();
- comp = a1 == null ? -1
- : (a2 == null ? 1 : a1.compareToIgnoreCase(a2));
+ comp = a1 == null ? -1 : (a2 == null ? 1 : a1
+ .compareToIgnoreCase(a2));
}
return comp;
}
- // private boolean isPrimarySource(String source)
- // {
- // for (String[] primary : DBRefSource.PRIMARY_SOURCES)
- // {
- // for (String s : primary)
- // {
- // if (source.equals(s))
- // {
- // return true;
- // }
- // }
- // }
- // return false;
- // }
+// private boolean isPrimarySource(String source)
+// {
+// for (String[] primary : DBRefSource.PRIMARY_SOURCES)
+// {
+// for (String s : primary)
+// {
+// if (source.equals(s))
+// {
+// return true;
+// }
+// }
+// }
+// return false;
+// }
};
private boolean forTooltip;
* @param minmax
* @param maxlength
*/
- public int appendFeatures(final StringBuilder sb, int residuePos,
- List<SequenceFeature> features, FeatureRendererModel fr,
- int maxlength)
+ public int appendFeatures(final StringBuilder sb,
+ int residuePos, List<SequenceFeature> features,
+ FeatureRendererModel fr, int maxlength)
{
for (int i = 0; i < features.size(); i++)
{
int linkindex = description.toLowerCase(Locale.ROOT).indexOf("<a ");
boolean hasLink = linkindex > -1
&& linkindex < MAX_DESCRIPTION_LENGTH;
- if (description.length() > MAX_DESCRIPTION_LENGTH && !hasLink)
+ if (
+ // BH suggestion maxlength == 0 &&
+ description.length() > MAX_DESCRIPTION_LENGTH && !hasLink)
{
description = description.substring(0, MAX_DESCRIPTION_LENGTH)
+ ELLIPSIS;
{
for (List<String> urllink : createLinksFrom(null, urlstring))
{
- sb.append("<br/> <a href=\"" + urllink.get(3) + "\" target=\""
- + urllink.get(0) + "\">"
- + (urllink.get(0).toLowerCase(Locale.ROOT).equals(
- urllink.get(1).toLowerCase(Locale.ROOT))
- ? urllink.get(0)
- : (urllink.get(0) + ":"
- + urllink.get(1)))
- + "</a><br/>");
+ sb.append("<br> <a href=\""
+ + urllink.get(3)
+ + "\" target=\""
+ + urllink.get(0)
+ + "\">"
+ + (urllink.get(0).toLowerCase(Locale.ROOT)
+ .equals(urllink.get(1).toLowerCase(Locale.ROOT)) ? urllink
+ .get(0) : (urllink.get(0) + ":" + urllink
+ .get(1)))
+ + "</a><br>");
}
} catch (Exception x)
{
- System.err.println(
- "problem when creating links from " + urlstring);
+ System.err.println("problem when creating links from "
+ + urlstring);
x.printStackTrace();
}
}
ds = ds.getDatasetSequence();
}
+
+ /*
+ * add any annotation scores
+ */
+ AlignmentAnnotation[] anns = ds.getAnnotation();
+ if (anns!=null && anns.length>0) {
+ boolean first=true;
+ for (int i = 0; anns != null && i < anns.length; i++)
+ {
+ AlignmentAnnotation aa = anns[i];
+ if (aa != null && aa.hasScore() && aa.sequenceRef != null)
+ {
+ if (first) {
+ sb.append("<br>").append("Annotation Scores<br>");
+ first=false;
+ }
+ sb.append("<br>").append(aa.label).append(": ")
+ .append(aa.getScore());
+ }
+ }
+ }
if (showDbRefs)
{
maxWidth = Math.max(maxWidth, appendDbRefs(sb, ds, summary));
maxWidth = Math.max(maxWidth, sz);
}
}
+ if (sequence.getAnnotation("Search Scores") != null)
+ {
+ sb.append("<br>");
+ String eValue = " E-Value: "
+ + sequence.getAnnotation("Search Scores")[0].getEValue();
+ String bitScore = " Bit Score: "
+ + sequence.getAnnotation("Search Scores")[0].getBitScore();
+ sb.append(eValue);
+ sb.append("<br>");
+ sb.append(bitScore);
+ maxWidth = Math.max(maxWidth, eValue.length());
+ maxWidth = Math.max(maxWidth, bitScore.length());
+ sb.append("<br>");
+ }
sb.append("</i>");
return maxWidth;
}
protected int appendDbRefs(final StringBuilder sb, SequenceI ds,
boolean summary)
{
- List<DBRefEntry> dbrefs,dbrefset = ds.getDBRefs();
+ List<DBRefEntry> dbrefs, dbrefset = ds.getDBRefs();
if (dbrefset == null)
{
// PATCH for JAL-3980 defensive copy
dbrefs = new ArrayList<DBRefEntry>();
-
+
dbrefs.addAll(dbrefset);
-
// note this sorts the refs held on the sequence!
dbrefs.sort(comparator);
boolean ellipsis = false;
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
FeatureRendererModel fr)
{
- int maxWidth = createSequenceAnnotationReport(tip, sequence, showDbRefs,
- showNpFeats, fr, true);
+ int maxWidth = createSequenceAnnotationReport(tip, sequence,
+ showDbRefs, showNpFeats, fr, true);
if (maxWidth > 60)
{