From 75d5069a8e8942343a999fe4d474079856fbc5d3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 18 Nov 2016 08:55:47 +0000 Subject: [PATCH] JAL-98 with the two types missing from last commit Profiles[I] ! --- src/jalview/datamodel/Profiles.java | 43 ++++++++++++++++++++++++++++++ src/jalview/datamodel/ProfilesI.java | 12 +++++++++ src/jalview/workers/ConsensusThread.java | 3 ++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/jalview/datamodel/Profiles.java create mode 100644 src/jalview/datamodel/ProfilesI.java diff --git a/src/jalview/datamodel/Profiles.java b/src/jalview/datamodel/Profiles.java new file mode 100644 index 0000000..98a8c6d --- /dev/null +++ b/src/jalview/datamodel/Profiles.java @@ -0,0 +1,43 @@ +package jalview.datamodel; + +public class Profiles implements ProfilesI +{ + + private ProfileI[] profiles; + + public Profiles(ProfileI[] p) + { + profiles = p; + } + + /** + * Returns the profile for the given column, or null if none found + * + * @param col + */ + @Override + public ProfileI get(int col) + { + return profiles != null && col >= 0 && col < profiles.length ? profiles[col] + : null; + } + + /** + * Returns the first column (base 0) covered by the profiles + */ + @Override + public int getStartColumn() + { + return 0; + } + + /** + * Returns the last column (base 0) covered by the profiles + */ + @Override + public int getEndColumn() + { + return profiles == null ? 0 : profiles.length - 1; + } + +} diff --git a/src/jalview/datamodel/ProfilesI.java b/src/jalview/datamodel/ProfilesI.java new file mode 100644 index 0000000..6719de6 --- /dev/null +++ b/src/jalview/datamodel/ProfilesI.java @@ -0,0 +1,12 @@ +package jalview.datamodel; + +public interface ProfilesI +{ + + ProfileI get(int i); + + int getStartColumn(); + + int getEndColumn(); + +} diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java index b6c7a91..debe45d 100644 --- a/src/jalview/workers/ConsensusThread.java +++ b/src/jalview/workers/ConsensusThread.java @@ -200,7 +200,8 @@ public class ConsensusThread extends AlignCalcWorker { long nseq = getSequences().length; - AAFrequency.completeConsensus(consensusAnnotation, hconsensus, 0, + AAFrequency.completeConsensus(consensusAnnotation, hconsensus, + hconsensus.getStartColumn(), hconsensus.getEndColumn() + 1, alignViewport.isIgnoreGapsConsensus(), alignViewport.isShowSequenceLogo(), nseq); -- 1.7.10.2