From: jprocter Date: Thu, 31 May 2012 17:27:02 +0000 (+0100) Subject: test for JWS-35 - check that range and first value of prediction for each method... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=525f0045b3acc1dedbf16bd3c47e277c6f223c49;p=jabaws.git test for JWS-35 - check that range and first value of prediction for each method matches expected values --- diff --git a/testsrc/compbio/data/sequence/SequenceUtilTester.java b/testsrc/compbio/data/sequence/SequenceUtilTester.java index 2b2ca1a..e646c1e 100644 --- a/testsrc/compbio/data/sequence/SequenceUtilTester.java +++ b/testsrc/compbio/data/sequence/SequenceUtilTester.java @@ -35,6 +35,7 @@ import java.util.Set; import org.testng.annotations.Test; import compbio.metadata.AllTestSuit; +import compbio.runner.disorder.Disembl; public class SequenceUtilTester { @@ -188,6 +189,35 @@ public class SequenceUtilTester { @Test public void testReadDisemblResults() { + + Map>> _ranges=new HashMap>>(); + Map> ranges=new HashMap>(); + Map> _values=new HashMap>(); + Map values = new HashMap(); + Set rset; + rset = new HashSet(); + for (String[] se:new String[][] { { "34","41"},{"50","58"},{"83","91"},{"118","127"},{" 160","169"},{" 191","220"},{" 243","252"},{" 287","343"},{" 350","391"},{" 429","485"},{" 497","506"},{"539","547"}}) + { + rset.add(new Range(se)); + } + ranges.put(DisemblResult.COILS.toString(), rset); + values.put(DisemblResult.COILS.toString(), Float.valueOf(0.86010f)); + rset = new HashSet(); + for (String[] se:new String[][] { { "355","368"}}) + { + rset.add(new Range(se)); + } + ranges.put(DisemblResult.REM465.toString(), rset); + values.put(DisemblResult.REM465.toString(), Float.valueOf(0.88512f)); + rset = new HashSet(); + for (String[] se:new String[][] { { "190","204"}}) + { + rset.add(new Range(se)); + } + ranges.put(DisemblResult.HOTLOOPS.toString(), rset); + values.put(DisemblResult.HOTLOOPS.toString(), Float.valueOf(0.37094f)); + _ranges.put("Foobar_dundeefriends", ranges); + _values.put("Foobar_dundeefriends", values); FileInputStream fio; try { fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH @@ -202,6 +232,13 @@ public class SequenceUtilTester { .contains(fs)); Set scores = aseqs.get(fs); assertEquals(scores.size(), 3); + for (Score sc:scores) { + if (_ranges.containsKey(fs)) + { + assertEquals("Checking range for Method "+sc.getMethod(),_ranges.get(fs).get(sc.getMethod()), sc.getRanges()); + assertEquals("Checking first value for Method "+sc.getMethod(), _values.get(fs).get(sc.getMethod()), sc.getScores().get(0)); + } + } } fio.close(); } catch (FileNotFoundException e) { @@ -215,7 +252,6 @@ public class SequenceUtilTester { fail(e.getLocalizedMessage()); } } - /** * This test tests the loading of horizontally formatted Jronn output file * @@ -302,19 +338,19 @@ public class SequenceUtilTester { assertEquals(0, score.getRanges().size()); assertEquals(568, score.getScores().size()); assertEquals("Long", score.getMethod()); - + score = scores.get("Foobar"); assertNotNull(score); assertEquals(0, score.getRanges().size()); assertEquals(481, score.getScores().size()); assertEquals("Long", score.getMethod()); - + score = scores.get("dundeefriends"); assertNotNull(score); assertEquals(0, score.getRanges().size()); assertEquals(513, score.getScores().size()); assertEquals("Long", score.getMethod()); - + } catch (IOException e) { e.printStackTrace(); fail(e.getLocalizedMessage());