+
+
+ public String print()
+ {
+ out = new StringBuffer();
+ out.append("# STOCKHOLM 1.0");
+ out.append(newline);
+ print(getSeqsAsArray(), false);
+
+ out.append("//");
+ out.append(newline);
+ return out.toString();
+ }
+
+ private static Hashtable typeIds = null;
+
+ static
+ {
+ if (typeIds == null)
+ {
+ typeIds = new Hashtable();
+ typeIds.put("SS", "Secondary Structure");
+ typeIds.put("SA", "Surface Accessibility");
+ typeIds.put("TM", "transmembrane");
+ typeIds.put("PP", "Posterior Probability");
+ typeIds.put("LI", "ligand binding");
+ typeIds.put("AS", "active site");
+ typeIds.put("IN", "intron");
+ typeIds.put("IR", "interacting residue");
+ typeIds.put("AC", "accession");
+ typeIds.put("OS", "organism");
+ typeIds.put("CL", "class");
+ typeIds.put("DE", "description");
+ typeIds.put("DR", "reference");
+ typeIds.put("LO", "look");
+ typeIds.put("RF", "Reference Positions");
+
+ }
+ }
+
+ protected static String id2type(String id)
+ {
+ if (typeIds.containsKey(id))
+ {
+ return (String) typeIds.get(id);
+ }
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type code " + id);
+ return id;
+ }
+
+ protected static String type2id(String type)
+ {
+ String key = null;
+ Enumeration e = typeIds.keys();
+ while (e.hasMoreElements())
+ {
+ Object ll = e.nextElement();
+ if (typeIds.get(ll).toString().equalsIgnoreCase(type))
+ {
+ key = (String) ll;
+ break;
+ }
+ }
+ if (key != null)
+ {
+ return key;
+ }
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type: " + type);
+ return key;
+ }