From 5c5161b61d3dc11a22c10fc176f0f967ed40bf52 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 12 Aug 2016 14:49:08 +0100 Subject: [PATCH] JAL-1841 count (logo height) is valid pairs only; detect base-gap pair --- src/jalview/analysis/StructureFrequency.java | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 29d02fe..479c8562 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -24,6 +24,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.util.Comparison; import jalview.util.Format; import java.util.ArrayList; @@ -151,20 +152,15 @@ public class StructureFrequency .println("WARNING: Consensus skipping null sequence - possible race condition."); continue; } - c = sequences[j].getCharAt(i); - // standard representation for gaps in sequence and structure - if (c == '.' || c == ' ') - { - c = '-'; - } + c = sequences[j].getCharAt(i); + cEnd = sequences[j].getCharAt(bpEnd); - if (c == '-') + if (Comparison.isGap(c) || Comparison.isGap(cEnd)) { values['-']++; continue; } - cEnd = sequences[j].getCharAt(bpEnd); /* * ensure upper-case for counting purposes @@ -204,7 +200,17 @@ public class StructureFrequency residueHash.put(PAIRPROFILE, pairs); } - int count = Math.max(canonicalOrWobblePairCount, otherPairCount); + + /* + * the count is the number of valid pairs (as a percentage, determines + * the relative size of the profile logo) + */ + int count = canonicalOrWobblePairCount; + + /* + * currently displaying as '(' if most pairs are valid, or as + * '[' if there are more invalid than valid pairs + */ if (!maxResidue.equals("-")) { maxResidue = canonicalOrWobblePairCount >= otherPairCount ? "(" -- 1.7.10.2