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
Merge branch 'develop' into bug/JAL-2346annotationChoice
[jalview.git]
/
src
/
jalview
/
viewmodel
/
AlignmentViewport.java
diff --git
a/src/jalview/viewmodel/AlignmentViewport.java
b/src/jalview/viewmodel/AlignmentViewport.java
index
0c470fe
..
3547757
100644
(file)
--- a/
src/jalview/viewmodel/AlignmentViewport.java
+++ b/
src/jalview/viewmodel/AlignmentViewport.java
@@
-20,6
+20,17
@@
*/
package jalview.viewmodel;
*/
package jalview.viewmodel;
+import java.awt.Color;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.api.AlignCalcManagerI;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.api.AlignCalcManagerI;
@@
-57,17
+68,6
@@
import jalview.workers.ComplementConsensusThread;
import jalview.workers.ConsensusThread;
import jalview.workers.StrucConsensusThread;
import jalview.workers.ConsensusThread;
import jalview.workers.StrucConsensusThread;
-import java.awt.Color;
-import java.beans.PropertyChangeSupport;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
/**
* 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
@@
-78,6
+78,8
@@
import java.util.Map;
public abstract class AlignmentViewport implements AlignViewportI,
CommandListener, VamsasSource
{
public abstract class AlignmentViewport implements AlignViewportI,
CommandListener, VamsasSource
{
+ protected ViewportRanges ranges;
+
protected ViewStyleI viewStyle = new ViewStyle();
/**
protected ViewStyleI viewStyle = new ViewStyle();
/**
@@
-672,6
+674,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
protected AlignmentAnnotation complementConsensus;
protected AlignmentAnnotation complementConsensus;
+ protected AlignmentAnnotation gapcounts;
+
protected AlignmentAnnotation strucConsensus;
protected AlignmentAnnotation conservation;
protected AlignmentAnnotation strucConsensus;
protected AlignmentAnnotation conservation;
@@
-774,6
+778,12
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
@Override
}
@Override
+ public AlignmentAnnotation getAlignmentGapAnnotation()
+ {
+ return gapcounts;
+ }
+
+ @Override
public AlignmentAnnotation getComplementConsensusAnnotation()
{
return complementConsensus;
public AlignmentAnnotation getComplementConsensusAnnotation()
{
return complementConsensus;
@@
-813,7
+823,7
@@
public abstract class AlignmentViewport implements AlignViewportI,
public void updateConsensus(final AlignmentViewPanel ap)
{
// see note in mantis : issue number 8585
public void updateConsensus(final AlignmentViewPanel ap)
{
// see note in mantis : issue number 8585
- if (consensus == null || !autoCalculateConsensus)
+ if ((consensus == null || gapcounts == null) || !autoCalculateConsensus)
{
return;
}
{
return;
}
@@
-1285,15
+1295,6
@@
public abstract class AlignmentViewport implements AlignViewportI,
*/
private boolean followHighlight = true;
*/
private boolean followHighlight = true;
- // TODO private with getters and setters?
- public int startRes;
-
- public int endRes;
-
- public int startSeq;
-
- public int endSeq;
-
/**
* Property change listener for changes in alignment
*
/**
* Property change listener for changes in alignment
*
@@
-1892,6
+1893,11
@@
public abstract class AlignmentViewport implements AlignViewportI,
consensus = new AlignmentAnnotation("Consensus", "PID",
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
consensus = new AlignmentAnnotation("Consensus", "PID",
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
+ gapcounts = new AlignmentAnnotation("Occupancy",
+ "Number of aligned positions",
+ new Annotation[1], 0f, alignment.getHeight(),
+ AlignmentAnnotation.BAR_GRAPH);
+ initGapCounts(gapcounts);
initComplementConsensus();
}
initComplementConsensus();
}
@@
-1944,6
+1950,20
@@
public abstract class AlignmentViewport implements AlignViewportI,
}
}
}
}
+ // these should be extracted from the view model - style and settings for
+ // derived annotation
+ private void initGapCounts(AlignmentAnnotation counts)
+ {
+ counts.hasText = false;
+ counts.autoCalculated = true;
+ counts.graph = AlignmentAnnotation.BAR_GRAPH;
+
+ if (showConsensus)
+ {
+ alignment.addAnnotation(counts);
+ }
+ }
+
private void initConservation()
{
if (showConservation)
private void initConservation()
{
if (showConservation)
@@
-2645,63
+2665,10
@@
public abstract class AlignmentViewport implements AlignViewportI,
this.followHighlight = b;
}
this.followHighlight = b;
}
- public int getStartRes()
- {
- return startRes;
- }
-
@Override
@Override
- public int getEndRes()
- {
- return endRes;
- }
-
- public int getStartSeq()
- {
- return startSeq;
- }
-
- public void setStartRes(int res)
- {
- this.startRes = res;
- }
-
- public void setStartSeq(int seq)
- {
- this.startSeq = seq;
- }
-
- public void setEndRes(int res)
+ public ViewportRanges getRanges()
{
{
- if (res > alignment.getWidth() - 1)
- {
- // log.System.out.println(" Corrected res from " + res + " to maximum " +
- // (alignment.getWidth()-1));
- res = alignment.getWidth() - 1;
- }
- if (res < 0)
- {
- res = 0;
- }
- this.endRes = res;
- }
-
- public void setEndSeq(int seq)
- {
- if (seq > alignment.getHeight())
- {
- seq = alignment.getHeight();
- }
- if (seq < 0)
- {
- seq = 0;
- }
- this.endSeq = seq;
- }
-
- public int getEndSeq()
- {
- return endSeq;
+ return ranges;
}
/**
}
/**
@@
-2741,7
+2708,8
@@
public abstract class AlignmentViewport implements AlignViewportI,
* locate 'middle' column (true middle if an odd number visible, left of
* middle if an even number visible)
*/
* locate 'middle' column (true middle if an odd number visible, left of
* middle if an even number visible)
*/
- int middleColumn = getStartRes() + (getEndRes() - getStartRes()) / 2;
+ int middleColumn = ranges.getStartRes()
+ + (ranges.getEndRes() - ranges.getStartRes()) / 2;
final HiddenSequences hiddenSequences = getAlignment()
.getHiddenSequences();
final HiddenSequences hiddenSequences = getAlignment()
.getHiddenSequences();
@@
-2751,7
+2719,7
@@
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 = 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))
@@
-2819,7
+2787,6
@@
public abstract class AlignmentViewport implements AlignViewportI,
*/
private boolean selectionIsDefinedGroup = false;
*/
private boolean selectionIsDefinedGroup = false;
-
@Override
public boolean isSelectionDefinedGroup()
{
@Override
public boolean isSelectionDefinedGroup()
{