From db8b5a2bbc50c28300729664f5a586b08748bb55 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 7 Apr 2006 13:48:39 +0000 Subject: [PATCH] Set all gaps to - symbol --- src/jalview/analysis/Conservation.java | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index b9b68ce..b914108 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,24 @@ 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); + + if(jalview.util.Comparison.isGap(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 +202,6 @@ public class Conservation residueHash.put("-", new Integer(1)); } } - } } //What is the count threshold to count the residues in residueHash() -- 1.7.10.2