}
}
- // output annotations
+ // output description and annotations
+
while (i < slen && (seq = s[i]) != null)
{
+ if (seq.getDescription()!=null)
+ {
+ // out.append("#=GR ");
+ out.append(new Format("%-" + maxid + "s").form(
+ "#=GS " + printId(seq, jvSuffix) + " DE " + seq.getDescription()));
+ out.append(newline);
+ }
+
AlignmentAnnotation[] alAnot = seq.getAnnotation();
if (alAnot != null)
{
"Couldn't find Uniprot DBRef on re-imported sequence.");
}
+ @Test(groups = { "Functional" })
+ public void descriptionLineOutput() throws Exception
+ {
+ // quick test that sequence description is exported & reimported
+
+ SequenceI sq = new Sequence("FER2_SPIOL", "AASSDDDFFF");
+ String expected_descr="This is a description !@&^%@£@";
+ sq.setDescription(expected_descr);
+ AppletFormatAdapter af = new AppletFormatAdapter();
+ String toStockholm = af.formatSequences(FileFormat.Stockholm,
+ new Alignment(new SequenceI[]
+ { sq }), false);
+ System.out.println(toStockholm);
+
+ // bleh - java.util.Regex sucks
+ assertTrue(toStockholm.contains(expected_descr),"Couldn't locate expected description srting in generated Stockholm file.");
+
+ AlignmentI fromStockholm = af.readFile(toStockholm,
+ DataSourceType.PASTE, FileFormat.Stockholm);
+ SequenceI importedSeq = fromStockholm.getSequenceAt(0);
+ assertEquals( "Description did not get reimported.",expected_descr,importedSeq.getDescription());
+ }
/**
* test alignment data in given file can be imported, exported and reimported