X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2FAAFrequency.java;h=36534a36a9eaed2a7da3acb49c312974dc1e948a;hb=7897c6cb08b496285bcb5fa9ed2d9f7d887d0068;hp=a4418a4c89b748f8d243fc8edf598871c300199c;hpb=49685e6426d5ac136dce4907196751680c667670;p=jalview.git diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index a4418a4..36534a3 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -23,24 +23,28 @@ import java.util.*; import jalview.datamodel.*; /** - * Takes in a vector or array of sequences and column start and column end - * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied. - * This class is used extensively in calculating alignment colourschemes - * that depend on the amount of conservation in each alignment column. + * Takes in a vector or array of sequences and column start and column end and + * returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied. + * This class is used extensively in calculating alignment colourschemes that + * depend on the amount of conservation in each alignment column. + * * @author $author$ * @version $Revision$ */ public class AAFrequency { - //No need to store 1000s of strings which are not - //visible to the user. + // No need to store 1000s of strings which are not + // visible to the user. public static final String MAXCOUNT = "C"; + public static final String MAXRESIDUE = "R"; + public static final String PID_GAPS = "G"; + public static final String PID_NOGAPS = "N"; public static final Hashtable[] calculate(Vector sequences, int start, - int end) + int end) { SequenceI[] seqs = new SequenceI[sequences.size()]; int width = 0; @@ -65,9 +69,8 @@ public class AAFrequency return reply; } - public static final void calculate(SequenceI[] sequences, - int start, int end, - Hashtable[] result) + public static final void calculate(SequenceI[] sequences, int start, + int end, Hashtable[] result) { Hashtable residueHash; int maxCount, nongap, i, j, v, jSize = sequences.length; @@ -106,7 +109,7 @@ public class AAFrequency } else if ('a' <= c && c <= 'z') { - c -= 32; //('a' - 'A'); + c -= 32; // ('a' - 'A'); } nongap++; @@ -128,11 +131,11 @@ public class AAFrequency if (values[v] > maxCount) { - maxResidue = String.valueOf( (char) v); + maxResidue = String.valueOf((char) v); } else if (values[v] == maxCount) { - maxResidue += String.valueOf( (char) v); + maxResidue += String.valueOf((char) v); } maxCount = values[v]; } @@ -145,10 +148,10 @@ public class AAFrequency residueHash.put(MAXCOUNT, new Integer(maxCount)); residueHash.put(MAXRESIDUE, maxResidue); - percentage = ( (float) maxCount * 100) / (float) jSize; + percentage = ((float) maxCount * 100) / (float) jSize; residueHash.put(PID_GAPS, new Float(percentage)); - percentage = ( (float) maxCount * 100) / (float) nongap; + percentage = ((float) maxCount * 100) / (float) nongap; residueHash.put(PID_NOGAPS, new Float(percentage)); result[i] = residueHash; }