Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings
[jalview.git] / src / jalview / gui / CrossRefAction.java
index 7045481..16f2b5d 100644 (file)
@@ -111,6 +111,13 @@ public class CrossRefAction implements Runnable
       FeatureSettingsModelI featureColourScheme = new SequenceFetcher()
               .getFeatureColourScheme(source);
 
+      if (dna && AlignmentUtils.looksLikeEnsembl(alignment))
+      {
+        // override default featureColourScheme so products have Ensembl variant colours
+        featureColourScheme = new SequenceFetcher()
+                .getFeatureColourScheme(DBRefSource.ENSEMBL);
+      }
+
       AlignmentI xrefsAlignment = makeCrossReferencesAlignment(dataset,
               xrefs);
       if (!dna)
@@ -187,15 +194,24 @@ public class CrossRefAction implements Runnable
 
       /*
        * apply 'database source' feature configuration
-       * if any was found
+       * if any - first to the new splitframe view about to be displayed
        */
-      // TODO is this the feature colouring for the original
-      // alignment or the fetched xrefs? either could be Ensembl
+
       newFrame.getViewport().applyFeaturesStyle(featureColourScheme);
       copyThis.getViewport().applyFeaturesStyle(featureColourScheme);
 
+      /*
+       * and for JAL-3330 also to original alignFrame view(s)
+       * this currently trashes any original settings.
+       */
+      for (AlignmentViewPanel origpanel: alignFrame.getAlignPanels()) {
+        origpanel.getAlignViewport()
+                .mergeFeaturesStyle(featureColourScheme);
+      }
+
       SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame,
               dna ? newFrame : copyThis);
+
       newFrame.setVisible(true);
       copyThis.setVisible(true);
       String linkedTitle = MessageManager
@@ -356,12 +372,12 @@ public class CrossRefAction implements Runnable
             seq.getLength());
     if (geneLoci != null)
     {
-      MapList map = geneLoci.getMap();
+      MapList map = geneLoci.getMapping();
       int mappedFromLength = MappingUtils.getLength(map.getFromRanges());
       if (mappedFromLength == seq.getLength())
       {
         seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(),
-                geneLoci.getChromosomeId(), geneLoci.getMap());
+                geneLoci.getChromosomeId(), map);
         retrievedLoci.put(dbref, geneLoci);
         return true;
       }
@@ -374,12 +390,12 @@ public class CrossRefAction implements Runnable
             seq.getLength());
     if (geneLoci != null)
     {
-      MapList map = geneLoci.getMap();
+      MapList map = geneLoci.getMapping();
       int mappedFromLength = MappingUtils.getLength(map.getFromRanges());
       if (mappedFromLength == seq.getLength())
       {
         seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(),
-                geneLoci.getChromosomeId(), geneLoci.getMap());
+                geneLoci.getChromosomeId(), map);
         retrievedLoci.put(dbref, geneLoci);
         return true;
       }