JAL-2110 cross-refs from protein to show cds not non-coding sequences
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 6 Jul 2016 11:42:11 +0000 (12:42 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 6 Jul 2016 11:42:11 +0000 (12:42 +0100)
src/jalview/gui/AlignFrame.java

index 19b5b8c..88b0c35 100644 (file)
@@ -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");
@@ -4821,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);
             }