From 55be75760a07698418e5c5cf4d84119f19a5ba4d Mon Sep 17 00:00:00 2001 From: James Procter Date: Tue, 6 Jun 2023 18:38:02 +0100 Subject: [PATCH] JAL-4160 --colour can now take user defined scheme names and colour scheme-spec definition lines as its value --- help/help/html/features/clarguments-reference.html | 9 +++++++-- src/jalview/bin/Commands.java | 12 +++++++++++- src/jalview/bin/argparser/Arg.java | 8 ++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/help/help/html/features/clarguments-reference.html b/help/help/html/features/clarguments-reference.html index fc4f0a0..334dcaa 100644 --- a/help/help/html/features/clarguments-reference.html +++ b/help/help/html/features/clarguments-reference.html @@ -232,7 +232,7 @@ - ‑‑title "string"" + ‑‑title "string" Specifies the title for the open alignment window as string. ✓ @@ -240,7 +240,7 @@ ‑‑colour name - Applies the colour scheme name to the open alignment window. Valid values for name are: + Applies the colour scheme name to the open alignment window. Valid values for name include:
clustal,
@@ -281,6 +281,11 @@ t-coffee-scores,
sequence-id. +
+
+ Names of user defined schemes will also work, and jalview colour scheme specifications like: +
+ ‑‑colour "D,E=red; K,R,H=0022FF; C,c=yellow" ✓ diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index fc8a51a..64c1e72 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -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); } diff --git a/src/jalview/bin/argparser/Arg.java b/src/jalview/bin/argparser/Arg.java index 0d6e3b1..5616953 100644 --- a/src/jalview/bin/argparser/Arg.java +++ b/src/jalview/bin/argparser/Arg.java @@ -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), -- 1.7.10.2