X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=3f572e89fbccad7c5558773a7c6b811dfb553b0a;hb=4bd4726a6cd30825c18525c2a0851e207d687423;hp=15b1fb4ee5cf6235ad8b3c00fc07e22df5937e9c;hpb=f931c557266d95b3f4ab5b64bd108123c90e85ab;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 15b1fb4..3f572e8 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4734,6 +4734,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignmentI xrefsAlignment = makeCrossReferencesAlignment(dataset, xrefs); + final SequenceI[] sequenceSelection = AlignFrame.this.viewport + .getSequenceSelection(); + if (!dna) + { + xrefsAlignment = AlignmentUtils.makeCdsAlignment( + xrefsAlignment.getSequencesArray(), dataset, + sequenceSelection); + xrefsAlignment.alignAs(alignment); + } AlignFrame newFrame = new AlignFrame(xrefsAlignment, DEFAULT_WIDTH, DEFAULT_HEIGHT); @@ -4761,13 +4770,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * sequences). If we are DNA, drop introns and update mappings */ AlignmentI copyAlignment = null; - final SequenceI[] sequenceSelection = AlignFrame.this.viewport - .getSequenceSelection(); boolean copyAlignmentIsAligned = false; if (dna) { copyAlignment = AlignmentUtils.makeCdsAlignment( - sequenceSelection, dataset, xrefsAlignment); + sequenceSelection, dataset, + xrefsAlignment.getSequencesArray()); if (copyAlignment.getHeight() == 0) { System.err.println("Failed to make CDS alignment"); @@ -4787,10 +4795,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - /* - * copy peptide sequences, and add in any alternate products - * of their located coding xrefs - */ copyAlignment = AlignmentUtils.makeCopyAlignment( sequenceSelection, xrefs.getSequencesArray(), dataset); } @@ -4825,7 +4829,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * align cdna to protein - currently only if * fetching and aligning Ensembl transcripts! */ - if (DBRefSource.ENSEMBL.equalsIgnoreCase(source)) + if (dna && DBRefSource.ENSEMBL.equalsIgnoreCase(source)) { copyAlignment.alignAs(xrefsAlignment); } @@ -4884,6 +4888,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * Makes an alignment containing the given sequences, and adds them to the * given dataset, which is also set as the dataset for the new alignment * + * TODO: refactor to DatasetI method + * * @param dataset * @param seqs * @return