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 java.util.Deque;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
protected Deque<CommandI> redoList = new ArrayDeque<>();
+ protected String sequenceSetID;
+
+ /*
+ * probably unused indicator that view is of a dataset rather than an
+ * alignment
+ */
+ protected boolean isDataset = false;
+
+ private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
+
+ protected ColumnSelection colSel = new ColumnSelection();
+
+ public boolean autoCalculateConsensus = true;
+
+ protected boolean autoCalculateStrucConsensus = true;
+
+ protected boolean ignoreGapsInConsensusCalculation = false;
+
+ protected boolean ignoreBelowBackGroundFrequencyCalculation = false;
+
+ protected boolean infoLetterHeight = false;
+
+ protected ResidueShaderI residueShading = new ResidueShader();
+
+ protected AlignmentAnnotation consensus;
+
+ protected AlignmentAnnotation complementConsensus;
+
+ protected AlignmentAnnotation occupancy;
+
+ protected AlignmentAnnotation strucConsensus;
+
+ protected AlignmentAnnotation conservation;
+
+ protected AlignmentAnnotation quality;
+
+ /**
+ * alignment displayed in the viewport
+ */
+ private AlignmentI alignment;
+
+ /**
+ * results of alignment consensus analysis for visible portion of view
+ */
+ protected ProfilesI consensusProfiles;
+
+ /**
+ * HMM profile for the alignment
+ */
+ protected ProfilesI hmmProfiles;
/**
- * alignment displayed in the viewport. Please use get/setter
+ * results of cDNA complement consensus visible portion of view
+ */
+ protected Hashtable[] hcomplementConsensus;
+
+ /**
+ * results of secondary structure base pair consensus for visible portion of
+ * view
*/
- protected AlignmentI alignment;
+ protected Hashtable[] hStrucConsensus;
+
+ protected Conservation hconservation;
public AlignmentViewport(AlignmentI al)
{
return alignment.getGapCharacter();
}
- protected String sequenceSetID;
-
- /**
- * probably unused indicator that view is of a dataset rather than an
- * alignment
- */
- protected boolean isDataset = false;
-
public void setDataset(boolean b)
{
isDataset = b;
return isDataset;
}
- private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
-
- protected ColumnSelection colSel = new ColumnSelection();
-
- public boolean autoCalculateConsensus = true;
-
- public boolean autoCalculateInformation = true;
-
- protected boolean autoCalculateStrucConsensus = true;
-
- protected boolean ignoreGapsInConsensusCalculation = false;
-
- protected boolean ignoreBelowBackGroundFrequencyCalculation = false;
-
- protected boolean infoLetterHeight = false;
-
- protected ResidueShaderI residueShading = new ResidueShader();
-
@Override
public void setGlobalColourScheme(ColourSchemeI cs)
{
{
return residueShading;
}
-
- protected AlignmentAnnotation consensus;
-
- protected AlignmentAnnotation complementConsensus;
-
- protected AlignmentAnnotation gapcounts;
-
- protected AlignmentAnnotation strucConsensus;
-
- protected AlignmentAnnotation conservation;
-
- protected AlignmentAnnotation quality;
-
- protected AlignmentAnnotation[] groupConsensus;
-
- 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;
-
- /**
- * results of secondary structure base pair consensus for visible portion of
- * view
- */
- protected Hashtable[] hStrucConsensus = null;
-
- protected Conservation hconservation = null;
-
@Override
public void setConservation(Conservation cons)
{
}
@Override
- public void setSequenceConsensusHash(ProfilesI hconsensus)
+ public void setConsensusProfiles(ProfilesI hconsensus)
{
- this.hconsensus = hconsensus;
+ this.consensusProfiles = hconsensus;
}
@Override
}
@Override
- public ProfilesI getSequenceConsensusHash()
- {
- return hconsensus;
- }
-
- @Override
- public void setSequenceInformationHashes(List<ProfilesI> info)
+ public ProfilesI getConsensusProfiles()
{
- hinformation = info;
+ return consensusProfiles;
}
@Override
- public void setSequenceInformationHash(ProfilesI info, int index)
+ public void setHmmProfiles(ProfilesI info)
{
- if (hinformation.size() < index + 1)
- {
- return;
- }
- hinformation.set(index, info);
+ hmmProfiles = info;
}
@Override
- public List<ProfilesI> getSequenceInformationHashes()
+ public ProfilesI getHmmProfiles()
{
- return hinformation;
- }
-
- @Override
- public ProfilesI getSequenceInformationHash(int index)
- {
- return hinformation.get(index);
+ return hmmProfiles;
}
@Override
}
@Override
- public List<AlignmentAnnotation> getInformationAnnotations()
- {
- return information;
- }
-
- @Override
- public AlignmentAnnotation getInformationAnnotation(int index)
+ public AlignmentAnnotation getOccupancyAnnotation()
{
- return information.get(index);
- }
-
- @Override
- public AlignmentAnnotation getAlignmentGapAnnotation()
- {
- return gapcounts;
+ return occupancy;
}
@Override
}
}
- /**
- * trigger update of information annotation
- */
@Override
- public void updateInformation(final AlignmentViewPanel ap)
+ public void initInformationWorker(final AlignmentViewPanel ap)
{
if (calculator
.getRegisteredWorkersOfClass(InformationThread.class) == null)
{
calculator.registerWorker(new InformationThread(this, ap));
}
-
}
// --------START Structure Conservation
strucConsensus = null;
conservation = null;
quality = null;
- groupConsensus = null;
- groupConservation = null;
- hconsensus = null;
+ consensusProfiles = null;
hconservation = null;
hcomplementConsensus = null;
- gapcounts = null;
+ occupancy = null;
calculator = null;
residueShading = null; // may hold a reference to Consensus
changeSupport = null;
if (showHMMSequenceLogo != this.showHMMSequenceLogo)
{
this.showHMMSequenceLogo = showHMMSequenceLogo;
- calculator.updateAnnotationFor(InformationThread.class);
+ // TODO: updateAnnotation if description (tooltip) will show
+ // profile in place of information content?
+ // calculator.updateAnnotationFor(InformationThread.class);
}
this.showHMMSequenceLogo = showHMMSequenceLogo;
}
ignoreGapsInConsensusCalculation = b;
if (ap != null)
{
- updateConsensus(ap);
if (residueShading != null)
{
residueShading.setThreshold(residueShading.getThreshold(),
ignoreGapsInConsensusCalculation);
}
}
-
}
public void setIgnoreBelowBackground(boolean b, AlignmentViewPanel ap)
{
ignoreBelowBackGroundFrequencyCalculation = b;
- if (ap != null)
- {
- updateInformation(ap);
- }
-
}
public void setInfoLetterHeight(boolean b, AlignmentViewPanel ap)
{
infoLetterHeight = b;
- if (ap != null)
- {
- updateInformation(ap);
- }
-
}
private long sgrouphash = -1, colselhash = -1;
if (alignment.getHiddenColumns() != null
&& alignment.getHiddenColumns().hasHiddenColumns())
{
- selection = alignment.getHiddenColumns()
- .getVisibleSequenceStrings(start, end, seqs);
+ for (i = 0; i < iSize; i++)
+ {
+ Iterator<int[]> blocks = alignment.getHiddenColumns()
+ .getVisContigsIterator(start, end + 1, false);
+ selection[i] = seqs[i].getSequenceStringFromIterator(blocks);
+ }
}
else
{
{
if (start == 0)
{
- start = hidden.adjustForHiddenColumns(start);
+ start = hidden.visibleToAbsoluteColumn(start);
}
- end = hidden.getHiddenBoundaryRight(start);
+ end = hidden.getNextHiddenBoundary(false, start);
if (start == end)
{
end = max;
if (hidden != null && hidden.hasHiddenColumns())
{
- start = hidden.adjustForHiddenColumns(end);
- start = hidden.getHiddenBoundaryLeft(start) + 1;
+ start = hidden.visibleToAbsoluteColumn(end);
+ start = hidden.getNextHiddenBoundary(true, start) + 1;
}
} while (end < max);
AlignmentAnnotation clone = new AlignmentAnnotation(annot);
if (selectedOnly && selectionGroup != null)
{
- alignment.getHiddenColumns().makeVisibleAnnotation(
+ clone.makeVisibleAnnotation(
selectionGroup.getStartRes(), selectionGroup.getEndRes(),
- clone);
+ alignment.getHiddenColumns());
}
else
{
- alignment.getHiddenColumns().makeVisibleAnnotation(clone);
+ clone.makeVisibleAnnotation(alignment.getHiddenColumns());
}
ala.add(clone);
}
{
alignment.padGaps();
}
- if (autoCalculateConsensus)
- {
- updateConsensus(ap);
- }
- if (hconsensus != null && autoCalculateConsensus)
- {
- updateConservation(ap);
- }
- if (autoCalculateStrucConsensus)
- {
- updateStrucConsensus(ap);
- }
- initInformation();
- updateInformation(ap);
-
- List<SequenceI> hmmSequences;
- hmmSequences = alignment.getHMMConsensusSequences();
-
- for (SequenceI seq : hmmSequences)
- {
- seq.updateHMMMapping();
- }
// Reset endRes of groups if beyond alignment width
int alWidth = alignment.getWidth();
updateAllColourSchemes();
calculator.restartWorkers();
- // alignment.adjustSequenceAnnotations();
}
/**
{
rs.alignmentChanged(alignment, hiddenRepSequences);
- rs.setConsensus(hconsensus);
+ rs.setConsensus(consensusProfiles);
if (rs.conservationApplied())
{
rs.setConservation(Conservation.calculateConservation("All",
// depending on if the user wants to see the annotation or not in a
// specific alignment
- if (hconsensus == null && !isDataset)
+ if (consensusProfiles == null && !isDataset)
{
if (!alignment.isNucleotide())
{
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
- initGapCounts();
+ initOccupancy();
initComplementConsensus();
}
}
}
- @Override
- public void initInformation()
- {
- for (SequenceI seq : alignment.getHMMConsensusSequences())
- {
- if (!seq.hasHMMAnnotation())
- {
- AlignmentAnnotation info = new AlignmentAnnotation(seq.getName(),
- MessageManager.getString("label.information_description"),
- new Annotation[1], 0f, 6.52f,
- AlignmentAnnotation.BAR_GRAPH);
- info.hasText = true;
- info.autoCalculated = true;
- info.hasText = true;
- info.autoCalculated = false;
- info.sequenceRef = seq;
- info.setCalcId("HMM");
- this.information.add(info);
- hinformation.add(new Profiles(new ProfileI[1]));
- alignment.addAnnotation(info);
- seq.updateHMMMapping();
- seq.setHasInfo(true);
- seq.addAlignmentAnnotation(info);
- }
- }
- }
-
// these should be extracted from the view model - style and settings for
// derived annotation
- private void initGapCounts()
+ private void initOccupancy()
{
if (showOccupancy)
{
- gapcounts = new AlignmentAnnotation("Occupancy",
+ occupancy = new AlignmentAnnotation("Occupancy",
MessageManager.getString("label.occupancy_descr"),
new Annotation[1], 0f, alignment.getHeight(),
AlignmentAnnotation.BAR_GRAPH);
- gapcounts.hasText = true;
- gapcounts.autoCalculated = true;
- gapcounts.scaleColLabel = true;
- gapcounts.graph = AlignmentAnnotation.BAR_GRAPH;
+ occupancy.hasText = true;
+ occupancy.autoCalculated = true;
+ occupancy.scaleColLabel = true;
+ occupancy.graph = AlignmentAnnotation.BAR_GRAPH;
- alignment.addAnnotation(gapcounts);
+ alignment.addAnnotation(occupancy);
}
}
int lastSeq = alignment.getHeight() - 1;
List<AlignedCodonFrame> seqMappings = null;
for (int seqNo = ranges
- .getStartSeq(); seqNo < lastSeq; seqNo++, seqOffset++)
+ .getStartSeq(); seqNo <= lastSeq; seqNo++, seqOffset++)
{
sequence = getAlignment().getSequenceAt(seqNo);
if (hiddenSequences != null && hiddenSequences.isHidden(sequence))
{
return currentTree;
}
+
+ @Override
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ public void setNormaliseSequenceLogo(boolean state)
+ {
+ normaliseSequenceLogo = state;
+ }
+
+ @Override
+ public boolean isNormaliseHMMSequenceLogo()
+ {
+ return normaliseHMMSequenceLogo;
+ }
+
+ public void setNormaliseHMMSequenceLogo(boolean state)
+ {
+ normaliseHMMSequenceLogo = state;
+ }
}