- String newtitle = String.format("%s %s %s",
- MessageManager.getString(dna ? "label.proteins"
- : "label.nucleotides"), MessageManager
- .getString("label.for"), getTitle());
- newFrame.setTitle(newtitle);
-
- boolean asSplitFrame = Cache.getDefault(
- Preferences.ENABLE_SPLIT_FRAME, true);
- if (asSplitFrame)
- {
- /*
- * 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();
- List<AlignedCodonFrame> cf = xrefs.getCodonFrames();
- if (dna)
- {
- copyAlignment = AlignmentUtils.makeCdsAlignment(
- sequenceSelection, cf, alignment);
- if (copyAlignment.getHeight() == 0)
- {
- System.err.println("Failed to make CDS alignment");
- }
- al.getCodonFrames().clear();
- al.getCodonFrames().addAll(cf);
- }
- else
- {
- copyAlignment = new Alignment(new Alignment(
- sequenceSelection));
- copyAlignment.getCodonFrames().addAll(cf);
- }
- copyAlignment.setGapCharacter(AlignFrame.this.viewport
- .getGapCharacter());
- StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
- ssm.registerMappings(cf);
-
- /*
- * add in any extra 'peer' sequences discovered
- * (e.g. alternative protein products)
- */
- for (SequenceI peer : addedPeers)
- {
- copyAlignment.addSequence(peer);
- }
-
- if (copyAlignment.getHeight() > 0)
- {
- /*
- * align protein to dna
- */
- // FIXME what if the dna is not aligned :-O
- if (dna)
- {
- al.alignAs(copyAlignment);
- }
- else
- {
- /*
- * align cdna to protein - currently only if
- * fetching and aligning Ensembl transcripts!
- */
- if (DBRefSource.ENSEMBL.equalsIgnoreCase(source))
- {
- copyAlignment.alignAs(al);
- }
- }