Proteopedia:DIY:Macros
From Proteopedia
(Difference between revisions)
m |
|||
(10 intermediate revisions not shown.) | |||
Line 9: | Line 9: | ||
==Defined Macros== | ==Defined Macros== | ||
- | '''Example #1: Calling a basic macro function''' | ||
The currently listing of defined macro functions can be found at [[Proteopedia:Macros]]. | The currently listing of defined macro functions can be found at [[Proteopedia:Macros]]. | ||
Line 15: | Line 14: | ||
Integrating macro use into JSmol code is straightforward. | Integrating macro use into JSmol code is straightforward. | ||
- | This example doesn't require any parameter to act. It causes the structure shown to 'bobble | + | |
+ | '''Example #1: Calling a simple macro function''' | ||
+ | |||
+ | This example doesn't require any parameter to act. It causes the structure shown to 'bobble'. | ||
<!-- | <!-- | ||
<pre> | <pre> | ||
Line 59: | Line 61: | ||
</pre> | </pre> | ||
- | The <code><nowiki>bobble()</nowiki></code> button triggers the action. The other button uses <code><nowiki>exit</nowiki></code> to stop the looping bobble.< | + | The <code><nowiki>bobble()</nowiki></code> button triggers the action. The other button uses <code><nowiki>exit</nowiki></code> to stop the looping bobble.<br/> |
You can try the result here: | You can try the result here: | ||
Line 84: | Line 86: | ||
(<jmol> | (<jmol> | ||
<jmolLink> | <jmolLink> | ||
- | <script>script /mc/ktheis.spt;blink( | + | <script>script /mc/ktheis.spt;blink({HEM})</script> |
<text>☼</text> | <text>☼</text> | ||
</jmolLink> | </jmolLink> | ||
</jmol>) | </jmol>) | ||
</pre> | </pre> | ||
- | |||
- | '''Doesn't seem to allow anything other than ligand!?!?''' Why doesn't 'HEM' or '[HEM]' work as the peekaboo example seems to indicate it should?!?! | ||
You can try the result here:<br/> | You can try the result here:<br/> | ||
- | To | + | To highlight the heme group, click on the green sun symbol in the parentheses --> (<jmol> |
<jmolLink> | <jmolLink> | ||
- | <script>script /mc/ktheis.spt;blink( | + | <script>script /mc/ktheis.spt;blink({HEM})</script> |
<text>☼</text> | <text>☼</text> | ||
</jmolLink> | </jmolLink> | ||
Line 104: | Line 104: | ||
'''Example #3: Another showing supplying the macro a parameter''' | '''Example #3: Another showing supplying the macro a parameter''' | ||
- | |||
Example code: | Example code: | ||
Line 110: | Line 109: | ||
<jmol> | <jmol> | ||
<jmolLink> | <jmolLink> | ||
- | <script>script /mc/ktheis.spt;peekaboo( | + | <script>script /mc/ktheis.spt;peekaboo({HEM})</script> |
<text>Hide Heme for a moment</text> | <text>Hide Heme for a moment</text> | ||
</jmolLink> | </jmolLink> | ||
</jmol> | </jmol> | ||
</pre> | </pre> | ||
- | |||
- | '''Doesn't seem to allow anything other than ligand!?!?''' Why doesn't 'HEM' or '[HEM]' work as the peekaboo example seems to indicate it should?!?! It seems to hide all ligands!??! I also tried peekaboo(HEM) and peekaboo([HEM]) | ||
You can try the result here:<br/> | You can try the result here:<br/> | ||
<jmol> | <jmol> | ||
<jmolLink> | <jmolLink> | ||
- | <script>script /mc/ktheis.spt;peekaboo( | + | <script>script /mc/ktheis.spt;peekaboo({HEM})</script> |
<text>Hide Heme for a moment</text> | <text>Hide Heme for a moment</text> | ||
</jmolLink> | </jmolLink> | ||
</jmol> | </jmol> | ||
+ | |||
+ | '''Example #4: color selection by B-factor''' | ||
+ | |||
+ | Example code: | ||
+ | |||
+ | <pre> | ||
+ | <jmol> | ||
+ | <jmolLink> | ||
+ | <script>script /mc/aherraez.spt;putty({protein})</script> | ||
+ | <text>apply putty</text> | ||
+ | </jmolLink> | ||
+ | </jmol> | ||
+ | </pre> | ||
+ | |||
+ | You can try the result here:<br/> | ||
+ | <jmol> | ||
+ | <jmolLink> | ||
+ | <script>script /mc/aherraez.spt;putty({protein})</script> | ||
+ | <text>apply putty</text> | ||
+ | </jmolLink> | ||
+ | </jmol> | ||
Line 131: | Line 149: | ||
==Coding New Macros== | ==Coding New Macros== | ||
- | Advanced users who want to code additional macros can get a flavor for the JSmol operating behind the scenes and ideas on how they'd code their own by examining the code for macros already available. To view an example go the [[Proteopedia:Macros]] page and note that examples such as the 'bobble()' example include notes on how you import it using <code><nowiki> script /mc/ktheis.spt</nowiki></code>. In particular note the <code><nowiki>/mc/ktheis.spt</nowiki></code> part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after <code><nowiki>http://proteopedia.org/wiki/</nowiki></code> so you end up at <code><nowiki>http://proteopedia.org/wiki//mc/ktheis.spt</nowiki></code> where you can see the code for several defined macro functions. | + | Advanced users who want to code additional macros can get a flavor for the JSmol operating behind the scenes and ideas on how they'd code their own by examining the code for macros already available. To view an example go the [[Proteopedia:Macros]] page and note that examples such as the 'bobble()' example include notes on how you import it using <code><nowiki> script /mc/ktheis.spt</nowiki></code>. In particular note the <code><nowiki>/mc/ktheis.spt</nowiki></code> part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after <code><nowiki>http://proteopedia.org/wiki/</nowiki></code> so you end up at <code><nowiki>http://proteopedia.org/wiki//mc/ktheis.spt</nowiki></code> where you can see the code for several defined macro functions. Jmol's documentation for user-defined functions, that serve as the basis the use of macros on Proteopedia, can be found [https://chemapps.stolaf.edu/jmol/docs/#functionsuser-definedfunctions here]. |
</StructureSection> | </StructureSection> |
Current revision
Macros as a tool
Macros can be used in Proteopedia pages to call commonly used JSmol code. Macro functions can take parameters so that the code is general but can act on the specified item or items. Additional macros can be made.
This page is meant to be a resource for finding and using macros.
|