X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FConservation.java;h=0aa980534ccd40e78a229de2a828564bf8415469;hb=9f95d8f9e281436450419985ab58be83022859b4;hp=b9b68cec25198d3bf1a175cf0efb7e1d09818bff;hpb=83b55697263efc7b0c660eba6ea7091f6904257d;p=jalview.git diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index b9b68ce..0aa9805 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -145,7 +145,9 @@ public class Conservation { Hashtable resultHash, residueHash, ht; int count, thresh, j, jSize = sequences.size(); - String sequence, res, type; + String type, res=null; + SequenceI sequence; + char c; Enumeration enumeration, enumeration2; for (int i = start; i <= end; i++) @@ -157,13 +159,25 @@ public class Conservation { // JBPNote - have to make sure elements of the sequences vector // are tested like this everywhere... - if (sequences.elementAt(j) instanceof Sequence) - { - sequence = ((Sequence) sequences.elementAt(j)).getSequence(); + sequence = (Sequence) sequences.elementAt(j); - if (sequence.length() > i) + if (sequence.getLength() > i) { - res = String.valueOf(Character.toUpperCase(sequence.charAt(i))); + c = sequence.getCharAt(i); + + // No need to check if its a '-' + if(c == '.' || c==' ') + c = '-'; + + if ('a' <= c && c <= 'z') + { + // TO UPPERCASE !!! + //Faster than toUpperCase + c -= ('a' - 'A') ; + } + + res = String.valueOf( c ); + if (residueHash.containsKey(res)) { @@ -189,7 +203,6 @@ public class Conservation residueHash.put("-", new Integer(1)); } } - } } //What is the count threshold to count the residues in residueHash()