String version;
// String id;
Hashtable seqAnn = new Hashtable(); // Sequence related annotations
- LinkedHashMap<String, String> seqs = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> seqs = new LinkedHashMap<>();
Regex p, r, rend, s, x;
// Temporary line for processing RNA annotation
// String RNAannot = "";
strucAnn = new Hashtable();
}
- Vector<AlignmentAnnotation> newStruc = new Vector<AlignmentAnnotation>();
+ Vector<AlignmentAnnotation> newStruc = new Vector<>();
parseAnnotationRow(newStruc, type, ns);
for (AlignmentAnnotation alan : newStruc)
{
private void guessDatabaseFor(Sequence seqO, String dbr, String dbsource)
{
DBRefEntry dbrf = null;
- List<DBRefEntry> dbrs = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> dbrs = new ArrayList<>();
String seqdb = "Unknown", sdbac = "" + dbr;
int st = -1, en = -1, p;
if ((st = sdbac.indexOf("/")) > -1)
@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);
}
}
- // output annotations
- while (i < s.length && s[i] != null)
- {
- AlignmentAnnotation[] alAnot = s[i].getAnnotation();
- if (alAnot != null)
+
+ // output annotations
+ while (i < s.length && s[i] != null)
{
- Annotation[] ann;
- for (int j = 0; j < alAnot.length; j++)
+ AlignmentAnnotation[] alAnot = s[i].getAnnotation();
+ if (alAnot != null && !removeAnnotations)
{
+ 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(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(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)
+ if (!removeAnnotations)
{
- for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
+ // alignment annotation
+ AlignmentAnnotation aa;
+ if (al.getAlignmentAnnotation() != 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"))
+ for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
{
- label = "seq_cons";
- }
- else
- {
- key = type2id(aa.label.toLowerCase());
- if (key == null)
+ aa = al.getAlignmentAnnotation()[ia];
+ if (aa.autoCalculated || !aa.visible || aa.sequenceRef != null)
{
- label = aa.label;
+ continue;
+ }
+ String seq = "";
+ String label;
+ String key = "";
+ if (aa.label.equals("seq"))
+ {
+ label = "seq_cons";
}
else
{
- label = key + "_cons";
+ key = type2id(aa.label.toLowerCase());
+ if (key == null)
+ {
+ label = aa.label;
+ }
+ else
+ {
+ label = key + "_cons";
+ }
+ }
+ if (label == null)
+ {
+ label = aa.label;
}
- }
- if (label == null)
- {
- label = aa.label;
- }
- label = label.replace(" ", "_");
+ 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(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(seq);
- out.append(newline);
}
}
out.append(newline);
print(getSeqsAsArray(), false);
- out.append("//");
out.append(newline);
return out.toString();
}
if (typeIds == null)
{
typeIds = new Hashtable();
- typeIds.put("SS", "secondary structure");
- typeIds.put("SA", "surface accessibility");
+ typeIds.put("SS", "Secondary Structure");
+ typeIds.put("SA", "Surface Accessibility");
typeIds.put("TM", "transmembrane");
- typeIds.put("PP", "posterior probability");
+ typeIds.put("PP", "Posterior Probability");
typeIds.put("LI", "ligand binding");
typeIds.put("AS", "active site");
typeIds.put("IN", "intron");
typeIds.put("DE", "description");
typeIds.put("DR", "reference");
typeIds.put("LO", "look");
- typeIds.put("RF", "reference positions");
+ typeIds.put("RF", "Reference Positions");
}
}