From dcae10cf9fa776124780b659a5960b60b6508c1c Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 3 Sep 2013 14:25:28 +0100 Subject: [PATCH] JAL-920 compute a consensus for single sequence --- src/jalview/analysis/AAFrequency.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 = "-"; -- 1.7.10.2