Hi, I am having some syntax problems with how to hook up this function with jmol. I am now on Jmol 12.0.22. What is the correct approach to load it? Just calling the jmol load or script commands does not seem to work...
Thanks, Andreas On Thu, Nov 18, 2010 at 6:13 AM, Rolf Huehne <rhue...@fli-leibniz.de> wrote: > On 11/17/2010 08:42 PM, Andreas Prlic wrote: >> Ok here my suggestion for a palette that resolves to various >> distinguishable shades of blue and yellow for color blind people and >> still looks kind of ok-ish for all others (thanks to >> http://colorschemedesigner.com/ for making this selection easy ) >> >> Primary Color: >> 104BA9 284A7E 052D6E 447BD4 6A93D4 >> Secondary Color A: >> AA00A2 7F207B 6E0069 D435CD D460CF >> Secondary Color B: >> C9F600 9FB82E 83A000 D8FA3F E1FA71 >> Complementary Color: >> FFA200 BF8B30 A66A00 FFBA40 FFCC73 >> >> For having good contrasts for "color chain" it would be good to rotate >> column by column from left to right through this grid... >> > I wrote a Jmol function "color_by_chain(atom-object type)" (see below) > that implements Andreas color scheme for chains. Just put the script > into a file and load it. (It will need Jmol version 12.x. I tested it > with version 12.0.22.) > > Afterwards you can color the current selection by calling this command. > If you provide an empty "atom-object type" all object types like > cartoon, trace are colored alike (more precise: set to none, meaning > they inherit it from "atom"). If you name an object type only this type > is colored. > > Examples: > color_by_chain("cartoon"); > color_by_chain(""); > > The colors are not tied to a specific chain id like in the standard > chain color scheme. Instead they are assigned alphabetically to the > present chain ids (e.g. A,B,C in structure 1 will be colored like G,I,Y > in structure 2, if there are no other chains). > > Unfortunately Jmol 12.0.22 doesn't like it if you try to provide the > object type by a variable (type="cartoon"; color @type red) and throws > an error. So I had to add each type individually and also couldn't use a > loop for the "empty object type" case. > > Regards, > Rolf > > ========================================================== > function color_by_chain(type) { > var chain_list = script("show chain").trim().lines; > var chain_count = chain_list.length; > > define current_selection selected; > > var color_list = > array("x104BA9","xAA00A2","xC9F600","xFFA200","x284A7E","x7F207B","x9FB82E","xBF8B30","x052D6E","x6E0069","x83A000","xA66A00","x447BD4","xD435CD","xD8FA3F","xFFBA40","x6A93D4","xD460CF","xE1FA71","xFFCC73"); > var color_count = color_list.length; > > for (var chain_number=1; chain_number<=chain_count; chain_number++) { > var color_index = chain_number % color_count; > var chain_color = color_list[color_index]; > > var selection_expression = "current_selection and :" + > chain_list[chain_number]; > select @selection_expression; > > if (type == "") { > color atom [...@chain_color]; > > color backbone none; > color cartoon none; > color dots none; > color halo none; > color label none; > color meshribbon none; > color polyhedra none; > color rocket none; > color star none; > color strand none; > color strut none; > color trace none; > } > > if (type == "atom") { > color atom [...@chain_color]; > } > if (type == "backbone") { > color backbone [...@chain_color]; > } > if (type == "cartoon") { > color cartoon [...@chain_color]; > } > if (type == "dots") { > color dots [...@chain_color]; > } > if (type == "halo") { > color halo [...@chain_color]; > } > if (type == "label") { > color label [...@chain_color]; > } > if (type == "meshribbon") { > color meshribbon [...@chain_color]; > } > if (type == "polyhedra") { > color polyhedra [...@chain_color]; > } > if (type == "rocket") { > color rocket [...@chain_color]; > } > if (type == "star") { > color star [...@chain_color]; > } > if (type == "strand") { > color strand [...@chain_color]; > } > if (type == "strut") { > color strut [...@chain_color]; > } > if (type == "trace") { > color trace [...@chain_color]; > } > } > > select current_selection; > } > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today > http://p.sf.net/sfu/msIE9-sfdev2dev > _______________________________________________ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users > -- ----------------------------------------------------------------------- Dr. Andreas Prlic Senior Scientist, RCSB PDB Protein Data Bank University of California, San Diego (+1) 858.246.0526 ----------------------------------------------------------------------- ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users