// a subclass of ViewportProperties similarly to ViewportRanges.
// Done here as a quick fix for JAL-2665
public static final String SEQ_GROUP_CHANGED = "Sequence group changed";
+
+ protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
- private String groupName;
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+ // end of event notification functionality initialisation
- private String description;
+ String groupName;
- private AnnotatedCollectionI context;
+ String description;
+
+ Conservation conserve;
- private Conservation conservationData;
+ Conservation conservationData;
- private ProfilesI consensusProfiles;
+ ProfilesI consensusProfiles;
- private ProfilesI hmmProfiles;
+ ProfilesI hmmProfiles;
- private boolean displayBoxes = true;
+ boolean displayBoxes = true;
- private boolean displayText = true;
+ boolean displayText = true;
- private boolean colourText = false;
+ boolean colourText = false;
/*
* true if the group is defined as a group on the alignment, false if it is
* just a selection
*/
- private boolean isDefined;
+ boolean isDefined = false;
/*
* after Olivier's non-conserved only character display
*/
- private boolean showNonconserved;
+ boolean showNonconserved = false;
/*
* sequences in the group
*/
- private List<SequenceI> sequences = new ArrayList<>();
+ private List<SequenceI> sequences;
/*
* representative sequence for this group (if any)
*/
- private SequenceI seqrep;
+ private SequenceI seqrep = null;
- private int width = -1;
+ int width = -1;
/*
* colour scheme applied to group if any
*/
public ResidueShaderI cs;
- // start column (base 0)
- private int startRes;
+ /**
+ * start column (base 0)
+ */
+ private int startRes = 0;
- // end column (base 0)
- private int endRes;
+ /**
+ * end column (base 0)
+ */
+ private int endRes = 0;
public Color outlineColour = Color.black;
- public Color idColour;
+ public Color idColour = null;
- public int thresholdTextColour;
+ public int thresholdTextColour = 0;
public Color textColour = Color.black;
*/
private boolean ignoreGapsInConsensus = true;
- private boolean showSequenceLogo;
+ private boolean showSequenceLogo = false;
private boolean normaliseSequenceLogo;
- private boolean showConsensusHistogram;
-
/*
* properties for HMM information annotation
*/
/*
* visibility of rows or represented rows covered by group
*/
- private boolean hidereps;
+ private boolean hidereps = false;
/*
* visibility of columns intersecting this group
*/
private boolean hidecols;
- private AlignmentAnnotation consensus;
+ AlignmentAnnotation consensus = null;
- private AlignmentAnnotation conservation;
+ AlignmentAnnotation conservation = null;
private AlignmentAnnotation hmmInformation;
+
+ private boolean showConsensusHistogram;
+
+ private AnnotatedCollectionI context;
+
/**
* Constructor, assigning a generated default name of "JGroup:" with object
{
groupName = "JGroup:" + this.hashCode();
cs = new ResidueShader();
+ sequences = new ArrayList<>();
}
/**
* copy constructor
*
* @param seqsel
+ * @param keepsequences
+ * if false do not add sequences from seqsel to new instance
*/
public SequenceGroup(SequenceGroup seqsel)
{
this();
+
if (seqsel != null)
{
sequences = new ArrayList<>();
displayBoxes = seqsel.displayBoxes;
displayText = seqsel.displayText;
colourText = seqsel.colourText;
+
startRes = seqsel.startRes;
endRes = seqsel.endRes;
cs = new ResidueShader((ResidueShader) seqsel.cs);
ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
hmmIgnoreBelowBackground = seqsel.hmmIgnoreBelowBackground;
hmmUseInfoLetterHeight = seqsel.hmmUseInfoLetterHeight;
- if (seqsel.conservationData != null)
+ if (seqsel.conserve != null)
{
+ // todo avoid doing this if we don't actually want derived calculations
+ // !
recalcConservation(); // safer than
// aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
}
}
}
- protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
- this);
-
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener)
+ /**
+ * Constructor that copies the given list of sequences
+ *
+ * @param seqs
+ */
+ public SequenceGroup(List<SequenceI> seqs)
{
- changeSupport.removePropertyChangeListener(listener);
+ this();
+ this.sequences.addAll(seqs);
}
public boolean isShowSequenceLogo()
*/
public Conservation getConservation()
{
- return conservationData;
+ return conserve;
}
/**
*/
public void setConservation(Conservation c)
{
- conservationData = c;
+ conserve = c;
}
/**
*/
public boolean recalcConservation()
{
- return recalcAnnotations(false);
+ return recalcConservation(false);
}
/**
* when set, colourschemes for this group are not refreshed after
* recalculation
*/
- public boolean recalcAnnotations(boolean defer)
+ public boolean recalcConservation(boolean defer)
{
if (cs == null && consensus == null && conservation == null
&& hmmInformation == null)
c.completeAnnotations(conservation, null, startRes, endRes + 1);
}
+ public ProfilesI consensusData = null;
+
private void _updateConsensusRow(ProfilesI cnsns, long nseq)
{
if (consensus == null)
}
consensus.label = "Consensus for " + getName();
consensus.description = "Percent Identity";
- consensusProfiles = cnsns;
+ consensusData = cnsns;
// preserve width if already set
int aWidth = (consensus.annotations != null)
? (endRes < consensus.annotations.length
/**
* Set the first column selected by this group. Runs from 0<=i<N_cols
*
- * @param i
+ * @param newStart
*/
- public void setStartRes(int i)
+ public void setStartRes(int newStart)
{
int before = startRes;
- startRes = i;
- changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
+ startRes= Math.max(0,newStart); // sanity check for negative start column positions
+ changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
+
+
+
}
/**
ignoreGapsInConsensus = state;
}
- public boolean isIgnoreGapsConsensus()
+ public boolean getIgnoreGapsConsensus()
{
return ignoreGapsInConsensus;
}