Not used in Jalview
authoramwaterhouse <Andrew Waterhouse>
Thu, 30 Jun 2005 14:44:15 +0000 (14:44 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 30 Jun 2005 14:44:15 +0000 (14:44 +0000)
src/jalview/analysis/AlignmentUtil.java [deleted file]
src/jalview/analysis/CompareAlignments.java [deleted file]

diff --git a/src/jalview/analysis/AlignmentUtil.java b/src/jalview/analysis/AlignmentUtil.java
deleted file mode 100755 (executable)
index a2e1c71..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
-*/\r
-package jalview.analysis;\r
-\r
-import jalview.datamodel.*;\r
-\r
-import jalview.util.*;\r
-\r
-import java.util.*;\r
-\r
-\r
-public class AlignmentUtil {\r
-    private AlignmentUtil() {\r
-    }\r
-\r
-    public static int[][] percentIdentity2(AlignmentI align) {\r
-        return percentIdentity2(align, 0, align.getWidth() - 1);\r
-    }\r
-\r
-    public static int[][] percentIdentity2(AlignmentI align, int start, int end) {\r
-        int[][] cons2 = new int[align.getWidth()][24];\r
-\r
-        // Initialize the array\r
-        for (int j = 0; j < 24; j++) {\r
-            for (int i = 0; i < align.getWidth(); i++) {\r
-                cons2[i][j] = 0;\r
-            }\r
-        }\r
-\r
-        return cons2;\r
-    }\r
-\r
-    public static int getPixelHeight(int i, int j, int charHeight) {\r
-        int h = 0;\r
-\r
-        while (i < j) {\r
-            h += charHeight;\r
-            i++;\r
-        }\r
-\r
-        return h;\r
-    }\r
-\r
-    public static Vector substitution_rates(AlignmentI align, int start, int end) {\r
-        Vector rates = new Vector();\r
-\r
-        int len = (end - start + 1);\r
-\r
-        // Turn seqs into char arrays\r
-        int[][] seqint = new int[align.getHeight()][len];\r
-\r
-        for (int j = 0; j < align.getHeight(); j++) {\r
-            SequenceI seq = align.getSequenceAt(j);\r
-\r
-            for (int i = 0; i < len; i++) {\r
-                char c = seq.getCharAt((start + i) - 1);\r
-\r
-                if (c == 'A') {\r
-                    seqint[j][i] = 0;\r
-                } else if (c == 'C') {\r
-                    seqint[j][i] = 1;\r
-                } else if (c == 'T') {\r
-                    seqint[j][i] = 2;\r
-                } else if (c == 'G') {\r
-                    seqint[j][i] = 3;\r
-                } else {\r
-                    seqint[j][i] = -1;\r
-                }\r
-            }\r
-        }\r
-\r
-        //     print_matrix(seqint,2,len);     for (int j = 0; j < align.getHeight(); j++) {\r
-        for (int j = 0; j < align.getHeight(); j++) {\r
-            for (int k = 0; k < align.getHeight(); k++) {\r
-                int[][] counts = new int[4][4];\r
-                int tot = 0;\r
-                int[] tots = new int[4];\r
-                int fulltot = 0;\r
-                int[] fulltots = new int[4];\r
-\r
-                for (int i = 0; i < len; i++) {\r
-                    if (k != j) {\r
-                        //                     System.out.println("Seq " + j + " " + k + " " + i + " " + seqint[j][i] + " " + seqint[k][i]);\r
-                        if ((seqint[j][i] >= 0) && (seqint[k][i] >= 0)) {\r
-                            counts[seqint[k][i]][seqint[j][i]]++;\r
-\r
-                            //  print_matrix(counts,4,4);\r
-                            tots[seqint[j][i]]++;\r
-                            tot++;\r
-                        }\r
-\r
-                        if (seqint[j][i] != -1) {\r
-                            fulltots[seqint[j][i]]++;\r
-                            fulltot++;\r
-                        }\r
-                    }\r
-                }\r
-\r
-                if (k != j) {\r
-                    System.out.println();\r
-\r
-                    System.out.println("Sequence " +\r
-                        align.getSequenceAt(j).getName() + " " +\r
-                        align.getSequenceAt(k).getName());\r
-\r
-                    System.out.println();\r
-                    print_matrix(counts, 4, 4);\r
-                    System.out.println();\r
-\r
-                    double[][] out = new double[4][4]; // = constant_multiply_matrix(counts,1.0/tot,4,4);\r
-\r
-                    for (int i = 0; i < 4; i++) {\r
-                        for (int jj = 0; jj < 4; jj++) {\r
-                            out[i][jj] = (double) counts[i][jj] / tots[jj];\r
-                        }\r
-                    }\r
-\r
-                    print_matrix(out, 4, 4);\r
-                    System.out.println();\r
-\r
-                    System.out.print("RATES\t");\r
-                    System.out.print(align.getSequenceAt(j).getName() + "\t" +\r
-                        align.getSequenceAt(k).getName() + "\t");\r
-\r
-                    for (int i = 0; i < 4; i++) {\r
-                        for (int jj = 0; jj < 4; jj++) {\r
-                            Format.print(System.out, "%4.3f\t", out[i][jj]);\r
-                        }\r
-                    }\r
-\r
-                    System.out.println();\r
-\r
-                    for (int i = 0; i < 4; i++) {\r
-                        Format.print(System.out, "%4.3f\t",\r
-                            ((double) fulltots[i] * 1.0) / fulltot);\r
-                    }\r
-\r
-                    System.out.println();\r
-                    System.out.print("\nGC ");\r
-\r
-                    Format.print(System.out, "%4.3f\t",\r
-                        (double) ((100 * fulltots[1]) + fulltots[3]) / fulltot);\r
-\r
-                    System.out.print((fulltots[1] + fulltots[3]) + "\t" +\r
-                        fulltot);\r
-\r
-                    System.out.println();\r
-\r
-                    rates.addElement(out);\r
-                }\r
-            }\r
-        }\r
-\r
-        return rates;\r
-    }\r
-\r
-    public static double[][] constant_multiply_matrix(int[][] matrix, double c,\r
-        int n, int m) {\r
-        double[][] out = new double[n][m];\r
-\r
-        for (int i = 0; i < n; i++) {\r
-            for (int j = 0; j < m; j++) {\r
-                out[i][j] = matrix[i][j] * c;\r
-            }\r
-        }\r
-\r
-        return out;\r
-    }\r
-\r
-    public static void print_matrix(int[][] matrix, int n, int m) {\r
-        for (int i = 0; i < n; i++) {\r
-            for (int j = 0; j < m; j++) {\r
-                System.out.print(matrix[i][j] + "\t");\r
-            }\r
-\r
-            System.out.println();\r
-        }\r
-    }\r
-\r
-    public static void print_matrix(double[][] matrix, int n, int m) {\r
-        for (int i = 0; i < n; i++) {\r
-            for (int j = 0; j < m; j++) {\r
-                Format.print(System.out, "%4.3f\t", matrix[i][j]);\r
-            }\r
-\r
-            System.out.println();\r
-        }\r
-    }\r
-}\r
diff --git a/src/jalview/analysis/CompareAlignments.java b/src/jalview/analysis/CompareAlignments.java
deleted file mode 100755 (executable)
index 2752e6f..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
-*/\r
-package jalview.analysis;\r
-\r
-import jalview.datamodel.*;\r
-\r
-import jalview.io.*;\r
-\r
-import java.util.*;\r
-\r
-\r
-public class CompareAlignments {\r
-    Vector align;\r
-    String refId;\r
-    Vector ids;\r
-\r
-    public CompareAlignments(Vector align) {\r
-        this.align = align;\r
-\r
-        ids = new Vector();\r
-\r
-        Alignment al0 = (Alignment) align.elementAt(0);\r
-\r
-        for (int i = 0; i < al0.getHeight(); i++) {\r
-            SequenceI seq = al0.getSequenceAt(i);\r
-\r
-            ids.addElement(seq.getName());\r
-\r
-            if (i == 0) {\r
-                setReferenceId(seq.getName());\r
-            }\r
-        }\r
-    }\r
-\r
-    public void compare() {\r
-        Hashtable positions = new Hashtable();\r
-\r
-        for (int k = 0; k < ids.size(); k++) {\r
-            String id = (String) ids.elementAt(k);\r
-\r
-            System.out.println("Ids " + id + " " + refId);\r
-\r
-            if (!id.equals(refId)) {\r
-                Hashtable fullhash = new Hashtable();\r
-\r
-                for (int i = 0; i < align.size(); i++) {\r
-                    System.out.println("Alignment " + i);\r
-\r
-                    Alignment al = (Alignment) align.elementAt(i);\r
-\r
-                    SequenceI refseq = null;\r
-\r
-                    for (int j = 0; j < al.getHeight(); j++) {\r
-                        if (((SequenceI) al.getSequenceAt(j)).getName().equals(refId)) {\r
-                            refseq = (SequenceI) al.getSequenceAt(j);\r
-                        }\r
-                    }\r
-\r
-                    if (refseq != null) {\r
-                        System.out.println("Refseq " + refseq.getName());\r
-\r
-                        for (int jj = 0; jj < al.getHeight(); jj++) {\r
-                            SequenceI seq = (SequenceI) al.getSequenceAt(jj);\r
-\r
-                            if (seq.getName().equals(id)) {\r
-                                Hashtable hash = getAlignPositions(seq, refseq);\r
-\r
-                                Enumeration keys = hash.keys();\r
-\r
-                                while (keys.hasMoreElements()) {\r
-                                    Integer key = (Integer) keys.nextElement();\r
-\r
-                                    //                         System.out.println(key + " " + hash.get(key));\r
-                                    if (fullhash.get(key) == null) {\r
-                                        fullhash.put(key, new Vector());\r
-                                    }\r
-\r
-                                    Vector tmp = (Vector) fullhash.get(key);\r
-\r
-                                    tmp.addElement(hash.get(key));\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-\r
-                System.out.println("\nId " + id);\r
-\r
-                Enumeration keys = fullhash.keys();\r
-\r
-                int totdiff = 0;\r
-\r
-                while (keys.hasMoreElements()) {\r
-                    Integer key = (Integer) keys.nextElement();\r
-\r
-                    Vector tmp = (Vector) fullhash.get(key);\r
-\r
-                    int diff0 = ((Integer) tmp.elementAt(0)).intValue();\r
-                    ;\r
-\r
-                    int diff = 0;\r
-\r
-                    for (int l = 1; l < tmp.size(); l++) {\r
-                        diff += Math.abs(diff0 -\r
-                            ((Integer) tmp.elementAt(l)).intValue());\r
-                    }\r
-\r
-                    if (diff > 0) {\r
-                        totdiff++;\r
-                        System.out.print(id + " Ref pos " + key + " : " +\r
-                            diff0 + " " + diff + " : ");\r
-\r
-                        for (int l = 1; l < tmp.size(); l++) {\r
-                            System.out.print(diff0 -\r
-                                ((Integer) tmp.elementAt(l)).intValue() + " ");\r
-                        }\r
-\r
-                        System.out.println();\r
-                    }\r
-                }\r
-\r
-                System.out.println("Total " + id + " " + totdiff);\r
-            }\r
-        }\r
-    }\r
-\r
-    public void setReferenceId(String id) {\r
-        this.refId = id;\r
-    }\r
-\r
-    public Hashtable getAlignPositions(SequenceI seq1, SequenceI seq2) {\r
-        Hashtable hash = new Hashtable();\r
-\r
-        int i = 0;\r
-\r
-        int pos1 = 0;\r
-        int pos2 = 0;\r
-\r
-        while (i < seq1.getLength()) {\r
-            char c1 = seq1.getCharAt(i);\r
-            char c2 = seq2.getCharAt(i);\r
-\r
-            if (c1 != '-') {\r
-                pos1++;\r
-            }\r
-\r
-            if (c2 != '-') {\r
-                pos2++;\r
-            }\r
-\r
-            if (c1 != '-') {\r
-                hash.put(new Integer(pos1), new Integer(pos2));\r
-            }\r
-\r
-            i++;\r
-        }\r
-\r
-        return hash;\r
-    }\r
-}\r