Formatting
[jalview.git] / src / jalview / util / Comparison.java
index 50472a5..67a668a 100755 (executable)
@@ -1,26 +1,25 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2006 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2007 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.util;\r
 \r
 import jalview.datamodel.*;\r
 \r
-\r
 /**\r
  * DOCUMENT ME!\r
  *\r
@@ -124,7 +123,7 @@ public class Comparison
   static final int caseShift = 'a' - 'A';\r
 \r
   // Another pid with region specification\r
-  public final static  float PID(String seq1, String seq2, int start, int end)\r
+  public final static float PID(String seq1, String seq2, int start, int end)\r
   {\r
 \r
     int s1len = seq1.length();\r
@@ -142,17 +141,15 @@ public class Comparison
       start = len - 1; // we just use a single residue for the difference\r
     }\r
 \r
-\r
     int bad = 0;\r
     char chr1;\r
     char chr2;\r
 \r
-\r
     for (int i = start; i < len; i++)\r
     {\r
-      chr1 =  seq1.charAt(i) ;\r
+      chr1 = seq1.charAt(i);\r
 \r
-      chr2 =  seq2.charAt(i) ;\r
+      chr2 = seq2.charAt(i);\r
 \r
       if ('a' <= chr1 && chr1 <= 'z')\r
       {\r
@@ -167,10 +164,9 @@ public class Comparison
         chr2 -= caseShift;\r
       }\r
 \r
-\r
-      if (chr1!=chr2 && !isGap(chr1) && !isGap(chr2) )\r
+      if (chr1 != chr2 && !isGap(chr1) && !isGap(chr2))\r
       {\r
-          bad++;\r
+        bad++;\r
       }\r
     }\r
 \r
@@ -189,7 +185,7 @@ public class Comparison
     return (c == '-' || c == '.' || c == ' ') ? true : false;\r
   }\r
 \r
-  public static final boolean isNucleotide(SequenceI [] seqs)\r
+  public static final boolean isNucleotide(SequenceI[] seqs)\r
   {\r
     int i = 0, iSize = seqs.length, j, jSize;\r
     float nt = 0, aa = 0;\r
@@ -201,11 +197,15 @@ public class Comparison
       {\r
         c = seqs[i].getCharAt(j);\r
         if ('a' <= c && c <= 'z')\r
+        {\r
           c -= ('a' - 'A');\r
+        }\r
 \r
         if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')\r
+        {\r
           nt++;\r
-        else if (!jalview.util.Comparison.isGap( seqs[i].getCharAt(j)))\r
+        }\r
+        else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j)))\r
         {\r
           aa++;\r
         }\r
@@ -214,9 +214,13 @@ public class Comparison
     }\r
 \r
     if ( (nt / (nt + aa)) > 0.85f)\r
+    {\r
       return true;\r
+    }\r
     else\r
+    {\r
       return false;\r
+    }\r
 \r
   }\r
 }\r