JAL-4160 --colour can now take user defined scheme names and colour scheme-spec defin...
authorJames Procter <j.procter@dundee.ac.uk>
Tue, 6 Jun 2023 17:38:02 +0000 (18:38 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Tue, 6 Jun 2023 17:38:13 +0000 (18:38 +0100)
help/help/html/features/clarguments-reference.html
src/jalview/bin/Commands.java
src/jalview/bin/argparser/Arg.java

index fc4f0a0..334dcaa 100644 (file)
     </tr>
 
     <tr valign="top">
-    <td><code>&#8209;&#8209;title&nbsp;<em>"string""</em></code></td>
+    <td><code>&#8209;&#8209;title&nbsp;<em>"string"</em></code></td>
     <td>Specifies the title for the open alignment window as <em>string</em>.</td>
     <td></td>
     <td align="center">&#x2713;</td>
 
     <tr valign="top">
     <td><code>&#8209;&#8209;colour&nbsp;<em>name</em></code></td>
-    <td>Applies the colour scheme <em>name</em> to the open alignment window.  Valid values for <em>name</em> are:
+    <td>Applies the colour scheme <em>name</em> to the open alignment window.  Valid values for <em>name</em> include:
     <br/>
     <code>clustal</code>,
     <br/>
     <code>t-coffee-scores</code>,
     <br/>
     <code>sequence-id</code>.
+    <br/>
+    <br/>
+    Names of user defined schemes will also work, and jalview colour scheme specifications like:
+    <br/>
+       <code>&#8209;&#8209;colour "D,E=red; K,R,H=0022FF; C,c=yellow"</code>
     <td></td>
     <td align="center">&#x2713;</td>
     </tr>
index fc8a51a..64c1e72 100644 (file)
@@ -44,6 +44,8 @@ import jalview.io.FileLoader;
 import jalview.io.HtmlSvgOutput;
 import jalview.io.IdentifyFile;
 import jalview.io.NewickFile;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
 import jalview.structure.StructureImportSettings.TFType;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.FileUtils;
@@ -259,7 +261,15 @@ public class Commands
                   Arg.COLOUR, sv, null, "DEFAULT_COLOUR_PROT", "");
           if ("" != colour)
           {
-            af.changeColour_actionPerformed(colour);
+            ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
+                    af.getViewport(), af.getViewport().getAlignment(), colour);
+            
+            if (cs==null && !"None".equals(colour))
+            {
+              Console.warn("Couldn't parse '"+colour+"' as a colourscheme.");
+            } else {
+              af.changeColour(cs);
+            }
             Jalview.testoutput(argParser, Arg.COLOUR, "zappo", colour);
           }
 
index 0d6e3b1..5616953 100644 (file)
@@ -80,7 +80,7 @@ public enum Arg
           "Specifies the title for the open alignment window as string.",
           Opt.STRING, Opt.LINKED),
   COLOUR(Type.OPENING, "color", // being a bit soft on the Americans!
-          "Applies the colour scheme to the open alignment window. Valid values are:\n"
+          "Applies the colour scheme to the open alignment window. Valid values include:\n"
                   + "clustal,\n" + "blosum62,\n" + "pc-identity,\n"
                   + "zappo,\n" + "taylor,\n" + "gecos-flower,\n"
                   + "gecos-blossom,\n" + "gecos-sunset,\n"
@@ -89,7 +89,11 @@ public enum Arg
                   + "turn-propensity,\n" + "buried-index,\n"
                   + "nucleotide,\n" + "nucleotide-ambiguity,\n"
                   + "purine-pyrimidine,\n" + "rna-helices,\n"
-                  + "t-coffee-scores,\n" + "sequence-id.",
+                  + "t-coffee-scores,\n" + "sequence-id.\n"
+                  +"\n"
+                  + "Names of user defined colourschemes will also work,\n"
+                 +"and jalview colourscheme specifications like\n"
+                  +"--colour=\"D,E=red; K,R,H=0022FF; C,c=yellow\"",
           Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
   FEATURES(Type.OPENING, "Add a feature file or URL to the open alignment.",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),