import jalview.structure.SequenceListener;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.util.Comparison;
import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
{
ranges.scrollUp(true);
}
- while (seqCanvas.cursorY + 1 > ranges.getEndSeq())
+ while (seqCanvas.cursorY > ranges.getEndSeq())
{
ranges.scrollUp(false);
}
*
* @param sequence
* aligned sequence object
- * @param res
+ * @param column
* alignment column
* @param seq
* index of sequence in alignment
- * @return position of res in sequence
+ * @return position of column in sequence or -1 if at gap
*/
- void setStatusMessage(SequenceI sequence, int res, int seq)
+ void setStatusMessage(SequenceI sequence, int column, int seq)
{
// TODO remove duplication of identical gui method
StringBuilder text = new StringBuilder(32);
/*
* Try to translate the display character to residue name (null for gap).
*/
- final String displayChar = String.valueOf(sequence.getCharAt(res));
+ final String displayChar = String.valueOf(sequence.getCharAt(column));
if (av.getAlignment().isNucleotide())
{
residue = ResidueProperties.nucleotideName.get(displayChar);
int pos = -1;
if (residue != null)
{
- pos = sequence.findPosition(res);
+ pos = sequence.findPosition(column);
text.append(" (").append(Integer.toString(pos)).append(")");
}
if (features != null && features.length > 0)
{
seqCanvas.getFeatureRenderer().amendFeatures(
- new SequenceI[] { sequence }, features, false, ap, null);
+ new SequenceI[] { sequence }, features, false, ap);
seqCanvas.highlightSearchResults(null);
}
@Override
public void mouseMoved(MouseEvent evt)
{
- int res = findRes(evt);
+ final int column = findRes(evt);
int seq = findSeq(evt);
- if (seq >= av.getAlignment().getHeight() || seq < 0 || res < 0)
+ if (seq >= av.getAlignment().getHeight() || seq < 0 || column < 0)
{
if (tooltip != null)
{
}
SequenceI sequence = av.getAlignment().getSequenceAt(seq);
- if (res > sequence.getLength())
+ if (column > sequence.getLength())
{
if (tooltip != null)
{
return;
}
- int respos = sequence.findPosition(res);
- if (ssm != null)
+ final char ch = sequence.getCharAt(column);
+ int respos = Comparison.isGap(ch) ? -1 : sequence.findPosition(column);
+
+ if (ssm != null && respos != -1)
{
- mouseOverSequence(sequence, res, respos);
+ mouseOverSequence(sequence, column, respos);
}
StringBuilder text = new StringBuilder();
.append(" ID: ").append(sequence.getName());
String obj = null;
- final String ch = String.valueOf(sequence.getCharAt(res));
- if (av.getAlignment().isNucleotide())
+ if (respos != -1)
{
- obj = ResidueProperties.nucleotideName.get(ch);
- if (obj != null)
+ if (av.getAlignment().isNucleotide())
{
- text.append(" Nucleotide: ").append(obj);
+ obj = ResidueProperties.nucleotideName.get(ch);
+ if (obj != null)
+ {
+ text.append(" Nucleotide: ").append(obj);
+ }
+ }
+ else
+ {
+ obj = (ch == 'x' || ch == 'X') ? "X" : ResidueProperties.aa2Triplet
+ .get(String.valueOf(ch));
+ if (obj != null)
+ {
+ text.append(" Residue: ").append(obj);
+ }
}
- }
- else
- {
- obj = "X".equalsIgnoreCase(ch) ? "X" : ResidueProperties.aa2Triplet
- .get(ch);
if (obj != null)
{
- text.append(" Residue: ").append(obj);
+ text.append(" (").append(Integer.toString(respos)).append(")");
}
}
- if (obj != null)
- {
- text.append(" (").append(Integer.toString(respos)).append(")");
- }
-
ap.alignFrame.statusBar.setText(text.toString());
StringBuilder tooltipText = new StringBuilder();
{
for (int g = 0; g < groups.length; g++)
{
- if (groups[g].getStartRes() <= res && groups[g].getEndRes() >= res)
+ if (groups[g].getStartRes() <= column && groups[g].getEndRes() >= column)
{
if (!groups[g].getName().startsWith("JTreeGroup")
&& !groups[g].getName().startsWith("JGroup"))
}
}
- // use aa to see if the mouse pointer is on a
- SequenceFeature[] allFeatures = findFeaturesAtRes(sequence,
- sequence.findPosition(res));
-
- int index = 0;
- while (index < allFeatures.length)
+ /*
+ * add feature details to tooltip if over one or more features
+ */
+ if (respos != -1)
{
- SequenceFeature sf = allFeatures[index];
-
- tooltipText.append(sf.getType() + " " + sf.begin + ":" + sf.end);
+ SequenceFeature[] allFeatures = findFeaturesAtRes(sequence,
+ sequence.findPosition(column));
- if (sf.getDescription() != null)
+ int index = 0;
+ while (index < allFeatures.length)
{
- tooltipText.append(" " + sf.getDescription());
- }
+ SequenceFeature sf = allFeatures[index];
- if (sf.getValue("status") != null)
- {
- String status = sf.getValue("status").toString();
- if (status.length() > 0)
+ tooltipText.append(sf.getType() + " " + sf.begin + ":" + sf.end);
+
+ if (sf.getDescription() != null)
{
- tooltipText.append(" (" + sf.getValue("status") + ")");
+ tooltipText.append(" " + sf.getDescription());
}
- }
- tooltipText.append("\n");
- index++;
+ if (sf.getValue("status") != null)
+ {
+ String status = sf.getValue("status").toString();
+ if (status.length() > 0)
+ {
+ tooltipText.append(" (" + sf.getValue("status") + ")");
+ }
+ }
+ tooltipText.append("\n");
+
+ index++;
+ }
}
if (tooltip == null)