if (al != null)
{
al.setDataset(null); // set dataset on alignment/sequences
- if (openSplitFrame(al, format))
+
+ /*
+ * SplitFrame option dependent on applet parameter for now.
+ */
+ boolean allowSplitFrame = alignFrame.viewport.applet
+ .getDefaultParameter("enableSplitFrame", false);
+ if (allowSplitFrame && openSplitFrame(al, format))
{
return;
}
*/
package jalview.bin;
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import netscape.javascript.JSException;
+import netscape.javascript.JSObject;
+
import jalview.api.StructureSelectionManagerProvider;
import jalview.appletgui.AlignFrame;
import jalview.appletgui.AlignViewport;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
-import java.applet.Applet;
-import java.awt.Button;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.EventQueue;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import netscape.javascript.JSException;
-import netscape.javascript.JSObject;
-
/**
* Jalview Applet. Runs in Java 1.18 runtime
*
file = data.toString();
}
}
- file2 = getParameter("file2");
+ if ("true".equalsIgnoreCase(getParameter("enableSplitFrame")))
+ {
+ file2 = getParameter("file2");
+ }
embedded = TRUE.equalsIgnoreCase(getParameter("embedded"));
if (embedded)
import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
+import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.jws1.Discoverer;
sprods[s].updatePDBIds();
}
Alignment al = new Alignment(sprods);
- Set<AlignedCodonFrame> cf = prods.getCodonFrames();
al.setDataset(ds);
+
+ /*
+ * Copy dna-to-protein mappings to new alignment
+ */
+ // TODO 1: no mappings are set up for EMBL product
+ // TODO 2: if they were, should add them to protein alignment, not
+ // dna
+ Set<AlignedCodonFrame> cf = prods.getCodonFrames();
for (AlignedCodonFrame acf : cf)
{
al.addCodonFrame(acf);
+ getTitle();
naf.setTitle(newtitle);
- // remove this flag once confirmed we want a split view
- boolean asSplitFrame = true;
+ // temporary flag until SplitFrame is released
+ boolean asSplitFrame = Cache.getDefault(
+ Preferences.ENABLE_SPLIT_FRAME, false);
if (asSplitFrame)
{
- final Alignment copyAlignment = new Alignment(new Alignment(
- AlignFrame.this.viewport.getSequenceSelection()));
+ /*
+ * Make a copy of this alignment (sharing the same dataset
+ * sequences). If we are DNA, drop introns and update mappings
+ */
+ AlignmentI copyAlignment = null;
+ final SequenceI[] sequenceSelection = AlignFrame.this.viewport
+ .getSequenceSelection();
+ if (dna)
+ {
+ copyAlignment = AlignmentUtils.makeExonAlignment(
+ sequenceSelection, cf);
+ al.getCodonFrames().clear();
+ al.getCodonFrames().addAll(cf);
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.addMappings(cf);
+ }
+ else
+ {
+ copyAlignment = new Alignment(new Alignment(
+ sequenceSelection));
+ }
AlignFrame copyThis = new AlignFrame(copyAlignment,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
copyThis.setTitle(AlignFrame.this.getTitle());
"label.translation_of_params", new Object[]
{ this.getTitle() });
af.setTitle(newTitle);
- final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
- viewport.openSplitFrame(af, new Alignment(seqs), al.getCodonFrames());
- // Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false))
+ {
+ final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
+ viewport.openSplitFrame(af, new Alignment(seqs),
+ al.getCodonFrames());
+ }
+ else
+ {
+ Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ }
}
}
showAutocalculatedAbove = Cache.getDefault(
Preferences.SHOW_AUTOCALC_ABOVE, false);
viewStyle.setScaleProteinAsCdna(Cache.getDefault(
- Preferences.SCALE_PROTEIN_TO_CDNA, false));
+ Preferences.SCALE_PROTEIN_TO_CDNA, true));
}
void init()
// TODO: create undo object for this JAL-1101
/*
- * If one alignment is protein and one nucleotide, with at least one
- * sequence name in common, offer to open a linked alignment.
+ * If any cDNA/protein mappings can be made between the alignments, offer to
+ * open a linked alignment with split frame option.
*/
- if (AlignmentUtils.isMappable(al, getAlignment()))
+ if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false))
{
- if (openLinkedAlignment(al, title))
+ if (AlignmentUtils.isMappable(al, getAlignment()))
{
- return;
+ if (openLinkedAlignment(al, title))
+ {
+ return;
+ }
}
}
+
+ /*
+ * No mappings, or offer declined - add sequences to this alignment
+ */
// TODO: JAL-407 regardless of above - identical sequences (based on ID and
// provenance) should share the same dataset sequence
{
getAlignment().addSequence(al.getSequenceAt(i));
}
- // TODO this call was done by SequenceFetcher but not FileLoader or
- // CutAndPasteTransfer. Is it needed?
- // JBPComment: this repositions the view to show the new sequences
- // JBPComment: so it is needed for UX
+
setEndSeq(getAlignment().getHeight());
firePropertyChange("alignment", null, getAlignment().getSequences());
}
/**
* Show a dialog with the option to open and link (cDNA <-> protein) as a new
- * alignment. Returns true if the new alignment was opened, false if not,
- * because the user declined the offer.
+ * alignment, either as a standalone alignment or in a split frame. Returns
+ * true if the new alignment was opened, false if not, because the user
+ * declined the offer.
*
+ * @param al
* @param title
*/
protected boolean openLinkedAlignment(AlignmentI al, String title)