From: tva Date: Wed, 5 Jun 2019 12:22:13 +0000 (+0100) Subject: JAL-3285 add unmerged features into AlignmentViewport X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9e65b8a51f59f411444233fb807729b8cf25fea0;p=jalview.git JAL-3285 add unmerged features into AlignmentViewport --- diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 39a1c18..1a9684f 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -98,13 +98,15 @@ public abstract class AlignmentViewport protected Deque redoList = new ArrayDeque<>(); - protected String sequenceSetID; - + /** + * alignment displayed in the viewport. Please use get/setter + */ + protected AlignmentI alignment; + /* * probably unused indicator that view is of a dataset rather than an * alignment */ - protected boolean isDataset = false; private Map hiddenRepSequences; @@ -133,12 +135,7 @@ public abstract class AlignmentViewport protected AlignmentAnnotation conservation; protected AlignmentAnnotation quality; - - /** - * alignment displayed in the viewport - */ - private AlignmentI alignment; - + /** * results of alignment consensus analysis for visible portion of view */ @@ -641,6 +638,14 @@ public abstract class AlignmentViewport 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; @@ -651,6 +656,18 @@ public abstract class AlignmentViewport return isDataset; } + private Map hiddenRepSequences; + + protected ColumnSelection colSel = new ColumnSelection(); + + public boolean autoCalculateConsensus = true; + + protected boolean autoCalculateStrucConsensus = true; + + protected boolean ignoreGapsInConsensusCalculation = false; + + protected ResidueShaderI residueShading = new ResidueShader(); + @Override public void setGlobalColourScheme(ColourSchemeI cs) { @@ -724,6 +741,41 @@ public abstract class AlignmentViewport { 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; + + /** + * results of alignment consensus analysis for visible portion of view + */ + protected ProfilesI hconsensus = null; + + /** + * 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) { @@ -743,9 +795,9 @@ public abstract class AlignmentViewport } @Override - public void setConsensusProfiles(ProfilesI hconsensus) + public void setSequenceConsensusHash(ProfilesI hconsensus) { - this.consensusProfiles = hconsensus; + this.hconsensus = hconsensus; } @Override @@ -755,9 +807,9 @@ public abstract class AlignmentViewport } @Override - public ProfilesI getConsensusProfiles() + public ProfilesI getSequenceConsensusHash() { - return consensusProfiles; + return hconsensus; } @Override @@ -810,9 +862,9 @@ public abstract class AlignmentViewport } @Override - public AlignmentAnnotation getOccupancyAnnotation() + public AlignmentAnnotation getAlignmentGapAnnotation() { - return occupancy; + return gapcounts; } @Override @@ -975,9 +1027,12 @@ public abstract class AlignmentViewport conservation = null; quality = null; consensusProfiles = null; + groupConsensus = null; + groupConservation = null; + hconsensus = null; hconservation = null; hcomplementConsensus = null; - occupancy = null; + gapcounts = null; calculator = null; residueShading = null; // may hold a reference to Consensus changeSupport = null; @@ -1311,6 +1366,7 @@ public abstract class AlignmentViewport ignoreGapsInConsensusCalculation = b; if (ap != null) { + updateConsensus(ap); if (residueShading != null) { residueShading.setThreshold(residueShading.getThreshold(), @@ -1761,8 +1817,7 @@ public abstract class AlignmentViewport } else { - sequences = selectionGroup.getSelectionAsNewSequences(alignment, - true); + sequences = selectionGroup.getSelectionAsNewSequences(alignment); } return sequences; @@ -1956,6 +2011,18 @@ public abstract class AlignmentViewport { alignment.padGaps(); } + if (autoCalculateConsensus) + { + updateConsensus(ap); + } + if (hconsensus != null && autoCalculateConsensus) + { + updateConservation(ap); + } + if (autoCalculateStrucConsensus) + { + updateStrucConsensus(ap); + } // Reset endRes of groups if beyond alignment width int alWidth = alignment.getWidth(); @@ -1990,7 +2057,7 @@ public abstract class AlignmentViewport { rs.alignmentChanged(alignment, hiddenRepSequences); - rs.setConsensus(consensusProfiles); + rs.setConsensus(hconsensus); if (rs.conservationApplied()) { rs.setConservation(Conservation.calculateConservation("All", @@ -2015,7 +2082,7 @@ public abstract class AlignmentViewport // depending on if the user wants to see the annotation or not in a // specific alignment - if (consensusProfiles == null && !isDataset) + if (hconsensus == null && !isDataset) { if (!alignment.isNucleotide()) { @@ -2031,7 +2098,7 @@ public abstract class AlignmentViewport new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); initConsensus(consensus); - initOccupancy(); + initGapCounts(); initComplementConsensus(); } @@ -2090,20 +2157,20 @@ public abstract class AlignmentViewport // these should be extracted from the view model - style and settings for // derived annotation - private void initOccupancy() + private void initGapCounts() { if (showOccupancy) { - occupancy = new AlignmentAnnotation("Occupancy", + gapcounts = new AlignmentAnnotation("Occupancy", MessageManager.getString("label.occupancy_descr"), new Annotation[1], 0f, alignment.getHeight(), AlignmentAnnotation.BAR_GRAPH); - occupancy.hasText = true; - occupancy.autoCalculated = true; - occupancy.scaleColLabel = true; - occupancy.graph = AlignmentAnnotation.BAR_GRAPH; + gapcounts.hasText = true; + gapcounts.autoCalculated = true; + gapcounts.scaleColLabel = true; + gapcounts.graph = AlignmentAnnotation.BAR_GRAPH; - alignment.addAnnotation(occupancy); + alignment.addAnnotation(gapcounts); } }