From: Jim Procter Date: Thu, 30 Oct 2014 16:51:10 +0000 (+0000) Subject: JAL-674 count number of annotation transferred in test X-Git-Tag: Jalview_2_9~155^2~15^2~13 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=02064f049e4309bc24792e99a133f56fb9c114d0;p=jalview.git JAL-674 count number of annotation transferred in test --- diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index 4dfd1af..8cf005b 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -25,13 +25,32 @@ public class Mapping StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); // Associate the 1GAQ pdb file with the subsequence 'imported' from another // source - PDBfile pde = ssm.setMapping(new SequenceI[] + PDBfile pde = ssm.setMapping(true, new SequenceI[] { sq }, new String[] { "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE); assertTrue("PDB File couldn't be found", pde != null); StructureMapping[] mp = ssm.getMapping(inFile); assertTrue("No mappings made.", mp != null && mp.length > 0); - boolean hasSecStr=false,hasTemp=false; + int nsecStr = 0, nsTemp = 0; + // test for presence of transferred annotation on sequence + for (AlignmentAnnotation alan : sq.getAnnotation()) + { + if (alan.hasIcons) + { + nsecStr++; + } + if (alan.graph == alan.LINE_GRAPH) + { + nsTemp++; + } + } + assertEquals( + "Only one secondary structure should be transferred to associated sequence.", + 1, nsecStr); + assertEquals( + "Only two line graphs should be transferred to associated sequence.", + 2, nsTemp); + // Now test the transfer function and compare annotated positions for (StructureMapping origMap:mp) { if (origMap.getSequence()==sq) @@ -87,22 +106,6 @@ public class Mapping } } } - hasSecStr = false; - hasTemp = false; - // test for presence of transferred annotation on sequence - for (AlignmentAnnotation alan : sq.getAnnotation()) - { - if (alan.hasIcons) - { - hasSecStr = true; - } - if (alan.graph == alan.LINE_GRAPH) - { - hasTemp = true; - } - } - assertTrue("No secondary structure transferred to associated sequence.",hasSecStr); - assertTrue("No temperature factor transferred to associated sequence.",hasTemp); } }