import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
import java.util.Vector;
import com.stevesoft.pat.Regex;
// add alignment annotation for this feature
String key = type2id(type);
+
+ /*
+ * have we added annotation rows for this type ?
+ */
+ boolean annotsAdded = false;
if (key != null)
{
if (accAnnotations != null
Vector vv = (Vector) accAnnotations.get(key);
for (int ii = 0; ii < vv.size(); ii++)
{
+ annotsAdded = true;
AlignmentAnnotation an = (AlignmentAnnotation) vv
.elementAt(ii);
seqO.addAlignmentAnnotation(an);
while (j.hasMoreElements())
{
String desc = j.nextElement().toString();
+ if ("annotations".equals(desc) && annotsAdded)
+ {
+ // don't add features if we already added an annotation row
+ continue;
+ }
String ns = content.get(desc).toString();
char[] byChar = ns.toCharArray();
for (int k = 0; k < byChar.length; k++)
{
String acc = s.stringMatched(1);
String type = s.stringMatched(2);
- String seq = new String(s.stringMatched(3));
- String description = null;
- // Check for additional information about the current annotation
- // We use a simple string tokenizer here for speed
- StringTokenizer sep = new StringTokenizer(seq, " \t");
- description = sep.nextToken();
- if (sep.hasMoreTokens())
- {
- seq = sep.nextToken();
- }
- else
- {
- seq = description;
- description = new String();
- }
- // sequence id with from-to fields
+ String oseq = s.stringMatched(3);
+ /*
+ * copy of annotation field that may be processed into whitespace chunks
+ */
+ String seq = new String(oseq);
Hashtable ann;
// Get an object with all the annotations for this sequence
ann = new Hashtable();
seqAnn.put(acc, ann);
}
+
+ // // start of block for appending annotation lines for wrapped
+ // stokchholm file
// TODO test structure, call parseAnnotationRow with vector from
// hashtable for specific sequence
+
Hashtable features;
// Get an object with all the content for an annotation
if (ann.containsKey("features"))
content = new Hashtable();
features.put(this.id2type(type), content);
}
- String ns = (String) content.get(description);
+ String ns = (String) content.get("annotation");
+
if (ns == null)
{
ns = "";
}
+ // finally, append the annotation line
ns += seq;
- content.put(description, ns);
+ content.put("annotation", ns);
+ // // end of wrapped annotation block.
+ // // Now a new row is created with the current set of data
- // if(type.equals("SS")){
Hashtable strucAnn;
if (seqAnn.containsKey(acc))
{
{
alan.visible = false;
}
- // annotations.addAll(newStruc);
+ // new annotation overwrites any existing annotation...
+
strucAnn.put(type, newStruc);
seqAnn.put(acc, strucAnn);
}
if (DETECT_BRACKETS.search(pos))
{
ann.secondaryStructure = Rna.getRNASecStrucState(pos).charAt(0);
+ ann.displayCharacter = "" + pos.charAt(0);
}
else
{
ann.secondaryStructure = ResidueProperties.getDssp3state(pos)
.charAt(0);
- }
if (ann.secondaryStructure == pos.charAt(0))
{
{
ann.displayCharacter = " " + ann.displayCharacter;
}
+ }
}
}