X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2FStructureFrequency.java;h=0c9f8308a4d329233f4f195bfbbe2c9daf324ed1;hb=6bd9630607bd38aaf9b42738a0ae90de8fe5c6e8;hp=42e8847fb301940d3c88188fc0c7ec9748b0d38b;hpb=3385d3fe7b3acd45dc5aaa3c7d73f7cce5ea7457;p=jalview.git diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 42e8847..0c9f830 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -15,6 +15,7 @@ * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ + package jalview.analysis; import java.util.*; @@ -121,6 +122,9 @@ public class StructureFrequency } else { + bpEnd = findPair(rna, i); + if (bpEnd>-1) + { for (j = 0; j < jSize; j++) // foreach row { if (sequences[j] == null) @@ -129,11 +133,8 @@ public class StructureFrequency .println("WARNING: Consensus skipping null sequence - possible race condition."); continue; } - seq = sequences[j].getSequence(); - - if (seq.length > i) + c = sequences[j].getCharAt(i); { - c = seq[i]; // standard representation for gaps in sequence and structure if (c == '.' || c == ' ') @@ -146,8 +147,7 @@ public class StructureFrequency values['-']++; continue; } - bpEnd = findPair(rna, i); - cEnd = seq[bpEnd]; + cEnd = sequences[j].getCharAt(bpEnd); if (checkBpType(c, cEnd)) { values['(']++; // H means it's a helix (structured) @@ -157,6 +157,7 @@ public class StructureFrequency maxResidue = "("; } } + } // nonGap++; } // UPDATE this for new values @@ -405,7 +406,7 @@ public class StructureFrequency public static int[] extractProfile(Hashtable hconsensus, boolean ignoreGapsInConsensusCalculation) { - int[] rtnval = new int[51]; // 2*(5*5)+1 + int[] rtnval = new int[52]; // 2*(5*5)+2 int[][] profile = (int[][]) hconsensus.get(StructureFrequency.PROFILE); int[][] pairs = (int[][]) hconsensus .get(StructureFrequency.PAIRPROFILE); @@ -429,15 +430,17 @@ public class StructureFrequency } jalview.util.QuickSort.sort(vl, ca); - rtnval[0] = 1; + rtnval[0] = 2; + rtnval[1] = 0; for (int c = 624; c > 0; c--) { if (vl[c] > 0) { rtnval[rtnval[0]++] = ((int[]) ca[c])[0]; rtnval[rtnval[0]++] = ((int[]) ca[c])[1]; - rtnval[rtnval[0]++] = (int) ((float) vl[c] * 100f / (float) profile[1][ignoreGapsInConsensusCalculation ? 1 + rtnval[rtnval[0]] = (int) ((float) vl[c] * 100f / (float) profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]); + rtnval[1]+=rtnval[rtnval[0]++]; } }