for (int k = 0; k < rna.length(); k++)
{
- ann[k] = new Annotation(annot[k], "", Rna.getRNASecStrucState(
- annot[k]).charAt(0), 0f);
+ ann[k] = new Annotation(annot[k], "",
+ Rna.getRNASecStrucState(annot[k]).charAt(0), 0f);
}
AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",
r = new Regex("# STOCKHOLM ([\\d\\.]+)");
if (!r.search(nextLine()))
{
- throw new IOException(
- MessageManager
- .getString("exception.stockholm_invalid_format"));
+ throw new IOException(MessageManager
+ .getString("exception.stockholm_invalid_format"));
}
else
{
{
// logger.error("Could not parse sequence line: " + line);
throw new IOException(MessageManager.formatMessage(
- "exception.couldnt_parse_sequence_line",
- new String[] { line }));
+ "exception.couldnt_parse_sequence_line", new String[]
+ { line }));
}
String ns = seqs.get(x.stringMatched(1));
if (ns == null)
// }
else
{
- System.err
- .println("Warning - couldn't parse sequence annotation row line:\n"
+ System.err.println(
+ "Warning - couldn't parse sequence annotation row line:\n"
+ line);
// throw new IOException("Error parsing " + line);
}
else
{
throw new IOException(MessageManager.formatMessage(
- "exception.unknown_annotation_detected", new String[] {
- annType, annContent }));
+ "exception.unknown_annotation_detected", new String[]
+ { annType, annContent }));
}
}
}
{
for (DBRefEntry d : dbrs)
{
- jalview.util.MapList mp = new jalview.util.MapList(new int[] {
- seqO.getStart(), seqO.getEnd() }, new int[] { st, en }, 1, 1);
+ jalview.util.MapList mp = new jalview.util.MapList(
+ new int[]
+ { seqO.getStart(), seqO.getEnd() }, new int[] { st, en }, 1,
+ 1);
jalview.datamodel.Mapping mping = new Mapping(mp);
d.setMap(mping);
}
String type = label;
if (label.contains("_cons"))
{
- type = (label.indexOf("_cons") == label.length() - 5) ? label
- .substring(0, label.length() - 5) : label;
+ type = (label.indexOf("_cons") == label.length() - 5)
+ ? label.substring(0, label.length() - 5)
+ : label;
}
boolean ss = false, posterior = false;
type = id2type(type);
ann.secondaryStructure = ResidueProperties.getDssp3state(pos)
.charAt(0);
- if (ann.secondaryStructure == pos.charAt(0))
- {
- ann.displayCharacter = ""; // null; // " ";
- }
- else
- {
- ann.displayCharacter = " " + ann.displayCharacter;
- }
+ if (ann.secondaryStructure == pos.charAt(0))
+ {
+ ann.displayCharacter = ""; // null; // " ";
+ }
+ else
+ {
+ ann.displayCharacter = " " + ann.displayCharacter;
+ }
}
}
@Override
public String print(SequenceI[] s, boolean jvSuffix)
{
- String string = print(s, jvSuffix, false);
- return string;
- }
-
- public String print(SequenceI[] s, boolean jvSuffix,
- boolean removeAnnotations)
- {
out = new StringBuffer();
out.append("# STOCKHOLM 1.0");
out.append(newline);
{
Object idd = en.nextElement();
String type = (String) dataRef.remove(idd);
- out.append(new Format("%-" + (maxid - 2) + "s").form("#=GS "
- + idd.toString() + " "));
+ out.append(new Format("%-" + (maxid - 2) + "s")
+ .form("#=GS " + idd.toString() + " "));
if (type.contains("PFAM") || type.contains("RFAM"))
{
}
- // output annotations
- while (i < s.length && s[i] != null)
+ // output annotations
+ while (i < s.length && s[i] != null)
+ {
+ AlignmentAnnotation[] alAnot = s[i].getAnnotation();
+ if (alAnot != null)
{
- AlignmentAnnotation[] alAnot = s[i].getAnnotation();
- if (alAnot != null && !removeAnnotations)
+ Annotation[] ann;
+ for (int j = 0; j < alAnot.length; j++)
{
- Annotation[] ann;
- for (int j = 0; j < alAnot.length; j++)
- {
- String key = type2id(alAnot[j].label);
- boolean isrna = alAnot[j].isValidStruc();
+ String key = type2id(alAnot[j].label);
+ boolean isrna = alAnot[j].isValidStruc();
+ if (isrna)
+ {
+ // hardwire to secondary structure if there is RNA secondary
+ // structure on the annotation
+ key = "SS";
+ }
+ if (key == null)
+ {
- if (isrna)
- {
- // hardwire to secondary structure if there is RNA secondary
- // structure on the annotation
- key = "SS";
- }
- if (key == null)
- {
+ continue;
+ }
- continue;
- }
+ // out.append("#=GR ");
+ out.append(new Format("%-" + maxid + "s").form(
+ "#=GR " + printId(s[i], jvSuffix) + " " + key + " "));
+ ann = alAnot[j].annotations;
+ String seq = "";
+ for (int k = 0; k < ann.length; k++)
+ {
+ seq += outputCharacter(key, k, isrna, ann, s[i]);
- // out.append("#=GR ");
- out.append(new Format("%-" + maxid + "s").form(
- "#=GR " + printId(s[i], jvSuffix) + " " + key + " "));
- ann = alAnot[j].annotations;
- String seq = "";
- for (int k = 0; k < ann.length; k++)
- {
- seq += outputCharacter(key, k, isrna, ann, s[i]);
- }
- out.append(seq);
- out.append(newline);
- }
}
-
- out.append(new Format("%-" + maxid + "s")
- .form(printId(s[i], jvSuffix) + " "));
- out.append(s[i].getSequenceAsString());
- out.append(newline);
- i++;
+ out.append(seq);
+ out.append(newline);
+ }
}
- if (!removeAnnotations)
+ out.append(new Format("%-" + maxid + "s")
+ .form(printId(s[i], jvSuffix) + " "));
+ out.append(s[i].getSequenceAsString());
+ out.append(newline);
+ i++;
+ }
+
+ // alignment annotation
+ AlignmentAnnotation aa;
+ if (al.getAlignmentAnnotation() != null)
{
- // alignment annotation
- AlignmentAnnotation aa;
- if (al.getAlignmentAnnotation() != null)
+ for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
{
- for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
+ aa = al.getAlignmentAnnotation()[ia];
+ if (aa.autoCalculated || !aa.visible || aa.sequenceRef != null)
{
- aa = al.getAlignmentAnnotation()[ia];
- if (aa.autoCalculated || !aa.visible || aa.sequenceRef != null)
- {
- continue;
- }
- String seq = "";
- String label;
- String key = "";
- if (aa.label.equals("seq"))
+ continue;
+ }
+ String seq = "";
+ String label;
+ String key = "";
+ if (aa.label.equals("seq"))
+ {
+ label = "seq_cons";
+ }
+ else
+ {
+ key = type2id(aa.label.toLowerCase());
+ if (key == null)
{
- label = "seq_cons";
+ label = aa.label;
}
else
{
- key = type2id(aa.label.toLowerCase());
- if (key == null)
- {
- label = aa.label;
- }
- else
- {
- label = key + "_cons";
- }
- }
- if (label == null)
- {
- label = aa.label;
+ label = key + "_cons";
}
- label = label.replace(" ", "_");
+ }
+ if (label == null)
+ {
+ label = aa.label;
+ }
+ label = label.replace(" ", "_");
- out.append(new Format("%-" + maxid + "s")
- .form("#=GC " + label + " "));
- boolean isrna = aa.isValidStruc();
- for (int j = 0; j < aa.annotations.length; j++)
- {
- seq += outputCharacter(key, j, isrna, aa.annotations, null);
- }
- out.append(seq);
- out.append(newline);
+ out.append(
+ new Format("%-" + maxid + "s").form("#=GC " + label + " "));
+ boolean isrna = aa.isValidStruc();
+ for (int j = 0; j < aa.annotations.length; j++)
+ {
+ seq += outputCharacter(key, j, isrna, aa.annotations, null);
}
+ out.append(seq);
+ out.append(newline);
}
}
+
+
out.append("//");
out.append(newline);
{
char seq = ' ';
Annotation annot = ann[k];
- String ch = (annot == null) ? ((sequenceI == null) ? "-" : Character
- .toString(sequenceI.getCharAt(k))) : annot.displayCharacter;
+ String ch = (annot == null)
+ ? ((sequenceI == null) ? "-"
+ : Character.toString(sequenceI.getCharAt(k)))
+ : annot.displayCharacter;
if (key != null && key.equals("SS"))
{
if (annot == null)
out.append("# STOCKHOLM 1.0");
out.append(newline);
print(getSeqsAsArray(), false);
-
- out.append(newline);
return out.toString();
}
{
return (String) typeIds.get(id);
}
- System.err.println("Warning : Unknown Stockholm annotation type code "
- + id);
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type code " + id);
return id;
}
{
return key;
}
- System.err.println("Warning : Unknown Stockholm annotation type: "
- + type);
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type: " + type);
return key;
}