X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FStockholmFileTest.java;h=10f368a127babdd688c461558cc2ed7e99b942da;hb=20d8cc2bb3e2fab2b7f637a3d523c90ceb58903d;hp=e4f2abc900d7f68b0be339d9ed312b38c0a713b4;hpb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;p=jalview.git diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index e4f2abc..10f368a 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -137,6 +137,31 @@ public class StockholmFileTest } + @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 @@ -274,6 +299,11 @@ public class StockholmFileTest // 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 @@ -292,6 +322,13 @@ public class StockholmFileTest 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);