import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import java.util.Set;
import java.util.Vector;
import javax.swing.JInternalFrame;
AlignmentI al = getAlignment();
if (al != null)
{
- Set<AlignedCodonFrame> mappings = al.getCodonFrames();
+ List<AlignedCodonFrame> mappings = al.getCodonFrames();
if (mappings != null)
{
StructureSelectionManager ssm = StructureSelectionManager
*
* @return DOCUMENT ME!
*/
+ @Override
public char getGapCharacter()
{
return getAlignment().getGapCharacter();
*
* @return DOCUMENT ME!
*/
+ @Override
public ColumnSelection getColumnSelection()
{
return colSel;
/**
* Send the current selection to be broadcast to any selection listeners.
*/
+ @Override
public void sendSelection()
{
jalview.structure.StructureSelectionManager
return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
}
+ @Override
public boolean isNormaliseSequenceLogo()
{
return normaliseSequenceLogo;
*
* @return true if alignment characters should be displayed
*/
+ @Override
public boolean isValidCharWidth()
{
return validCharWidth;
* may give the user the option to open a new frame, or split panel, with cDNA
* and protein linked.
*
- * @param al
+ * @param toAdd
* @param title
*/
- public void addAlignment(AlignmentI al, String title)
+ public void addAlignment(AlignmentI toAdd, String title)
{
// TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
// TODO: create undo object for this JAL-1101
/*
- * If any cDNA/protein mappings can be made between the alignments, offer to
- * open a linked alignment with split frame option.
+ * Ensure datasets are created for the new alignment as
+ * mappings operate on dataset sequences
+ */
+ toAdd.setDataset(null);
+
+ /*
+ * Check if any added sequence could be the object of a mapping or
+ * cross-reference; if so, make the mapping explicit
+ */
+ getAlignment().realiseMappings(toAdd.getSequences());
+
+ /*
+ * If any cDNA/protein mappings exist or can be made between the alignments,
+ * offer to open a split frame with linked alignments
*/
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
{
- if (al.getDataset() == null)
- {
- // need to create ds seqs
- for (SequenceI sq : al.getSequences())
- {
- if (sq.getDatasetSequence() == null)
- {
- sq.createDatasetSequence();
- }
- }
- }
- if (AlignmentUtils.isMappable(al, getAlignment()))
+ if (AlignmentUtils.isMappable(toAdd, getAlignment()))
{
- if (openLinkedAlignment(al, title))
+ if (openLinkedAlignment(toAdd, title))
{
return;
}
// TODO: JAL-407 regardless of above - identical sequences (based on ID and
// provenance) should share the same dataset sequence
- for (int i = 0; i < al.getHeight(); i++)
+ AlignmentI al = getAlignment();
+ String gap = String.valueOf(al.getGapCharacter());
+ for (int i = 0; i < toAdd.getHeight(); i++)
{
- getAlignment().addSequence(al.getSequenceAt(i));
+ SequenceI seq = toAdd.getSequenceAt(i);
+ /*
+ * experimental!
+ * - 'align' any mapped sequences as per existing
+ * e.g. cdna to genome, domain hit to protein sequence
+ * very experimental! (need a separate menu option for this)
+ * - only add mapped sequences ('select targets from a dataset')
+ */
+ if (true /*AlignmentUtils.alignSequenceAs(seq, al, gap, true, true)*/)
+ {
+ al.addSequence(seq);
+ }
}
setEndSeq(getAlignment().getHeight());
* is a pre-requisite for building mappings.
*/
al.setDataset(null);
- AlignmentUtils.mapProteinToCdna(protein, cdna);
+ AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna);
/*
* Create the AlignFrame for the added alignment. If it is protein, mappings
// TODO would like next line without cast but needs more refactoring...
final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement())
.getAlignPanel();
- complementPanel.setFollowingComplementScroll(true);
+ complementPanel.setDontScrollComplement(true);
complementPanel.scrollToCentre(sr, verticalOffset);
}
}