import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
+import jalview.datamodel.DynamicData;
+import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.io.gff.GffConstants;
void appendFeature(final StringBuilder sb, int rpos,
Map<String, float[][]> minmax, SequenceFeature feature)
{
- String tmpString;
- if (feature.getType().equals("disulfide bond"))
+ if (feature.isContactFeature())
{
if (feature.getBegin() == rpos || feature.getEnd() == rpos)
{
{
sb.append("<br>");
}
- sb.append("disulfide bond ").append(feature.getBegin()).append(":")
+ sb.append(feature.getType()).append(" ").append(feature.getBegin())
+ .append(":")
.append(feature.getEnd());
}
}
if (feature.getDescription() != null
&& !feature.description.equals(feature.getType()))
{
- tmpString = feature.getDescription();
+ String tmpString = feature.getDescription();
String tmp2up = tmpString.toUpperCase();
int startTag = tmp2up.indexOf("<HTML>");
if (startTag > -1)
// check score should be shown
if (!Float.isNaN(feature.getScore()))
{
- float[][] rng = (minmax == null) ? null : ((float[][]) minmax
- .get(feature.getType()));
+ float[][] rng = (minmax == null) ? null : minmax.get(feature
+ .getType());
if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
{
- sb.append(" Score=" + feature.getScore());
+ sb.append(" Score=").append(String.valueOf(feature.getScore()));
}
}
String status = (String) feature.getValue("status");
}
}
sb.append("</i>");
+ List<PDBEntry> pdbEntries = ds.getAllPDBEntries();
+ sb.append(getToolTipTextFromPDBEntries(pdbEntries));
return maxWidth;
}
+ private String getToolTipTextFromPDBEntries(List<PDBEntry> pdbEntries)
+ {
+ String tooltip = "";
+ if (pdbEntries.isEmpty())
+ {
+ return tooltip;
+ }
+ if (pdbEntries.size() > 1)
+ {
+ int x = 0;
+ PDBEntry bestRanked = null;
+ for (PDBEntry pdb : pdbEntries)
+ {
+ if (pdb.getProperty("DYNAMIC_DATA_PHYRE2") != null)
+ {
+ x++;
+ }
+ // best ranked entry must be from a Phyre
+ if (x > 0 && bestRanked == null)
+ {
+ bestRanked = pdb;
+ }
+ }
+ tooltip = (x > 0) ? "<table border=\"1\" width=100%><tr><td>Contains <b>"
+ + x
+ + "</b> Phyre2 model structure(s)</td></tr>"
+ + "<tr><td>Best ranked Phyre2 model is <b>"
+ + bestRanked.getId() + "</b></td></tr></table>"
+ : "";
+ }
+ else
+ {
+ PDBEntry pdb = pdbEntries.iterator().next();
+ if (pdb.getProperty("DYNAMIC_DATA_PHYRE2") != null)
+ {
+ tooltip = getPhyreToolTipFromDynamicData((List<DynamicData>) pdb
+ .getProperty("DYNAMIC_DATA_PHYRE2"));
+ }
+ }
+ return tooltip;
+ }
+
+ private String getPhyreToolTipFromDynamicData(
+ List<DynamicData> dynamicDataList)
+ {
+ StringBuilder phyre2InfoBuilder = new StringBuilder();
+ phyre2InfoBuilder
+ .append("<html><table border=\"1\" width=100%>")
+ .append("<tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr>");
+ for (DynamicData data : dynamicDataList)
+ {
+ if (data.isDisplay())
+ {
+ phyre2InfoBuilder.append("<tr><td>").append(data.getFieldTitle())
+ .append("</td><td>").append(data.getFieldValue())
+ .append("</td></tr>");
+ }
+ }
+ phyre2InfoBuilder.append("</table></html>");
+ return phyre2InfoBuilder.toString();
+ }
+
public void createTooltipAnnotationReport(final StringBuilder tip,
SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
Map<String, float[][]> minmax)