From: Jim Procter Date: Wed, 21 Sep 2016 15:43:32 +0000 (+0100) Subject: JAL-2214 JAL-1841 compute canonical, canonicalAndWobble visually distinguish dominant... X-Git-Tag: Release_2_10_0~39^2~15 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=99d5403ff5f28eea4349d2d812efd64ac09e5d44;p=jalview.git JAL-2214 JAL-1841 compute canonical, canonicalAndWobble visually distinguish dominant proportions as (,[,{ in histogram label --- diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 29bdb7a..ad3f8d9 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -112,7 +112,7 @@ public class StructureFrequency for (int i = start; i < end; i++) // foreach column { - int canonicalOrWobblePairCount = 0; + int canonicalOrWobblePairCount = 0, canonical = 0; int otherPairCount = 0; int nongap = 0; maxResidue = "-"; @@ -176,14 +176,14 @@ public class StructureFrequency } if (Rna.isCanonicalOrWobblePair(c, cEnd)) { - values['(']++; - maxResidue = "("; canonicalOrWobblePairCount++; + if (Rna.isCanonicalPair(c, cEnd)) + { + canonical++; + } } else { - values['[']++; - maxResidue = "["; otherPairCount++; } pairs[c][cEnd]++; @@ -200,7 +200,9 @@ public class StructureFrequency residueHash.put(PAIRPROFILE, pairs); } - + values['('] = canonicalOrWobblePairCount; + values['['] = canonical; + values['{'] = otherPairCount; /* * the count is the number of valid pairs (as a percentage, determines * the relative size of the profile logo) @@ -208,13 +210,20 @@ public class StructureFrequency int count = canonicalOrWobblePairCount; /* - * currently displaying as '(' if most pairs are valid, or as - * '[' if there are more invalid than valid pairs + * display '(' if most pairs are canonical, or as + * '[' if there are more wobble pairs. */ - if (!maxResidue.equals("-")) + if (canonicalOrWobblePairCount > 0 || otherPairCount > 0) { - maxResidue = canonicalOrWobblePairCount >= otherPairCount ? "(" + if (canonicalOrWobblePairCount >= otherPairCount) + { + maxResidue = (canonicalOrWobblePairCount - canonical) < canonical ? "(" : "["; + } + else + { + maxResidue = "{"; + } } residueHash.put(MAXCOUNT, new Integer(count)); residueHash.put(MAXRESIDUE, maxResidue); @@ -233,9 +242,12 @@ public class StructureFrequency { values[')'] = values['(']; values[']'] = values['[']; + values['}'] = values['{']; values['('] = 0; values['['] = 0; - maxResidue = maxResidue.equals("(") ? ")" : "]"; + values['{'] = 0; + maxResidue = maxResidue.equals("(") ? ")" + : maxResidue.equals("[") ? "]" : "}"; residueHash = new Hashtable(); if (profile)