}
+ @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
* with no dataloss
// check Alignment annotation
AlignmentAnnotation[] aa_new = al_input.getAlignmentAnnotation();
AlignmentAnnotation[] aa_original = al.getAlignmentAnnotation();
+ boolean expectProteinSS = !al.isNucleotide();
+ assertTrue(
+ "Alignments not both "
+ + (al.isNucleotide() ? "nucleotide" : "protein"),
+ al_input.isNucleotide() == al.isNucleotide());
// note - at moment we do not distinguish between alignment without any
// annotation rows and alignment with no annotation row vector
assertEqualSecondaryStructure(
"Different alignment annotation at position " + i,
aa_original[i], aa_new[i], allowNullAnnotation);
+ if (aa_original[i].hasIcons)
+ {
+ assertTrue(
+ "Secondary structure expected to be "
+ + (expectProteinSS ? "protein" : "nucleotide"),
+ expectProteinSS == !aa_original[i].isRNA());
+ }
// compare graphGroup or graph properties - needed to verify JAL-1299
assertEquals("Graph type not identical.", aa_original[i].graph,
aa_new[i].graph);