Merge branch 'JABAWS_Release_2_0'
[jabaws.git] / runner / compbio / pipeline / _jpred / Pairwise.java
diff --git a/runner/compbio/pipeline/_jpred/Pairwise.java b/runner/compbio/pipeline/_jpred/Pairwise.java
deleted file mode 100644 (file)
index 517f361..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (c) 2011 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-package compbio.pipeline._jpred;\r
-\r
-import java.io.BufferedInputStream;\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Set;\r
-\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.SequenceUtil;\r
-\r
-public class Pairwise {\r
-\r
-       private final List<FastaSequence> sequences; \r
-       final Set<PScore> pscores; \r
-       \r
-       public Pairwise(List<FastaSequence> sequences) {\r
-               this.sequences = sequences;\r
-               pscores = new HashSet<PScore>(); \r
-       }\r
-\r
-       void compare() {\r
-               for (int i = 0; i < sequences.size(); i++) {\r
-                       FastaSequence seq1 = sequences.get(i); \r
-                       System.out.println(seq1.getId());\r
-                       for (int j = i+1; j < sequences.size(); j++) {\r
-                               FastaSequence seq2 = sequences.get(j);\r
-                               PScore pscore = new PScore();\r
-                               pscore.name = seq1.getId();\r
-                               pscore.otherName = seq2.getId();\r
-                               pscores.add(pscore);\r
-                               compare(pscore, seq1.getSequence(), seq2.getSequence());\r
-                       }\r
-               }\r
-       }\r
-\r
-       void compare(PScore pscore, String seq1, String seq2) { \r
-               char[] chars1 = seq1.trim().toUpperCase().toCharArray(); \r
-               char[] chars2 = seq2.trim().toUpperCase().toCharArray();\r
-               if(chars1.length != chars2.length) { \r
-                       throw new IllegalArgumentException("Different lenght sequence are provided but same expected! \n Sequence 1: \n" + pscore.name+ \r
-                                       "\n Length:"+chars1.length +"\n "+ \r
-                                       "Sequence 2: \n " + pscore.otherName + \r
-                                       " \n Lenght: " + chars2.length ); \r
-               }\r
-               compare(pscore, chars1, chars2); \r
-       }\r
-       \r
-       void compare(PScore pscore, char[] seq1, char[] seq2) { \r
-               int sameResedue = 0; \r
-               for (int i = 0; i < seq1.length; i++) {\r
-                       if(seq1[i]==seq2[i]) { \r
-                               sameResedue++;\r
-                       }\r
-               }\r
-               pscore.score = (double)sameResedue /seq1.length;\r
-               System.out.println(pscore.score*100);\r
-       }\r
-       \r
-       public static final void main(String[]  args) throws FileNotFoundException, IOException {\r
-               File in = new File(args[0]);\r
-               List<FastaSequence> fslist = SequenceUtil.readFasta(new BufferedInputStream(new FileInputStream(in)));\r
-               Pairwise pair = new Pairwise(fslist);\r
-               pair.compare(); \r
-               System.out.println(pair.pscores);\r
-       }\r
-}\r