test for JWS-35 - check that range and first value of prediction for each method...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 31 May 2012 17:27:02 +0000 (18:27 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 31 May 2012 17:27:02 +0000 (18:27 +0100)
testsrc/compbio/data/sequence/SequenceUtilTester.java

index 2b2ca1a..e646c1e 100644 (file)
@@ -35,6 +35,7 @@ import java.util.Set;
 import org.testng.annotations.Test;\r
 \r
 import compbio.metadata.AllTestSuit;\r
+import compbio.runner.disorder.Disembl;\r
 \r
 public class SequenceUtilTester {\r
 \r
@@ -188,6 +189,35 @@ public class SequenceUtilTester {
        @Test\r
        public void testReadDisemblResults() {\r
 \r
+\r
+               Map<String, Map<String,Set<Range>>> _ranges=new HashMap<String, Map<String,Set<Range>>>();\r
+               Map<String, Set<Range>> ranges=new HashMap<String,Set<Range>>();\r
+               Map<String,Map<String, Float>>  _values=new HashMap<String, Map<String,Float>>();\r
+               Map<String, Float> values = new HashMap<String, Float>();\r
+               Set<Range> rset;\r
+               rset = new HashSet<Range>();\r
+               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"}})\r
+               {\r
+                       rset.add(new Range(se));\r
+               }\r
+               ranges.put(DisemblResult.COILS.toString(), rset);\r
+               values.put(DisemblResult.COILS.toString(), Float.valueOf(0.86010f));\r
+               rset = new HashSet<Range>();\r
+               for (String[] se:new String[][] { { "355","368"}})\r
+               {\r
+                       rset.add(new Range(se));\r
+               }\r
+               ranges.put(DisemblResult.REM465.toString(), rset);\r
+               values.put(DisemblResult.REM465.toString(), Float.valueOf(0.88512f));\r
+               rset = new HashSet<Range>();\r
+               for (String[] se:new String[][] { { "190","204"}})\r
+               {\r
+                       rset.add(new Range(se));\r
+               }\r
+               ranges.put(DisemblResult.HOTLOOPS.toString(), rset);\r
+               values.put(DisemblResult.HOTLOOPS.toString(), Float.valueOf(0.37094f));\r
+               _ranges.put("Foobar_dundeefriends", ranges);\r
+               _values.put("Foobar_dundeefriends", values);\r
                FileInputStream fio;\r
                try {\r
                        fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
@@ -202,6 +232,13 @@ public class SequenceUtilTester {
                                                .contains(fs));\r
                                Set<Score> scores = aseqs.get(fs);\r
                                assertEquals(scores.size(), 3);\r
+                               for (Score sc:scores) {\r
+                                       if (_ranges.containsKey(fs))\r
+                                       {\r
+                                       assertEquals("Checking range for Method "+sc.getMethod(),_ranges.get(fs).get(sc.getMethod()), sc.getRanges());\r
+                                       assertEquals("Checking first value for Method "+sc.getMethod(), _values.get(fs).get(sc.getMethod()), sc.getScores().get(0));\r
+                                       }\r
+                               }\r
                        }\r
                        fio.close();\r
                } catch (FileNotFoundException e) {\r
@@ -215,7 +252,6 @@ public class SequenceUtilTester {
                        fail(e.getLocalizedMessage());\r
                }\r
        }\r
-\r
        /**\r
         * This test tests the loading of horizontally formatted Jronn output file\r
         * \r
@@ -302,19 +338,19 @@ public class SequenceUtilTester {
                        assertEquals(0, score.getRanges().size());\r
                        assertEquals(568, score.getScores().size());\r
                        assertEquals("Long", score.getMethod());\r
-                       \r
+\r
                        score = scores.get("Foobar");\r
                        assertNotNull(score);\r
                        assertEquals(0, score.getRanges().size());\r
                        assertEquals(481, score.getScores().size());\r
                        assertEquals("Long", score.getMethod());\r
-                       \r
+\r
                        score = scores.get("dundeefriends");\r
                        assertNotNull(score);\r
                        assertEquals(0, score.getRanges().size());\r
                        assertEquals(513, score.getScores().size());\r
                        assertEquals("Long", score.getMethod());\r
-                       \r
+\r
                } catch (IOException e) {\r
                        e.printStackTrace();\r
                        fail(e.getLocalizedMessage());\r