*/
package jalview.io;
+import java.util.ArrayList;
+
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 jalview.api.FeatureColourI;
* if this is a virtual features, convert begin/end to the
* coordinates of the sequence it is mapped to
*/
- int[] beginRange = null;
- int[] endRange = null;
+ int[] beginRange = null; // feature start in local coordinates
+ int[] endRange = null; // feature end in local coordinates
if (mf != null)
{
- beginRange = mf.getMappedPositions(begin, begin);
- endRange = mf.getMappedPositions(end, end);
+ if (feature.isContactFeature())
+ {
+ /*
+ * map start and end points individually
+ */
+ beginRange = mf.getMappedPositions(begin, begin);
+ endRange = begin == end ? beginRange
+ : mf.getMappedPositions(end, end);
+ }
+ else
+ {
+ /*
+ * map the feature extent
+ */
+ beginRange = mf.getMappedPositions(begin, end);
+ endRange = beginRange;
+ }
if (beginRange == null || endRange == null)
{
// something went wrong
{
if (sb0.length() > 6)
{
- sb.append("<br>");
+ sb.append("<br/>");
}
sb.append(feature.getType()).append(" ").append(begin).append(":")
.append(end);
if (sb0.length() > 6)
{
- sb.append("<br>");
+ sb.append("<br/>");
}
// TODO: remove this hack to display link only features
boolean linkOnly = feature.getValue("linkonly") != null;
* truncate overlong descriptions unless they contain an href
* before the truncation point (as truncation could leave corrupted html)
*/
- int linkindex = description.toLowerCase().indexOf("<a ");
+ int linkindex = description.toLowerCase(Locale.ROOT).indexOf("<a ");
boolean hasLink = linkindex > -1
&& linkindex < MAX_DESCRIPTION_LENGTH;
if (
+ "\" target=\""
+ urllink.get(0)
+ "\">"
- + (urllink.get(0).toLowerCase()
- .equals(urllink.get(1).toLowerCase()) ? urllink
+ + (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(tmp);
maxWidth = Math.max(maxWidth, tmp.length());
}
-
+ sb.append("\n");
SequenceI ds = sequence;
while (ds.getDatasetSequence() != null)
{
ds = ds.getDatasetSequence();
}
+
/*
* add any annotation scores
*/
AlignmentAnnotation[] anns = ds.getAnnotation();
- for (int i = 0; anns != null && i < anns.length; i++)
- {
- AlignmentAnnotation aa = anns[i];
- if (aa != null && aa.hasScore() && aa.sequenceRef != null)
+ if (anns!=null && anns.length>0) {
+ boolean first=true;
+ for (int i = 0; anns != null && i < anns.length; i++)
{
- sb.append("<br>").append(aa.label).append(": ")
- .append(aa.getScore());
+ 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));
}
+ sb.append("\n");
/*
* add non-positional features if wanted
maxWidth = Math.max(maxWidth, sz);
}
}
-
-
if (sequence.getAnnotation("Search Scores") != null)
{
sb.append("<br>");
sb.append(bitScore);
maxWidth = Math.max(maxWidth, eValue.length());
maxWidth = Math.max(maxWidth, bitScore.length());
+ sb.append("<br>");
}
- sb.append("<br>");
sb.append("</i>");
-
return maxWidth;
}
protected int appendDbRefs(final StringBuilder sb, SequenceI ds,
boolean summary)
{
- List<DBRefEntry> dbrefs = ds.getDBRefs();
- if (dbrefs == null)
+ List<DBRefEntry> dbrefs, dbrefset = ds.getDBRefs();
+
+ if (dbrefset == null)
{
return 0;
}
+ // 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;
countForSource++;
if (countForSource == 1 || !summary)
{
- sb.append("<br>");
+ sb.append("<br/>\n");
}
if (countForSource <= MAX_REFS_PER_SOURCE || !summary)
{
lineLength += accessionId.length() + 1;
if (countForSource > 1 && summary)
{
- sb.append(", ").append(accessionId);
+ sb.append(",\n ").append(accessionId);
lineLength++;
}
else
}
if (moreSources)
{
- sb.append("<br>").append(source).append(COMMA).append(ELLIPSIS);
+ sb.append("<br/>\n").append(source).append(COMMA).append(ELLIPSIS);
}
if (ellipsis)
{
- sb.append("<br>(");
+ sb.append("<br/>\n(");
sb.append(MessageManager.getString("label.output_seq_details"));
sb.append(")");
}