import java.util.Vector;
/**
- * base class holding visualization and analysis attributes and common logic for an active alignment view displayed in the GUI
+ * base class holding visualization and analysis attributes and common logic for
+ * an active alignment view displayed in the GUI
+ *
* @author jimp
- *
+ *
*/
public abstract class AlignmentViewport implements AlignViewportI
{
protected String sequenceSetID;
/**
- * probably unused indicator that view is of a dataset rather than an alignment
+ * probably unused indicator that view is of a dataset rather than an
+ * alignment
*/
protected boolean isDataset = false;
protected ColumnSelection colSel = new ColumnSelection();
-
public boolean autoCalculateConsensus = true;
protected boolean autoCalculateStrucConsensus = true;
protected boolean ignoreGapsInConsensusCalculation = false;
-
protected ColourSchemeI globalColourScheme = null;
return globalColourScheme;
}
-
protected AlignmentAnnotation consensus;
protected AlignmentAnnotation strucConsensus;
protected AlignmentAnnotation[] groupConservation;
- /**
- * results of alignment consensus analysis for visible portion of view
+ /**
+ * results of alignment consensus analysis for visible portion of view
*/
- protected Hashtable[] hconsensus=null;
+ protected Hashtable[] hconsensus = null;
/**
- * results of secondary structure base pair consensus for visible portion of view
+ * results of secondary structure base pair consensus for visible portion of
+ * view
*/
- protected Hashtable[] hStrucConsensus=null;
+ protected Hashtable[] hStrucConsensus = null;
/**
- * percentage gaps allowed in a column before all amino acid properties should be considered unconserved
+ * percentage gaps allowed in a column before all amino acid properties should
+ * be considered unconserved
*/
int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
public int getConsPercGaps()
{
return ConsPercGaps;
@Override
public void setSequenceConsensusHash(Hashtable[] hconsensus)
{
- this.hconsensus=hconsensus;
-
+ this.hconsensus = hconsensus;
+
}
@Override
{
return hStrucConsensus;
}
+
@Override
public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
{
- this.hStrucConsensus=hStrucConsensus;
-
+ this.hStrucConsensus = hStrucConsensus;
+
}
+
@Override
public AlignmentAnnotation getAlignmentQualityAnnot()
{
{
return conservation;
}
+
@Override
public AlignmentAnnotation getAlignmentConsensusAnnotation()
{
return consensus;
}
+
@Override
public AlignmentAnnotation getAlignmentStrucConsensusAnnotation()
{
return strucConsensus;
}
-
- protected AlignCalcManagerI calculator=new AlignCalcManager();
+
+ protected AlignCalcManagerI calculator = new AlignCalcManager();
/**
* trigger update of conservation annotation
{
return;
}
- if (!calculator.startRegisteredWorkersOfClass(jalview.workers.ConservationThread.class))
+ if (!calculator
+ .startRegisteredWorkersOfClass(jalview.workers.ConservationThread.class))
{
- calculator.registerWorker(new jalview.workers.ConservationThread(this, ap));
+ calculator.registerWorker(new jalview.workers.ConservationThread(
+ this, ap));
}
}
// --------START Structure Conservation
public void updateStrucConsensus(final AlignmentViewPanel ap)
{
- if (autoCalculateStrucConsensus && strucConsensus==null && alignment.isNucleotide() && alignment.hasRNAStructure())
+ if (autoCalculateStrucConsensus && strucConsensus == null
+ && alignment.isNucleotide() && alignment.hasRNAStructure())
{
-
+
}
// see note in mantis : issue number 8585
{
return;
}
- if (!calculator.startRegisteredWorkersOfClass(StrucConsensusThread.class))
+ if (!calculator
+ .startRegisteredWorkersOfClass(StrucConsensusThread.class))
{
- calculator.registerWorker(new StrucConsensusThread(this,ap));
+ calculator.registerWorker(new StrucConsensusThread(this, ap));
}
}
return false;
if (calculator.workingInvolvedWith(alignmentAnnotation))
{
-// System.err.println("grey out ("+alignmentAnnotation.label+")");
+ // System.err.println("grey out ("+alignmentAnnotation.label+")");
return true;
}
return false;
}
+
@Override
public boolean isClosed()
{
- // TODO: check that this isClosed is only true after panel is closed, not before it is fully constructed.
- return alignment==null;
+ // TODO: check that this isClosed is only true after panel is closed, not
+ // before it is fully constructed.
+ return alignment == null;
}
@Override
{
return colSel;
}
+
public void setColumnSelection(ColumnSelection colSel)
{
- this.colSel=colSel;
+ this.colSel = colSel;
}
public Hashtable getHiddenRepSequences()
{
public void updateHiddenColumns()
{
- hasHiddenColumns = colSel.getHiddenColumns() != null;
+ hasHiddenColumns = colSel.getHiddenColumns() != null;
}
-
+
protected boolean hasHiddenRows = false;
-
- public boolean hasHiddenRows() {
+
+ public boolean hasHiddenRows()
+ {
return hasHiddenRows;
}
public void setSequenceSetId(String newid)
{
- if (sequenceSetID!=null)
+ if (sequenceSetID != null)
{
- System.err.println("Warning - overwriting a sequenceSetId for a viewport!");
+ System.err
+ .println("Warning - overwriting a sequenceSetId for a viewport!");
}
- sequenceSetID=new String(newid);
+ sequenceSetID = new String(newid);
}
+
public String getSequenceSetId()
{
if (sequenceSetID == null)
return sequenceSetID;
}
+
/**
* unique viewId for synchronizing state (e.g. with stored Jalview Project)
*
}
return viewId;
}
+
public void setIgnoreGapsConsensus(boolean b, AlignmentViewPanel ap)
{
ignoreGapsInConsensusCalculation = b;
- if (ap!=null) {updateConsensus(ap);
- if (globalColourScheme != null)
+ if (ap != null)
{
- globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
- ignoreGapsInConsensusCalculation);
- }}
-
+ updateConsensus(ap);
+ if (globalColourScheme != null)
+ {
+ globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
+ ignoreGapsInConsensusCalculation);
+ }
+ }
+
}
+
private long sgrouphash = -1, colselhash = -1;
/**
return ignoreGapsInConsensusCalculation;
}
- /// property change stuff
+ // / property change stuff
// JBPNote Prolly only need this in the applet version.
private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
hiddenRepSequences = null;
firePropertyChange("alignment", null, alignment.getSequences());
- // used to set hasHiddenRows/hiddenRepSequences here, after the property changed event
+ // used to set hasHiddenRows/hiddenRepSequences here, after the property
+ // changed event
sendSelection();
}
}
{
selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
}
- // JBPNote: refactor: only update flag if we modified visiblity (used to do this regardless)
+ // JBPNote: refactor: only update flag if we modified visiblity (used to
+ // do this regardless)
if (alignment.getHiddenSequences().getSize() < 1)
{
hasHiddenRows = false;
seqs[index++] = sg.getSequenceAt(i);
}
}
- sg.setSeqrep(repSequence); // note: not done in 2.7applet
+ sg.setSeqrep(repSequence); // note: not done in 2.7applet
sg.setHidereps(true); // note: not done in 2.7applet
hideSequence(seqs);
public boolean isHiddenRepSequence(SequenceI seq)
{
return hiddenRepSequences != null
- && hiddenRepSequences.containsKey(seq);
+ && hiddenRepSequences.containsKey(seq);
}
+
public SequenceGroup getRepresentedSequences(SequenceI seq)
{
- return (SequenceGroup) (hiddenRepSequences == null ? null : hiddenRepSequences.get(seq));
+ return (SequenceGroup) (hiddenRepSequences == null ? null
+ : hiddenRepSequences.get(seq));
}
public int adjustForHiddenSeqs(int alignmentIndex)
colSel.invertColumnSelection(0, alignment.getWidth());
}
-
/**
* This method returns an array of new SequenceI objects derived from the
* whole alignment or just the current selection with start and end points
public SequenceI[] getSelectionAsNewSequence()
{
SequenceI[] sequences;
- // JBPNote: Need to test jalviewLite.getSelectedSequencesAsAlignmentFrom - this was the only caller in the applet for this method
- // JBPNote: in applet, this method returned references to the alignment sequences, and it did not honour the presence/absence of annotation attached to the alignment (probably!)
+ // JBPNote: Need to test jalviewLite.getSelectedSequencesAsAlignmentFrom -
+ // this was the only caller in the applet for this method
+ // JBPNote: in applet, this method returned references to the alignment
+ // sequences, and it did not honour the presence/absence of annotation
+ // attached to the alignment (probably!)
if (selectionGroup == null)
{
sequences = alignment.getSequencesArray();
return sequences;
}
-
/**
* get the currently selected sequence objects or all the sequences in the
* alignment.
return selection;
}
-
/**
* return visible region boundaries within given column range
- * @param min first column (inclusive, from 0)
- * @param max last column (exclusive)
+ *
+ * @param min
+ * first column (inclusive, from 0)
+ * @param max
+ * last column (exclusive)
* @return int[][] range of {start,end} visible positions
*/
public int[][] getVisibleRegionBoundaries(int min, int max)
{
return padGaps;
}
+
/**
- * @param padGaps the padGaps to set
+ * @param padGaps
+ * the padGaps to set
*/
public void setPadGaps(boolean padGaps)
{
this.padGaps = padGaps;
}
+
/**
- * apply any post-edit constraints and trigger any calculations needed after an edit has been performed on the alignment
+ * apply any post-edit constraints and trigger any calculations needed after
+ * an edit has been performed on the alignment
+ *
* @param ap
*/
public void alignmentChanged(AlignmentViewPanel ap)
{
if (showConservation)
{
- if (conservation==null)
- {
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " + getConsPercGaps()
- + "% gaps", new Annotation[1], 0f, 11f,
- AlignmentAnnotation.BAR_GRAPH);
- conservation.hasText = true;
- conservation.autoCalculated = true;
- alignment.addAnnotation(conservation);
- }
+ if (conservation == null)
+ {
+ conservation = new AlignmentAnnotation("Conservation",
+ "Conservation of total alignment less than "
+ + getConsPercGaps() + "% gaps",
+ new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH);
+ conservation.hasText = true;
+ conservation.autoCalculated = true;
+ alignment.addAnnotation(conservation);
+ }
}
if (showQuality)
{
- if (quality==null)
+ if (quality == null)
{
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
- quality.hasText = true;
- quality.autoCalculated = true;
- alignment.addAnnotation(quality);
+ quality = new AlignmentAnnotation("Quality",
+ "Alignment Quality based on Blosum62 scores",
+ new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH);
+ quality.hasText = true;
+ quality.autoCalculated = true;
+ alignment.addAnnotation(quality);
+ }
}
- }
- } else {
+ }
+ else
+ {
if (alignment.hasRNAStructure())
{
strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID",
- new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+ new Annotation[1], 0f, 100f,
+ AlignmentAnnotation.BAR_GRAPH);
strucConsensus.hasText = true;
strucConsensus.autoCalculated = true;
}
}
-
+
consensus = new AlignmentAnnotation("Consensus", "PID",
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
consensus.hasText = true;
consensus.autoCalculated = true;
-
+
if (showConsensus)
{
alignment.addAnnotation(consensus);
- if (strucConsensus!=null)
+ if (strucConsensus != null)
{
alignment.addAnnotation(strucConsensus);
}