+ public void alignmentProperties()
+ {
+ JEditorPane editPane = new JEditorPane("text/html", "");
+ editPane.setEditable(false);
+ StringBuffer contents = new StringBuffer("<html>");
+
+ float avg = 0;
+ int min = Integer.MAX_VALUE, max = 0;
+ for (int i = 0; i < viewport.alignment.getHeight(); i++)
+ {
+ int size = viewport.alignment.getSequenceAt(i).getEnd()
+ - viewport.alignment.getSequenceAt(i).getStart();
+ avg += size;
+ if (size > max)
+ max = size;
+ if (size < min)
+ min = size;
+ }
+ avg = avg / (float) viewport.alignment.getHeight();
+
+ contents.append("<br>Sequences: " + viewport.alignment.getHeight());
+ contents.append("<br>Minimum Sequence Length: " + min);
+ contents.append("<br>Maximum Sequence Length: " + max);
+ contents.append("<br>Average Length: " + (int) avg);
+
+ if (((Alignment) viewport.alignment).getProperties() != null)
+ {
+ Hashtable props = ((Alignment) viewport.alignment).getProperties();
+ Enumeration en = props.keys();
+ contents.append("<br><br><table border=\"1\">");
+ while (en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ StringBuffer val = new StringBuffer();
+ String vals = props.get(key).toString();
+ int pos = 0, npos;
+ do
+ {
+ npos = vals.indexOf("\n", pos);
+ if (npos == -1)
+ {
+ val.append(vals.substring(pos));
+ }
+ else
+ {
+ val.append(vals.substring(pos, npos));
+ val.append("<br>");
+ }
+ pos = npos + 1;
+ } while (npos != -1);
+ contents
+ .append("<tr><td>" + key + "</td><td>" + val + "</td></tr>");
+ }
+ contents.append("</table>");
+ }
+ editPane.setText(contents.toString() + "</html>");
+ JInternalFrame frame = new JInternalFrame();
+ frame.getContentPane().add(new JScrollPane(editPane));
+
+ Desktop.instance.addInternalFrame(frame, "Alignment Properties: "
+ + getTitle(), 500, 400);
+ }
+