X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FConservation.java;h=4a93eef2dedb82a35b69a6ca40d596a9464a279d;hb=597b36936d89f172923e3321c8c5ea322cc5e5e5;hp=db572ac8f8f6c1aefdefcf91c1ff48d50d1a08a1;hpb=a49fdebf932bc4dbb55d3aaa9cc35ec2cfb181ff;p=jalview.git diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index db572ac..4a93eef 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -64,7 +64,7 @@ public class Conservation { if (sequences.elementAt(j) instanceof Sequence) { Sequence s = (Sequence)sequences.elementAt(j); - if (s.getSequence().length() > i) { + if (s.getLength() > i) { String res = s.getSequence().substring(i,i+1); if (residueHash.containsKey(res)) { @@ -125,6 +125,9 @@ public class Conservation { int count = 0; for (int i = 0; i < sequences.size();i++) { + if( j+1 > ((Sequence)sequences.elementAt(i)).getSequence().length()) + { count++; continue;} + String tmp = ((Sequence)sequences.elementAt(i)).getSequence().substring(j,j+1); if (tmp.equals(" ") || tmp.equals(".") || tmp.equals("-")) { count++; @@ -140,42 +143,46 @@ public class Conservation { int totGaps = countGaps(i); float pgaps = (float)totGaps*100/(float)sequences.size(); - if (percentageGaps > pgaps) { + if (percentageGaps > pgaps) + { Hashtable resultHash = (Hashtable)total.elementAt(i); //Now find the verdict int count = 0; Enumeration e3 = resultHash.keys(); - while (e3.hasMoreElements()) { + while (e3.hasMoreElements()) + { String type = (String)e3.nextElement(); Integer result = (Integer)resultHash.get(type); //Do we want to count +ve conservation or +ve and -ve cons.? - if (consflag) { - if (result.intValue() == 1) { + if (consflag) + { + if (result.intValue() == 1) count++; - } - } else { - if (result.intValue() != -1) { + } + else + { + if (result.intValue() != -1) count++; - } } } - if (count < 10) { + if (count < 10) consString = consString + String.valueOf(count); - } else { + else consString = consString + "*"; - } - } else { + + } + else + { consString = consString + "-"; } } consSequence = new DrawableSequence(name,consString,start,end); - } public jalview.gui.DrawableSequence getConsSequence() {