From: Jim Procter Date: Tue, 3 Sep 2013 13:25:28 +0000 (+0100) Subject: JAL-920 compute a consensus for single sequence X-Git-Tag: Jalview_2_9~200^2~23^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=dcae10cf9fa776124780b659a5960b60b6508c1c;p=jalview.git JAL-920 compute a consensus for single sequence --- diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 656cdcb..b24fff0 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -91,7 +91,7 @@ public class AAFrequency Hashtable residueHash; int maxCount, nongap, i, j, v, jSize = sequences.length; String maxResidue; - char c; + char c='-'; float percentage; int[] values = new int[255]; @@ -105,7 +105,7 @@ public class AAFrequency maxResidue = ""; nongap = 0; values = new int[255]; - + for (j = 0; j < jSize; j++) { if (sequences[j] == null) @@ -143,8 +143,11 @@ public class AAFrequency values['-']++; } } - - for (v = 'A'; v < 'Z'; v++) + if (jSize==1) + { + maxResidue = String.valueOf(c); + maxCount=1; + } else {for (v = 'A'; v < 'Z'; v++) { if (values[v] < 2 || values[v] < maxCount) { @@ -161,7 +164,7 @@ public class AAFrequency } maxCount = values[v]; } - + } if (maxResidue.length() == 0) { maxResidue = "-";