X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FSequenceAnnotationReport.java;h=d2e8abaa53307f162723a7312b0ab709829b3f31;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=95bd1cc2ca4008a1cfe4248467e7628ff5ab5429;hpb=04c8f7bff663aa469127e9eed4164e02933782f1;p=jalview.git diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 95bd1cc..d2e8aba 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -21,6 +21,7 @@ package jalview.io; import java.util.ArrayList; + import java.util.Collection; import java.util.Comparator; import java.util.LinkedHashMap; @@ -29,6 +30,7 @@ import java.util.Locale; import java.util.Map; import jalview.api.FeatureColourI; +import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.GeneLociI; @@ -59,7 +61,7 @@ public class SequenceAnnotationReport 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), @@ -91,32 +93,32 @@ public class SequenceAnnotationReport { 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; @@ -150,9 +152,9 @@ public class SequenceAnnotationReport * @param minmax * @param maxlength */ - public int appendFeatures(final StringBuilder sb, int residuePos, - List features, FeatureRendererModel fr, - int maxlength) + public int appendFeatures(final StringBuilder sb, + int residuePos, List features, + FeatureRendererModel fr, int maxlength) { for (int i = 0; i < features.size(); i++) { @@ -293,7 +295,9 @@ public class SequenceAnnotationReport int linkindex = description.toLowerCase(Locale.ROOT).indexOf(" -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; @@ -412,19 +416,21 @@ public class SequenceAnnotationReport { for (List urllink : createLinksFrom(null, urlstring)) { - sb.append("
" - + (urllink.get(0).toLowerCase(Locale.ROOT).equals( - urllink.get(1).toLowerCase(Locale.ROOT)) - ? urllink.get(0) - : (urllink.get(0) + ":" - + urllink.get(1))) - + "
"); + sb.append("
" + + (urllink.get(0).toLowerCase(Locale.ROOT) + .equals(urllink.get(1).toLowerCase(Locale.ROOT)) ? urllink + .get(0) : (urllink.get(0) + ":" + urllink + .get(1))) + + "
"); } } catch (Exception x) { - System.err.println( - "problem when creating links from " + urlstring); + System.err.println("problem when creating links from " + + urlstring); x.printStackTrace(); } } @@ -500,6 +506,27 @@ public class SequenceAnnotationReport 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("
").append("Annotation Scores
"); + first=false; + } + sb.append("
").append(aa.label).append(": ") + .append(aa.getScore()); + } + } + } if (showDbRefs) { maxWidth = Math.max(maxWidth, appendDbRefs(sb, ds, summary)); @@ -520,6 +547,20 @@ public class SequenceAnnotationReport maxWidth = Math.max(maxWidth, sz); } } + if (sequence.getAnnotation("Search Scores") != null) + { + sb.append("
"); + 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("
"); + sb.append(bitScore); + maxWidth = Math.max(maxWidth, eValue.length()); + maxWidth = Math.max(maxWidth, bitScore.length()); + sb.append("
"); + } sb.append(""); return maxWidth; } @@ -548,7 +589,6 @@ public class SequenceAnnotationReport dbrefs = new ArrayList(); dbrefs.addAll(dbrefset); - // note this sorts the refs held on the sequence! dbrefs.sort(comparator); boolean ellipsis = false; @@ -627,8 +667,8 @@ public class SequenceAnnotationReport 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) {