public class SequenceUtilTester {\r
\r
@Test()\r
- public void testisNonAmbNucleotideSequence() {\r
+ public void isNonAmbNucleotideSequence() {\r
String dnaseq = "atgatTGACGCTGCTGatgtcgtgagtgga";\r
assertTrue(SequenceUtil.isNonAmbNucleotideSequence(dnaseq));\r
String dirtyDnaseq = "atgAGTggt\taGGTgc\ncgcACTgc gACtcgcGAt cgA ";\r
assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
// String ambDna = "AGTCRYMKSWHBVDN"; // see IUPAC Nucleotide Code\r
assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
-\r
}\r
\r
@Test()\r
- public void testCleanSequence() {\r
+ public void CleanSequence() {\r
String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
- assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),\r
- SequenceUtil.cleanSequence(dirtySeq));\r
+ assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),SequenceUtil.cleanSequence(dirtySeq));\r
}\r
\r
@Test()\r
- public void testDeepCleanSequence() {\r
+ public void DeepCleanSequence() {\r
String dirtySeq = "a!t?g.A;GTggt\ta12GGTgc\ncgc23AC\rTgc gAC<>.,?!|\\|/t@cg-c¬GA=_+(0){]}[:£$&^*\"t cgA ";\r
- assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),\r
- SequenceUtil.deepCleanSequence(dirtySeq));\r
+ assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),SequenceUtil.deepCleanSequence(dirtySeq));\r
}\r
\r
@Test()\r
- public void testisProteinSequence() {\r
+ public void isProteinSequence() {\r
String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
assertFalse(SequenceUtil.isProteinSequence(dirtySeq));\r
String notaSeq = "atgc1tgatgcatgcatgatgctga";\r
}\r
\r
@Test()\r
- public void testCleanProteinSequence() {\r
+ public void CleanProteinSequence() {\r
String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
assertFalse(SequenceUtil.isProteinSequence(dirtySeq));\r
// This will still be NON protein sequence despite having only correct\r
// letters because the letters match perfectly the nucleotide sequence!\r
- assertFalse(SequenceUtil.isProteinSequence(SequenceUtil\r
- .cleanProteinSequence(dirtySeq)));\r
+ assertFalse(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(dirtySeq)));\r
\r
String notaSeq = "atgc1tgatgcatgcatgatgmctga";\r
assertFalse(SequenceUtil.isProteinSequence(notaSeq));\r
- assertTrue(SequenceUtil.isProteinSequence(SequenceUtil\r
- .cleanProteinSequence(notaSeq)));\r
+ assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(notaSeq)));\r
\r
String AAseq = "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQL";\r
assertTrue(SequenceUtil.isProteinSequence(AAseq));\r
- assertTrue(SequenceUtil.isProteinSequence(SequenceUtil\r
- .cleanProteinSequence(AAseq)));\r
+ assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(AAseq)));\r
AAseq += "XU";\r
\r
assertFalse(SequenceUtil.isProteinSequence(AAseq));\r
- assertTrue(SequenceUtil.isProteinSequence(SequenceUtil\r
- .cleanProteinSequence(AAseq)));\r
+ assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(AAseq)));\r
}\r
\r
@Test()\r
- public void testReadWriteFasta() {\r
-\r
+ public void ReadWriteFasta() {\r
try {\r
- FileInputStream fio = new FileInputStream(\r
- AllTestSuit.TEST_DATA_PATH + "TO1381.fasta");\r
+ FileInputStream fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta");\r
assertNotNull(fio);\r
List<FastaSequence> fseqs = SequenceUtil.readFasta(fio);\r
assertNotNull(fseqs);\r
assertEquals(3, fseqs.size());\r
assertEquals(3, fseqs.size());\r
fio.close();\r
- FileOutputStream fou = new FileOutputStream(\r
- AllTestSuit.TEST_DATA_PATH + "TO1381.fasta.written");\r
+ FileOutputStream fou = new FileOutputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta.written");\r
SequenceUtil.writeFasta(fou, fseqs);\r
fou.close();\r
- FileOutputStream fou20 = new FileOutputStream(\r
- AllTestSuit.TEST_DATA_PATH + "TO1381.fasta20.written");\r
+ FileOutputStream fou20 = new FileOutputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta20.written");\r
SequenceUtil.writeFasta(fou20, fseqs, 21);\r
fou20.close();\r
-\r
} catch (FileNotFoundException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
}\r
\r
- /**\r
- * This test tests the loading of horizontally formatted Jronn output file\r
- */\r
+ // This method tests the loading of horizontally formatted Jronn output file\r
@Test\r
- public void loadJronnFile() {\r
+ public void LoadJronnFile() {\r
\r
FileInputStream fio;\r
try {\r
Score aseq = aseqs.get("Foobar");\r
assertNotNull(aseq);\r
assertNotNull(aseq.getScores());\r
- // System.out.println(aseq);\r
assertEquals(aseq.getScores().size(), aseq.getScores().size());\r
fio.close();\r
} catch (FileNotFoundException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
-\r
}\r
\r
enum Trial {\r
*/\r
@SuppressWarnings("unchecked")\r
@Test\r
- public void testReadDisemblResults() {\r
-\r
-\r
+ public void ReadDisemblResults() {\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
+ 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
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
+ for (String[] se:new String[][] { { "355","368"}}) {\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
+ for (String[] se:new String[][] { { "190","204"}}) {\r
rset.add(new Range(se));\r
}\r
ranges.put(DisemblResult.HOTLOOPS.toString(), rset);\r
_values.put("Foobar_dundeefriends", values);\r
FileInputStream fio;\r
try {\r
- fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
- + "disembl.out");\r
+ fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "disembl.out");\r
Map<String, Set<Score>> aseqs = SequenceUtil.readDisembl(fio);\r
assertNotNull(aseqs);\r
assertEquals(aseqs.size(), 3);\r
ScoreManager sman = ScoreManager.newInstance(aseqs);\r
\r
for (String fs : aseqs.keySet()) {\r
- assertTrue(" Foobar_dundeefriends Foobar dundeefriends "\r
- .contains(fs));\r
+ assertTrue(" Foobar_dundeefriends Foobar dundeefriends ".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
+ if (_ranges.containsKey(fs)) {\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
fail(e.getLocalizedMessage());\r
}\r
}\r
+\r
/**\r
- * This test tests the loading of horizontally formatted Jronn output file\r
+ * This method tests the loading of horizontally formatted Jronn output file\r
* \r
* First sequence:\r
* \r
*/\r
@SuppressWarnings("unchecked")\r
@Test\r
- public void testReadGlobPlotResults() {\r
+ public void ReadGlobPlotResults() {\r
\r
FileInputStream fio;\r
try {\r
- fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
- + "globplot.out");\r
+ fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "globplot.out");\r
HashMap<String, Set<Score>> aseqs = SequenceUtil.readGlobPlot(fio);\r
assertNotNull(aseqs);\r
assertEquals(aseqs.size(), 3);\r
sm.writeOut(new PrintWriter(System.out, true));\r
\r
for (Score score : scores) {\r
-\r
- if (score.getMethod()\r
- .equals(GlobProtResult.Disorder.toString())) {\r
+ if (score.getMethod().equals(GlobProtResult.Disorder.toString())) {\r
assertEquals(score.getRanges().size(), 7);\r
assertTrue(score.getScores().isEmpty());\r
}\r
}\r
\r
@Test\r
- public void testReadIUPredForShortAndLongDisorder() {\r
+ public void ReadIUPredForShortAndLongDisorder() {\r
try {\r
- Map<String, Score> scores = SequenceUtil.readIUPred(new File(\r
- AllTestSuit.TEST_DATA_PATH, "out.long"));\r
+ Map<String, Score> scores = SequenceUtil.readIUPred(new File(AllTestSuit.TEST_DATA_PATH, "out.long"));\r
ScoreManager man = ScoreManager.newInstanceSingleScore(scores);\r
- // man.writeOut(new PrintWriter(System.out, true));\r
assertNotNull(scores);\r
assertEquals(3, scores.size());\r
\r
assertEquals(0, score.getRanges().size());\r
assertEquals(513, score.getScores().size());\r
assertEquals("Long", score.getMethod());\r
-\r
} catch (IOException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
\r
@Test\r
- public void testReadIUPredForGlobDomain() {\r
+ public void ReadIUPredForGlobDomain() {\r
try {\r
- Map<String, Score> scores = SequenceUtil.readIUPred(new File(\r
- AllTestSuit.TEST_DATA_PATH, "output.glob"));\r
+ Map<String, Score> scores = SequenceUtil.readIUPred(new File(AllTestSuit.TEST_DATA_PATH, "output.glob"));\r
assertNotNull(scores);\r
assertEquals(2, scores.size());\r
ScoreManager man = ScoreManager.newInstanceSingleScore(scores);\r
- // man.writeOut(new PrintWriter(System.out, true));\r
assertEquals(2, man.getNumberOfSeq());\r
Score score = scores.get("P53_HUMA");\r
assertNotNull(score);\r
assertEquals(2, score.getRanges().size());\r
assertEquals(0, score.getScores().size());\r
assertEquals("Glob", score.getMethod());\r
-\r
score = scores.get("Foobar_dundeefriends");\r
assertEquals(0, score.getRanges().size());\r
} catch (IOException e) {\r
fail(e.getLocalizedMessage());\r
}\r
}\r
+\r
@Test\r
- public void testReadAAConResults() {\r
+ public void ReadAAConResults() {\r
try {\r
- InputStream inStream = new FileInputStream(\r
- AllTestSuit.TEST_DATA_PATH + "aacon_results.txt");\r
+ InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "aacon_results.txt");\r
HashSet<Score> result = SequenceUtil.readAAConResults(inStream);\r
inStream.close();\r
assertNotNull(result);\r
assertEquals(result.size(), 18);\r
\r
- inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
- + "aacon_result_single.out");\r
+ inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "aacon_result_single.out");\r
result = SequenceUtil.readAAConResults(inStream);\r
inStream.close();\r
assertNotNull(result);\r
fail(e.getMessage());\r
}\r
}\r
+ @Test\r
+ public void ReadJpredResults() {\r
+ try {\r
+ InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "Jpred.test1.out");\r
+ List<FastaSequence> result = SequenceUtil.readJpredFile(inStream);\r
+ inStream.close();\r
+ assertNotNull(result);\r
+ assertEquals(result.size(), 19);\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ }\r
+ }\r
}\r