git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3033 formatting
[jalview.git]
/
src
/
jalview
/
viewmodel
/
AlignmentViewport.java
diff --git
a/src/jalview/viewmodel/AlignmentViewport.java
b/src/jalview/viewmodel/AlignmentViewport.java
index
5a7a27f
..
1366ada
100644
(file)
--- a/
src/jalview/viewmodel/AlignmentViewport.java
+++ b/
src/jalview/viewmodel/AlignmentViewport.java
@@
-22,6
+22,7
@@
package jalview.viewmodel;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
+import jalview.analysis.TreeModel;
import jalview.api.AlignCalcManagerI;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.AlignCalcManagerI;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
@@
-33,7
+34,6
@@
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.Annotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.Annotation;
-import jalview.datamodel.CigarArray;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
@@
-67,6
+67,7
@@
import java.util.BitSet;
import java.util.Deque;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Deque;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.List;
import java.util.Map;
@@
-77,10
+78,10
@@
import java.util.Map;
* @author jimp
*
*/
* @author jimp
*
*/
-public abstract class AlignmentViewport implements AlignViewportI,
- CommandListener, VamsasSource
+public abstract class AlignmentViewport
+ implements AlignViewportI, CommandListener, VamsasSource
{
{
- final protected ViewportRanges ranges;
+ protected ViewportRanges ranges;
protected ViewStyleI viewStyle = new ViewStyle();
protected ViewStyleI viewStyle = new ViewStyle();
@@
-568,8
+569,6
@@
public abstract class AlignmentViewport implements AlignViewportI,
viewStyle.setSeqNameItalics(default1);
}
viewStyle.setSeqNameItalics(default1);
}
-
-
@Override
public AlignmentI getAlignment()
{
@Override
public AlignmentI getAlignment()
{
@@
-643,6
+642,11
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
residueShading.setConservation(hconservation);
}
{
residueShading.setConservation(hconservation);
}
+ /*
+ * reset conservation flag in case just set to false if
+ * Conservation was null (calculation still in progress)
+ */
+ residueShading.setConservationApplied(getConservationSelected());
residueShading.alignmentChanged(alignment, hiddenRepSequences);
}
residueShading.alignmentChanged(alignment, hiddenRepSequences);
}
@@
-661,8
+665,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
sg.setColourScheme(cs);
if (cs != null)
{
sg.setColourScheme(cs);
if (cs != null)
{
- sg.getGroupColourScheme()
- .alignmentChanged(sg, hiddenRepSequences);
+ sg.getGroupColourScheme().alignmentChanged(sg,
+ hiddenRepSequences);
}
}
}
}
}
}
@@
-671,8
+675,7
@@
public abstract class AlignmentViewport implements AlignViewportI,
@Override
public ColourSchemeI getGlobalColourScheme()
{
@Override
public ColourSchemeI getGlobalColourScheme()
{
- return residueShading == null ? null : residueShading
- .getColourScheme();
+ return residueShading == null ? null : residueShading.getColourScheme();
}
@Override
}
@Override
@@
-820,11
+823,11
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
return;
}
{
return;
}
- if (calculator
- .getRegisteredWorkersOfClass(jalview.workers.ConservationThread.class) == null)
+ if (calculator.getRegisteredWorkersOfClass(
+ jalview.workers.ConservationThread.class) == null)
{
{
- calculator.registerWorker(new jalview.workers.ConservationThread(
- this, ap));
+ calculator.registerWorker(
+ new jalview.workers.ConservationThread(this, ap));
}
}
}
}
@@
-838,7
+841,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
return;
}
{
return;
}
- if (calculator.getRegisteredWorkersOfClass(ConsensusThread.class) == null)
+ if (calculator
+ .getRegisteredWorkersOfClass(ConsensusThread.class) == null)
{
calculator.registerWorker(new ConsensusThread(this, ap));
}
{
calculator.registerWorker(new ConsensusThread(this, ap));
}
@@
-869,8
+873,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
if (doConsensus)
{
}
if (doConsensus)
{
- if (calculator
- .getRegisteredWorkersOfClass(ComplementConsensusThread.class) == null)
+ if (calculator.getRegisteredWorkersOfClass(
+ ComplementConsensusThread.class) == null)
{
calculator
.registerWorker(new ComplementConsensusThread(this, ap));
{
calculator
.registerWorker(new ComplementConsensusThread(this, ap));
@@
-894,7
+898,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
return;
}
{
return;
}
- if (calculator.getRegisteredWorkersOfClass(StrucConsensusThread.class) == null)
+ if (calculator.getRegisteredWorkersOfClass(
+ StrucConsensusThread.class) == null)
{
calculator.registerWorker(new StrucConsensusThread(this, ap));
}
{
calculator.registerWorker(new StrucConsensusThread(this, ap));
}
@@
-944,11
+949,15
@@
public abstract class AlignmentViewport implements AlignViewportI,
groupConsensus = null;
groupConservation = null;
hconsensus = null;
groupConsensus = null;
groupConservation = null;
hconsensus = null;
+ hconservation = null;
hcomplementConsensus = null;
hcomplementConsensus = null;
- // colour scheme may hold reference to consensus
- residueShading = null;
- // TODO remove listeners from changeSupport?
+ gapcounts = null;
+ calculator = null;
+ residueShading = null; // may hold a reference to Consensus
changeSupport = null;
changeSupport = null;
+ ranges = null;
+ currentTree = null;
+ selectionGroup = null;
setAlignment(null);
}
setAlignment(null);
}
@@
-1183,8
+1192,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
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);
}
@@
-1330,7
+1339,10
@@
public abstract class AlignmentViewport implements AlignViewportI,
public void removePropertyChangeListener(
java.beans.PropertyChangeListener listener)
{
public void removePropertyChangeListener(
java.beans.PropertyChangeListener listener)
{
- changeSupport.removePropertyChangeListener(listener);
+ if (changeSupport != null)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
}
/**
}
/**
@@
-1401,8
+1413,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
selectionGroup = new SequenceGroup();
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
selectionGroup = new SequenceGroup();
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
- List<SequenceI> tmp = alignment.getHiddenSequences().showAll(
- hiddenRepSequences);
+ List<SequenceI> tmp = alignment.getHiddenSequences()
+ .showAll(hiddenRepSequences);
for (SequenceI seq : tmp)
{
selectionGroup.addSequence(seq, false);
for (SequenceI seq : tmp)
{
selectionGroup.addSequence(seq, false);
@@
-1425,8
+1437,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
int startSeq = ranges.getStartSeq();
int endSeq = ranges.getEndSeq();
int startSeq = ranges.getStartSeq();
int endSeq = ranges.getEndSeq();
- List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(
- index, hiddenRepSequences);
+ List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(index,
+ hiddenRepSequences);
if (tmp.size() > 0)
{
if (selectionGroup == null)
if (tmp.size() > 0)
{
if (selectionGroup == null)
@@
-1506,8
+1518,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
int gsize = selectionGroup.getSize();
}
int gsize = selectionGroup.getSize();
- SequenceI[] hseqs = selectionGroup.getSequences().toArray(
- new SequenceI[gsize]);
+ SequenceI[] hseqs = selectionGroup.getSequences()
+ .toArray(new SequenceI[gsize]);
hideSequence(hseqs);
setSelectionGroup(null);
hideSequence(hseqs);
setSelectionGroup(null);
@@
-1597,8
+1609,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
*/
public boolean isHiddenRepSequence(SequenceI seq)
{
*/
public boolean isHiddenRepSequence(SequenceI seq)
{
- return (hiddenRepSequences != null && hiddenRepSequences
- .containsKey(seq));
+ return (hiddenRepSequences != null
+ && hiddenRepSequences.containsKey(seq));
}
/**
}
/**
@@
-1616,8
+1628,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
@Override
public int adjustForHiddenSeqs(int alignmentIndex)
{
@Override
public int adjustForHiddenSeqs(int alignmentIndex)
{
- return alignment.getHiddenSequences().adjustForHiddenSeqs(
- alignmentIndex);
+ return alignment.getHiddenSequences()
+ .adjustForHiddenSeqs(alignmentIndex);
}
@Override
}
@Override
@@
-1669,13
+1681,6
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
@Override
}
@Override
- public CigarArray getViewAsCigars(boolean selectedRegionOnly)
- {
- return new CigarArray(alignment, alignment.getHiddenColumns(),
- (selectedRegionOnly ? selectionGroup : null));
- }
-
- @Override
public jalview.datamodel.AlignmentView getAlignmentView(
boolean selectedOnly)
{
public jalview.datamodel.AlignmentView getAlignmentView(
boolean selectedOnly)
{
@@
-1687,10
+1692,10
@@
public abstract class AlignmentViewport implements AlignViewportI,
boolean selectedOnly, boolean markGroups)
{
return new AlignmentView(alignment, alignment.getHiddenColumns(),
boolean selectedOnly, boolean markGroups)
{
return new AlignmentView(alignment, alignment.getHiddenColumns(),
- selectionGroup, alignment.getHiddenColumns() != null
+ selectionGroup,
+ alignment.getHiddenColumns() != null
&& alignment.getHiddenColumns().hasHiddenColumns(),
&& alignment.getHiddenColumns().hasHiddenColumns(),
- selectedOnly,
- markGroups);
+ selectedOnly, markGroups);
}
@Override
}
@Override
@@
-1736,8
+1741,12
@@
public abstract class AlignmentViewport implements AlignViewportI,
if (alignment.getHiddenColumns() != null
&& alignment.getHiddenColumns().hasHiddenColumns())
{
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
{
}
else
{
@@
-1764,10
+1773,10
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
if (start == 0)
{
{
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 (start == end)
{
end = max;
@@
-1782,8
+1791,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
if (hidden != null && hidden.hasHiddenColumns())
{
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);
}
} while (end < max);
@@
-1805,13
+1814,13
@@
public abstract class AlignmentViewport implements AlignViewportI,
AlignmentAnnotation clone = new AlignmentAnnotation(annot);
if (selectedOnly && selectionGroup != null)
{
AlignmentAnnotation clone = new AlignmentAnnotation(annot);
if (selectedOnly && selectionGroup != null)
{
- alignment.getHiddenColumns().makeVisibleAnnotation(
- selectionGroup.getStartRes(),
- selectionGroup.getEndRes(), clone);
+ clone.makeVisibleAnnotation(
+ selectionGroup.getStartRes(), selectionGroup.getEndRes(),
+ alignment.getHiddenColumns());
}
else
{
}
else
{
- alignment.getHiddenColumns().makeVisibleAnnotation(clone);
+ clone.makeVisibleAnnotation(alignment.getHiddenColumns());
}
ala.add(clone);
}
}
ala.add(clone);
}
@@
-1996,8
+2005,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
gapcounts = new AlignmentAnnotation("Occupancy",
MessageManager.getString("label.occupancy_descr"),
{
gapcounts = new AlignmentAnnotation("Occupancy",
MessageManager.getString("label.occupancy_descr"),
- new Annotation[1], 0f,
- alignment.getHeight(), AlignmentAnnotation.BAR_GRAPH);
+ new Annotation[1], 0f, alignment.getHeight(),
+ AlignmentAnnotation.BAR_GRAPH);
gapcounts.hasText = true;
gapcounts.autoCalculated = true;
gapcounts.scaleColLabel = true;
gapcounts.hasText = true;
gapcounts.autoCalculated = true;
gapcounts.scaleColLabel = true;
@@
-2015,8
+2024,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
conservation = new AlignmentAnnotation("Conservation",
MessageManager.formatMessage("label.conservation_descr",
{
conservation = new AlignmentAnnotation("Conservation",
MessageManager.formatMessage("label.conservation_descr",
- getConsPercGaps()), new Annotation[1],
- 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
+ getConsPercGaps()),
+ new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
conservation.hasText = true;
conservation.autoCalculated = true;
alignment.addAnnotation(conservation);
conservation.hasText = true;
conservation.autoCalculated = true;
alignment.addAnnotation(conservation);
@@
-2496,8
+2505,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
viewStyle = new ViewStyle(settingsForView);
if (residueShading != null)
{
viewStyle = new ViewStyle(settingsForView);
if (residueShading != null)
{
- residueShading.setConservationApplied(settingsForView
- .isConservationColourSelected());
+ residueShading.setConservationApplied(
+ settingsForView.isConservationColourSelected());
}
}
}
}
@@
-2665,7
+2674,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
return sortAnnotationsBy;
}
return sortAnnotationsBy;
}
- public void setSortAnnotationsBy(SequenceAnnotationOrder sortAnnotationsBy)
+ public void setSortAnnotationsBy(
+ SequenceAnnotationOrder sortAnnotationsBy)
{
this.sortAnnotationsBy = sortAnnotationsBy;
}
{
this.sortAnnotationsBy = sortAnnotationsBy;
}
@@
-2743,8
+2753,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
return 0;
}
boolean iAmProtein = !getAlignment().isNucleotide();
return 0;
}
boolean iAmProtein = !getAlignment().isNucleotide();
- AlignmentI proteinAlignment = iAmProtein ? getAlignment() : complement
- .getAlignment();
+ AlignmentI proteinAlignment = iAmProtein ? getAlignment()
+ : complement.getAlignment();
if (proteinAlignment == null)
{
return 0;
if (proteinAlignment == null)
{
return 0;
@@
-2775,7
+2785,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
*/
int lastSeq = alignment.getHeight() - 1;
List<AlignedCodonFrame> seqMappings = null;
*/
int lastSeq = alignment.getHeight() - 1;
List<AlignedCodonFrame> seqMappings = null;
- for (int seqNo = ranges.getStartSeq(); seqNo < lastSeq; seqNo++, seqOffset++)
+ for (int seqNo = ranges
+ .getStartSeq(); seqNo <= lastSeq; seqNo++, seqOffset++)
{
sequence = getAlignment().getSequenceAt(seqNo);
if (hiddenSequences != null && hiddenSequences.isHidden(sequence))
{
sequence = getAlignment().getSequenceAt(seqNo);
if (hiddenSequences != null && hiddenSequences.isHidden(sequence))
@@
-2786,9
+2797,9
@@
public abstract class AlignmentViewport implements AlignViewportI,
{
continue;
}
{
continue;
}
- seqMappings = MappingUtils
- .findMappingsForSequenceAndOthers(sequence, mappings,
- getCodingComplement().getAlignment().getSequences());
+ seqMappings = MappingUtils.findMappingsForSequenceAndOthers(sequence,
+ mappings,
+ getCodingComplement().getAlignment().getSequences());
if (!seqMappings.isEmpty())
{
break;
if (!seqMappings.isEmpty())
{
break;
@@
-2871,6
+2882,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
*/
private SearchResultsI searchResults = null;
*/
private SearchResultsI searchResults = null;
+ protected TreeModel currentTree = null;
+
@Override
public boolean hasSearchResults()
{
@Override
public boolean hasSearchResults()
{
@@
-2923,10
+2936,22
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
}
}
}
}
}
-
+
SequenceI sq = new Sequence("Consensus", seqs.toString());
sq.setDescription("Percentage Identity Consensus "
+ ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
return sq;
}
SequenceI sq = new Sequence("Consensus", seqs.toString());
sq.setDescription("Percentage Identity Consensus "
+ ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
return sq;
}
+
+ @Override
+ public void setCurrentTree(TreeModel tree)
+ {
+ currentTree = tree;
+ }
+
+ @Override
+ public TreeModel getCurrentTree()
+ {
+ return currentTree;
+ }
}
}