import javax.swing.JPopupMenu;
import javax.swing.ToolTipManager;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.renderer.ScaleRenderer;
import jalview.renderer.ScaleRenderer.ScaleMark;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.viewmodel.ViewportListenerI;
import jalview.viewmodel.ViewportRanges;
+import jalview.workers.AlignmentComparisonThread;
/**
* The panel containing the sequence ruler (when not in wrapped mode), and
final int res = ap.getSeqPanel().findAlignmentColumn(evt);
highlightAllStructPos(res);
+ if (av.getCalcManager().getRegisteredWorkersOfClass(AlignmentComparisonThread.class)!=null)
+ {
+ AlignmentI alignment = av.getAlignment();
+ AlignViewportI codingComplement = av.getCodingComplement();
+ List<AlignedCodonFrame> ourMappings = alignment
+ .getCodonFrames();
+ SearchResultsI mappedPos = MappingUtils.allMappedRegionsForColumn(res,
+ ourMappings, alignment.getSequences(),codingComplement.getAlignment().getSequences(),
+ alignment.getGapCharacter());
+ if (mappedPos.getCount()>0)
+ {
+ Desktop.getAlignFrameFor(codingComplement).alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(mappedPos,true);
+ }
+
+ }
if (!av.hasHiddenColumns())
{
return;
}
return found ? mappedTo : null;
}
+
+ public static SearchResultsI allMappedRegionsForColumn(int col,List<AlignedCodonFrame> mappings, List<SequenceI> fromSequences,
+ List<SequenceI> toSequences, char fromGapChar)
+ {
+ int[] mappedTo = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
+
+ SearchResultsI allsr=new SearchResults();
+ /*
+ * For each sequence in the 'from' alignment
+ */
+ for (SequenceI fromSeq : fromSequences)
+ {
+ /*
+ * Ignore gaps (unmapped anyway)
+ */
+ if (fromSeq.getCharAt(col) == fromGapChar)
+ {
+ continue;
+ }
+
+ /*
+ * Get the residue position and find the mapped position.
+ */
+ int residuePos = fromSeq.findPosition(col);
+ SearchResultsI sr = buildSearchResults(fromSeq, residuePos, mappings);
+
+ for (SearchResultMatchI m : sr.getResults())
+ {
+ int mappedStartResidue = m.getStart();
+ int mappedEndResidue = m.getEnd();
+ SequenceI mappedSeq = m.getSequence();
+
+ /*
+ * Locate the aligned sequence whose dataset is mappedSeq. TODO a
+ * datamodel that can do this efficiently.
+ */
+ for (SequenceI toSeq : toSequences)
+ {
+ if (toSeq.getDatasetSequence() == mappedSeq
+ && mappedStartResidue >= toSeq.getStart()
+ && mappedEndResidue <= toSeq.getEnd())
+ {
+ allsr.addResult(toSeq, new int[] { mappedStartResidue,mappedEndResidue});
+ }
+ }
+ }
+ }
+ return allsr;
+ }
/**
* Returns the mapped codon or codons for a given aligned sequence column