import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
+import jalview.datamodel.ProfileI;
+import jalview.datamodel.Profiles;
import jalview.datamodel.ProfilesI;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.workers.AlignCalcManager;
import jalview.workers.ComplementConsensusThread;
import jalview.workers.ConsensusThread;
+import jalview.workers.InformationThread;
import jalview.workers.StrucConsensusThread;
import java.awt.Color;
protected Deque<CommandI> redoList = new ArrayDeque<>();
+
/**
* alignment displayed in the viewport. Please use get/setter
*/
public boolean autoCalculateConsensus = true;
+ public boolean autoCalculateInformation = true;
+
protected boolean autoCalculateStrucConsensus = true;
protected boolean ignoreGapsInConsensusCalculation = false;
+ protected boolean ignoreBelowBackGroundFrequencyCalculation = false;
+
protected ResidueShaderI residueShading = new ResidueShader();
@Override
protected AlignmentAnnotation[] groupConservation;
+ protected List<AlignmentAnnotation> groupInformation = new ArrayList<>();
+
+ protected List<AlignmentAnnotation> information = new ArrayList<>();
+
/**
* results of alignment consensus analysis for visible portion of view
*/
protected ProfilesI hconsensus = null;
/**
+ * results of information annotation analysis for the visible portion of view
+ */
+ protected List<ProfilesI> hinformation = new ArrayList<>();
+
+ /**
* results of cDNA complement consensus visible portion of view
*/
protected Hashtable[] hcomplementConsensus = null;
}
@Override
+ public void setSequenceInformationHashes(List<ProfilesI> info)
+ {
+ hinformation = info;
+ }
+
+ @Override
+ public void setSequenceInformationHash(ProfilesI info, int index)
+ {
+ hinformation.set(index, info);
+ }
+
+ @Override
+ public List<ProfilesI> getSequenceInformationHashes()
+ {
+ return hinformation;
+ }
+
+ @Override
+ public ProfilesI getSequenceInformationHash(int index)
+ {
+ return hinformation.get(index);
+ }
+
+ @Override
public Hashtable[] getComplementConsensusHash()
{
return hcomplementConsensus;
}
@Override
+ public List<AlignmentAnnotation> getInformationAnnotations()
+ {
+ return information;
+ }
+
+ @Override
+ public AlignmentAnnotation getInformationAnnotation(int index)
+ {
+ return information.get(index);
+ }
+
+ @Override
public AlignmentAnnotation getAlignmentGapAnnotation()
{
return gapcounts;
}
}
+ /**
+ * trigger update of information annotation
+ */
+ @Override
+ public void updateInformation(final AlignmentViewPanel ap)
+ {
+ if (calculator
+ .getRegisteredWorkersOfClass(InformationThread.class) == null)
+ {
+ calculator.registerWorker(new InformationThread(this, ap));
+ }
+
+ }
+
// --------START Structure Conservation
public void updateStrucConsensus(final AlignmentViewPanel ap)
{
protected boolean showConsensusHistogram = true;
/**
+ * should hmm profile be rendered by default
+ */
+ protected boolean showHMMSequenceLogo = false;
+
+ /**
+ * should hmm profile be rendered normalised to row height
+ */
+ protected boolean normaliseHMMSequenceLogo = false;
+
+ /**
+ * should information histograms be rendered by default
+ */
+ protected boolean showInformationHistogram = true;
+
+ /**
* @return the showConsensusProfile
*/
@Override
}
/**
+ * @return the showInformationProfile
+ */
+ @Override
+ public boolean isShowHMMSequenceLogo()
+ {
+ return showHMMSequenceLogo;
+ }
+
+ /**
* @param showSequenceLogo
* the new value
*/
this.showSequenceLogo = showSequenceLogo;
}
+ public void setShowHMMSequenceLogo(boolean showHMMSequenceLogo)
+ {
+ if (showHMMSequenceLogo != this.showHMMSequenceLogo)
+ {
+ this.showHMMSequenceLogo = showHMMSequenceLogo;
+ calculator.updateAnnotationFor(InformationThread.class);
+ }
+ this.showHMMSequenceLogo = showHMMSequenceLogo;
+ }
+
/**
* @param showConsensusHistogram
* the showConsensusHistogram to set
}
/**
+ * @param showInformationHistogram
+ * the showInformationHistogram to set
+ */
+ public void setShowInformationHistogram(boolean showInformationHistogram)
+ {
+ this.showInformationHistogram = showInformationHistogram;
+ }
+
+ /**
* @return the showGroupConservation
*/
public boolean isShowGroupConservation()
}
/**
+ *
+ * @return flag to indicate if the information content histogram should be
+ * rendered by default
+ */
+ @Override
+ public boolean isShowInformationHistogram()
+ {
+ return this.showInformationHistogram;
+ }
+
+ /**
* when set, updateAlignment will always ensure sequences are of equal length
*/
private boolean padGaps = false;
}
+ public void setIgnoreBelowBackground(boolean b, AlignmentViewPanel ap)
+ {
+ ignoreBelowBackGroundFrequencyCalculation = b;
+ if (ap != null)
+ {
+ updateInformation(ap);
+ }
+
+ }
+
private long sgrouphash = -1, colselhash = -1;
/**
return ignoreGapsInConsensusCalculation;
}
+ @Override
+ public boolean isIgnoreBelowBackground()
+ {
+ return ignoreBelowBackGroundFrequencyCalculation;
+ }
+
// property change stuff
// JBPNote Prolly only need this in the applet version.
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
{
updateStrucConsensus(ap);
}
+ updateInformation(ap);
+
+ List<SequenceI> hmmSequences;
+ hmmSequences = alignment.getHMMConsensusSequences(false);
+
+ for (SequenceI seq : hmmSequences)
+ {
+ seq.updateHMMMapping();
+ }
// Reset endRes of groups if beyond alignment width
int alWidth = alignment.getWidth();
MessageManager.getString("label.consensus_descr"),
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
+
initGapCounts();
initComplementConsensus();
}
}
+ @Override
+ public void initInformation()
+ {
+ for (SequenceI seq : alignment.getHMMConsensusSequences(false))
+ {
+ if (!seq.hasHMMAnnotation())
+ {
+ AlignmentAnnotation information;
+ information = new AlignmentAnnotation(seq.getName(),
+ MessageManager.getString("label.information_description"),
+ new Annotation[1], 0f, 6.52f,
+ AlignmentAnnotation.BAR_GRAPH);
+ information.hasText = true;
+ information.autoCalculated = true;
+ information.hasText = true;
+ information.autoCalculated = false;
+ information.sequenceRef = seq;
+ information.setCalcId("HMM annotation");
+ this.information.add(information);
+ hinformation.add(new Profiles(new ProfileI[1]));
+ alignment.addAnnotation(information);
+ seq.updateHMMMapping();
+ seq.setHasInfo(true);
+ seq.addAlignmentAnnotation(information);
+ }
+ }
+
+ }
+
// these should be extracted from the view model - style and settings for
// derived annotation
private void initGapCounts()
boolean showprf = isShowSequenceLogo();
boolean showConsHist = isShowConsensusHistogram();
boolean normLogo = isNormaliseSequenceLogo();
+ boolean showHMMPrf = isShowHMMSequenceLogo();
+ boolean showInfoHist = isShowInformationHistogram();
+ boolean normHMMLogo = isNormaliseHMMSequenceLogo();
/**
* TODO reorder the annotation rows according to group/sequence ordering on
sg.setshowSequenceLogo(showprf);
sg.setShowConsensusHistogram(showConsHist);
sg.setNormaliseSequenceLogo(normLogo);
+ sg.setshowHMMSequenceLogo(showHMMPrf);
+ sg.setShowInformationHistogram(showInfoHist);
+ sg.setNormaliseHMMSequenceLogo(normHMMLogo);
}
if (conv)
{