JAL-2228 updated script in help docs, renamed docs, and added note about non-backward...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 12 May 2017 13:29:28 +0000 (14:29 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 12 May 2017 13:29:28 +0000 (14:29 +0100)
examples/groovy/featuresCounter.groovy
help/help.jhm
help/helpTOC.xml
help/html/features/groovy.html
help/html/groovy/featureCounter.html [deleted file]
help/html/groovy/featuresCounter.html [new file with mode: 0644]

index ccbb830..dc4c97c 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
 import jalview.workers.AlignmentAnnotationFactory;
 import jalview.workers.FeatureSetCounterI;
 
@@ -10,7 +31,11 @@ import jalview.workers.FeatureSetCounterI;
  *
  * The script only needs to be run once - it will be registered by Jalview
  * and recalculated automatically when the alignment changes.
+ * 
+ * Note: The feature api provided by 2.10.2 is not compatible with scripts
+ * that worked with earlier Jalview versions. Apologies for the inconvenience.
  */
 def annotator = 
     [
      getNames: { ['Phosphorylation', 'Turn'] as String[] }, 
index 984c2d1..d86faf1 100755 (executable)
    
    <mapID target="memory" url="html/memory.html" />
    <mapID target="groovy" url="html/features/groovy.html" />
-   <mapID target="groovy.featurecounter" url="html/groovy/featureCounter.html" />
+   <mapID target="groovy.featurescounter" url="html/groovy/featuresCounter.html" />
    <mapID target="privacy" url="html/privacy.html" />
    <mapID target="vamsas" url="html/vamsas/index.html"/>
    <mapID target="aminoAcids" url="html/misc/aminoAcids.html" />
index 482ccdf..6e7f5ac 100755 (executable)
@@ -24,6 +24,7 @@
        <tocitem text="Jalview Documentation" target="home" expand="true">
                        <tocitem text="What's new" target="new" expand="true">
                                <tocitem text="Latest Release Notes" target="release"/>
+                               <tocitem text="Groovy Features Counter example" target="groovy.featurescounter"/>
                </tocitem>
                
                <tocitem text="Editing Alignments" target="edit" />
                <tocitem text="Preferences" target="preferences" />
                <tocitem text="Memory Settings" target="memory" expand="false"/>
                <tocitem text="Scripting with Groovy" target="groovy">
-                       <tocitem text="Groovy Feature Counter example" target="groovy.featurecounter"/>
+                       <tocitem text="Groovy Features Counter example" target="groovy.featurescounter"/>
                </tocitem>
                <tocitem text="Command Line" target="commandline" expand="false">
                        <tocitem text="Command Line Arguments" target="clarguments" />
index 254f92e..d9bf76e 100644 (file)
@@ -108,7 +108,7 @@ print currentAlFrame.getTitle();</pre>
     simplified the alignment analysis programming interface in Jalview
     2.10 to make it easy for you to add your own dynamic annotation
     tracks with Groovy. Have a look at the <a
-      href="../groovy/featureCounter.html">featureCounter.groovy</a>
+      href="../groovy/featuresCounter.html">featuresCounter.groovy</a>
     example for more information.
   </p>
 
diff --git a/help/html/groovy/featureCounter.html b/help/html/groovy/featureCounter.html
deleted file mode 100644 (file)
index 2ebaf45..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- * 
- * This file is part of Jalview.
- * 
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *  
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
- * PURPOSE.  See the GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- -->
-<head>
-<title>Extending Jalview with Groovy - Feature Counter Example</title>
-</head>
-<body>
-  <p>
-    <strong>Extending Jalview with Groovy - A customisable
-      feature counter</strong><br /> <br />The groovy script below shows how to
-    add a new calculation track to a Jalview alignment window.
-  </p>
-  <p>As currently written, it will add two tracks to a protein
-    alignment view which count Pfam features in each column, and ones
-    where a charge residue also occur.</p>
-  <p>To try it for yourself:</p>
-  <ol>
-    <li>Copy and paste it into the groovy script console</li>
-    <li>Load the example Feredoxin project (the one that opens by
-      default when you first launched Jalview)</li>
-    <li>Select <strong>Calculations&#8594;Execute Groovy
-        Script</strong> from the alignment window's menu bar to run the script on
-      the current view.
-    </li>
-  </ol>
-  <em><a
-    href="http://www.jalview.org/examples/groovy/featureCounter.groovy">http://www.jalview.org/examples/groovy/featureCounter.groovy</a>
-    - rendered with <a href="http://hilite.me">hilite.me</a></em>
-  <!-- HTML generated using hilite.me -->
-  <div
-    style="background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;">
-    <pre style="margin: 0; line-height: 125%">
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Jalview - A Sequence Alignment Editor and Viewer (Version 2.10)</span>
-<span style="color: #888888"> * Copyright (C) 2016 The Jalview Authors</span>
-<span style="color: #888888"> * </span>
-<span style="color: #888888"> * This file is part of Jalview.</span>
-<span style="color: #888888"> * </span>
-<span style="color: #888888"> * Jalview is free software: you can redistribute it and/or</span>
-<span style="color: #888888"> * modify it under the terms of the GNU General Public License </span>
-<span style="color: #888888"> * as published by the Free Software Foundation, either version 3</span>
-<span style="color: #888888"> * of the License, or (at your option) any later version.</span>
-<span style="color: #888888"> *  </span>
-<span style="color: #888888"> * Jalview is distributed in the hope that it will be useful, but </span>
-<span style="color: #888888"> * WITHOUT ANY WARRANTY; without even the implied warranty </span>
-<span style="color: #888888"> * of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span>
-<span style="color: #888888"> * PURPOSE.  See the GNU General Public License for more details.</span>
-<span style="color: #888888"> * </span>
-<span style="color: #888888"> * You should have received a copy of the GNU General Public License</span>
-<span style="color: #888888"> * along with Jalview.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
-<span style="color: #888888"> * The Jalview Authors are detailed in the &#39;AUTHORS&#39; file.</span>
-<span style="color: #888888"> */</span>
-<span style="color: #008800; font-weight: bold">import</span> <span
-        style="color: #0e84b5; font-weight: bold">jalview.workers.FeatureCounterI</span><span
-        style="color: #333333">;</span>
-<span style="color: #008800; font-weight: bold">import</span> <span
-        style="color: #0e84b5; font-weight: bold">jalview.workers.AlignmentAnnotationFactory</span><span
-        style="color: #333333">;</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Example script that registers two alignment annotation calculators</span>
-<span style="color: #888888"> * - one that counts residues in a column with Pfam annotation</span>
-<span style="color: #888888"> * - one that counts only charged residues with Pfam annotation</span>
-<span style="color: #888888"> *</span>
-<span style="color: #888888"> * To try:</span>
-<span style="color: #888888"> * 1. load uniref50.fa from the examples folder</span>
-<span style="color: #888888"> * 2. load features onto it from from examples/exampleFeatures.txt</span>
-<span style="color: #888888"> * 3. Open this script in the Groovy console.</span>
-<span style="color: #888888"> * 4. Either execute this script from the console, or via Calculate-&gt;Run Groovy Script</span>
-<span style="color: #888888"> </span>
-<span style="color: #888888"> * To explore further, try changing this script to count other kinds of occurrences of </span>
-<span style="color: #888888"> * residue and sequence features at columns in an alignment.</span>
-<span style="color: #888888"> */</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * A closure that returns true for any Charged residue</span>
-<span style="color: #888888"> */</span>
-<span style="color: #333399; font-weight: bold">def</span> isCharged <span
-        style="color: #333333">=</span> <span style="color: #333333">{</span> residue <span
-        style="color: #333333">-&gt;</span>
-    <span style="color: #008800; font-weight: bold">switch</span><span
-        style="color: #333333">(</span>residue<span
-        style="color: #333333">)</span> <span style="color: #333333">{</span>
-        <span style="color: #008800; font-weight: bold">case</span> <span
-        style="color: #333333">[</span><span
-        style="background-color: #fff0f0">&#39;D&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;d&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;E&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;e&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;H&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;h&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;K&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;k&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;R&#39;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&#39;r&#39;</span><span
-        style="color: #333333">]:</span>
-            <span style="color: #008800; font-weight: bold">return</span> <span
-        style="color: #008800; font-weight: bold">true</span>
-    <span style="color: #333333">}</span>
-    <span style="color: #008800; font-weight: bold">false</span>
-<span style="color: #333333">}</span> 
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * A closure that returns 1 if sequence features include type &#39;Pfam&#39;, else 0</span>
-<span style="color: #888888"> * Argument should be a list of SequenceFeature </span>
-<span style="color: #888888"> */</span>
-<span style="color: #333399; font-weight: bold">def</span> hasPfam <span
-        style="color: #333333">=</span> <span style="color: #333333">{</span> features <span
-        style="color: #333333">-&gt;</span> 
-    <span style="color: #008800; font-weight: bold">for</span> <span
-        style="color: #333333">(</span>sf <span
-        style="color: #008800; font-weight: bold">in</span> features<span
-        style="color: #333333">)</span>
-    <span style="color: #333333">{</span>
-        <span style="color: #888888">/*</span>
-<span style="color: #888888">         * Here we inspect the type of the sequence feature.</span>
-<span style="color: #888888">         * You can also test sf.description, sf.score, sf.featureGroup,</span>
-<span style="color: #888888">         * sf.strand, sf.phase, sf.begin, sf.end</span>
-<span style="color: #888888">         * or sf.getValue(attributeName) for GFF &#39;column 9&#39; properties</span>
-<span style="color: #888888">         */</span>
-        <span style="color: #008800; font-weight: bold">if</span> <span
-        style="color: #333333">(</span><span
-        style="background-color: #fff0f0">&quot;Pfam&quot;</span><span
-        style="color: #333333">.</span><span style="color: #0000CC">equals</span><span
-        style="color: #333333">(</span>sf<span style="color: #333333">.</span><span
-        style="color: #0000CC">type</span><span style="color: #333333">))</span>
-        <span style="color: #333333">{</span>
-            <span style="color: #008800; font-weight: bold">return</span> <span
-        style="color: #008800; font-weight: bold">true</span>
-        <span style="color: #333333">}</span>
-    <span style="color: #333333">}</span>
-    <span style="color: #008800; font-weight: bold">false</span>
-<span style="color: #333333">}</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Closure that computes an annotation based on </span>
-<span style="color: #888888"> * presence of particular residues and features</span>
-<span style="color: #888888"> * Parameters are</span>
-<span style="color: #888888"> * - the name (label) for the alignment annotation</span>
-<span style="color: #888888"> * - the description (tooltip) for the annotation</span>
-<span style="color: #888888"> * - a closure (groovy function) that tests whether to include a residue</span>
-<span style="color: #888888"> * - a closure that tests whether to increment count based on sequence features  </span>
-<span style="color: #888888"> */</span>
-<span style="color: #333399; font-weight: bold">def</span> getColumnCounter <span
-        style="color: #333333">=</span> <span style="color: #333333">{</span> name<span
-        style="color: #333333">,</span> desc<span style="color: #333333">,</span> acceptResidue<span
-        style="color: #333333">,</span> acceptFeatures <span
-        style="color: #333333">-&gt;</span>
-    <span style="color: #333333">[</span>
-     <span style="color: #997700; font-weight: bold">getName:</span> <span
-        style="color: #333333">{</span> name <span
-        style="color: #333333">},</span> 
-     <span style="color: #997700; font-weight: bold">getDescription:</span> <span
-        style="color: #333333">{</span> desc <span
-        style="color: #333333">},</span>
-     <span style="color: #997700; font-weight: bold">getMinColour:</span> <span
-        style="color: #333333">{</span> <span style="color: #333333">[</span><span
-        style="color: #0000DD; font-weight: bold">0</span><span
-        style="color: #333333">,</span> <span
-        style="color: #0000DD; font-weight: bold">255</span><span
-        style="color: #333333">,</span> <span
-        style="color: #0000DD; font-weight: bold">255</span><span
-        style="color: #333333">]</span> <span style="color: #333333">},</span> <span
-        style="color: #888888">// cyan</span>
-     <span style="color: #997700; font-weight: bold">getMaxColour:</span> <span
-        style="color: #333333">{</span> <span style="color: #333333">[</span><span
-        style="color: #0000DD; font-weight: bold">0</span><span
-        style="color: #333333">,</span> <span
-        style="color: #0000DD; font-weight: bold">0</span><span
-        style="color: #333333">,</span> <span
-        style="color: #0000DD; font-weight: bold">255</span><span
-        style="color: #333333">]</span> <span style="color: #333333">},</span> <span
-        style="color: #888888">// blue</span>
-     <span style="color: #997700; font-weight: bold">count:</span> 
-         <span style="color: #333333">{</span> res<span
-        style="color: #333333">,</span> feats <span
-        style="color: #333333">-&gt;</span> 
-            <span style="color: #333399; font-weight: bold">def</span> c <span
-        style="color: #333333">=</span> <span
-        style="color: #0000DD; font-weight: bold">0</span>
-            <span style="color: #008800; font-weight: bold">if</span> <span
-        style="color: #333333">(</span>acceptResidue<span
-        style="color: #333333">.</span><span style="color: #0000CC">call</span><span
-        style="color: #333333">(</span>res<span style="color: #333333">))</span>
-            <span style="color: #333333">{</span>
-                <span style="color: #008800; font-weight: bold">if</span> <span
-        style="color: #333333">(</span>acceptFeatures<span
-        style="color: #333333">.</span><span style="color: #0000CC">call</span><span
-        style="color: #333333">(</span>feats<span style="color: #333333">))</span>
-                <span style="color: #333333">{</span>
-                    c<span style="color: #333333">++</span>
-                <span style="color: #333333">}</span>
-            <span style="color: #333333">}</span>
-            c
-         <span style="color: #333333">}</span>
-     <span style="color: #333333">]</span> <span
-        style="color: #008800; font-weight: bold">as</span> FeatureCounterI
-<span style="color: #333333">}</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Define an annotation row that counts any residue with Pfam domain annotation</span>
-<span style="color: #888888"> */</span>
-<span style="color: #333399; font-weight: bold">def</span> pfamAnnotation <span
-        style="color: #333333">=</span> getColumnCounter<span
-        style="color: #333333">(</span><span
-        style="background-color: #fff0f0">&quot;Pfam&quot;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&quot;Count of residues with Pfam domain annotation&quot;</span><span
-        style="color: #333333">,</span> <span style="color: #333333">{</span><span
-        style="color: #008800; font-weight: bold">true</span><span
-        style="color: #333333">},</span> hasPfam<span
-        style="color: #333333">)</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Define an annotation row that counts charged residues with Pfam domain annotation</span>
-<span style="color: #888888"> */</span>
-<span style="color: #333399; font-weight: bold">def</span> chargedPfamAnnotation <span
-        style="color: #333333">=</span> getColumnCounter<span
-        style="color: #333333">(</span><span
-        style="background-color: #fff0f0">&quot;Pfam charged&quot;</span><span
-        style="color: #333333">,</span> <span
-        style="background-color: #fff0f0">&quot;Count of charged residues with Pfam domain annotation&quot;</span><span
-        style="color: #333333">,</span> isCharged<span
-        style="color: #333333">,</span> hasPfam<span
-        style="color: #333333">)</span>
-
-<span style="color: #888888">/*</span>
-<span style="color: #888888"> * Register the annotations</span>
-<span style="color: #888888"> */</span>
-AlignmentAnnotationFactory<span style="color: #333333">.</span><span
-        style="color: #0000CC">newCalculator</span><span
-        style="color: #333333">(</span>pfamAnnotation<span
-        style="color: #333333">)</span> 
-AlignmentAnnotationFactory<span style="color: #333333">.</span><span
-        style="color: #0000CC">newCalculator</span><span
-        style="color: #333333">(</span>chargedPfamAnnotation<span
-        style="color: #333333">)</span>
-</pre>
-  </div>
-</body>
-</html>
diff --git a/help/html/groovy/featuresCounter.html b/help/html/groovy/featuresCounter.html
new file mode 100644 (file)
index 0000000..3b6705b
--- /dev/null
@@ -0,0 +1,123 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Extending Jalview with Groovy - Feature Counter Example</title>
+</head>
+<body>
+  <p>
+    <strong>Extending Jalview with Groovy - A customisable
+      feature counter</strong><br /> <br />The groovy script below shows how to
+    add a new calculation track to a Jalview alignment window.
+  </p>
+  <p>As currently written, it will add two tracks to a protein
+    alignment view which count Pfam features in each column, and ones
+    where a charge residue also occur.</p>
+  <p>To try it for yourself:</p>
+  <ol>
+    <li>Copy and paste it into the groovy script console</li>
+    <li>Load the example Feredoxin project (the one that opens by
+      default when you first launched Jalview)</li>
+    <li>Select <strong>Calculations&#8594;Execute Groovy
+        Script</strong> from the alignment window's menu bar to run the script on
+      the current view.
+    </li>
+  </ol>
+  <strong>Please note: The 2.10.2 feature counting interface is not compatible with earlier versions.</strong><br/><br/>
+  <em><a
+    href="http://www.jalview.org/examples/groovy/featuresCounter.groovy">http://www.jalview.org/examples/groovy/featuresCounter.groovy</a>
+    - rendered with <a href="http://hilite.me">hilite.me</a></em>
+  <!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #408080; font-style: italic">/*</span>
+<span style="color: #408080; font-style: italic"> * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)</span>
+<span style="color: #408080; font-style: italic"> * Copyright (C) $$Year-Rel$$ The Jalview Authors</span>
+<span style="color: #408080; font-style: italic"> * </span>
+<span style="color: #408080; font-style: italic"> * This file is part of Jalview.</span>
+<span style="color: #408080; font-style: italic"> * </span>
+<span style="color: #408080; font-style: italic"> * Jalview is free software: you can redistribute it and/or</span>
+<span style="color: #408080; font-style: italic"> * modify it under the terms of the GNU General Public License </span>
+<span style="color: #408080; font-style: italic"> * as published by the Free Software Foundation, either version 3</span>
+<span style="color: #408080; font-style: italic"> * of the License, or (at your option) any later version.</span>
+<span style="color: #408080; font-style: italic"> *  </span>
+<span style="color: #408080; font-style: italic"> * Jalview is distributed in the hope that it will be useful, but </span>
+<span style="color: #408080; font-style: italic"> * WITHOUT ANY WARRANTY; without even the implied warranty </span>
+<span style="color: #408080; font-style: italic"> * of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span>
+<span style="color: #408080; font-style: italic"> * PURPOSE.  See the GNU General Public License for more details.</span>
+<span style="color: #408080; font-style: italic"> * </span>
+<span style="color: #408080; font-style: italic"> * You should have received a copy of the GNU General Public License</span>
+<span style="color: #408080; font-style: italic"> * along with Jalview.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
+<span style="color: #408080; font-style: italic"> * The Jalview Authors are detailed in the &#39;AUTHORS&#39; file.</span>
+<span style="color: #408080; font-style: italic"> */</span>
+
+<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">jalview.workers.AlignmentAnnotationFactory</span><span style="color: #666666">;</span>
+<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">jalview.workers.FeatureSetCounterI</span><span style="color: #666666">;</span>
+
+<span style="color: #408080; font-style: italic">/*</span>
+<span style="color: #408080; font-style: italic"> * Example script to compute two alignment annotations</span>
+<span style="color: #408080; font-style: italic"> * - count of Phosphorylation features</span>
+<span style="color: #408080; font-style: italic"> * - count of Turn features</span>
+<span style="color: #408080; font-style: italic"> * To try this, first load example file uniref50.fa and load on features file</span>
+<span style="color: #408080; font-style: italic"> * exampleFeatures.txt, before running this script</span>
+<span style="color: #408080; font-style: italic"> *</span>
+<span style="color: #408080; font-style: italic"> * The script only needs to be run once - it will be registered by Jalview</span>
+<span style="color: #408080; font-style: italic"> * and recalculated automatically when the alignment changes.</span>
+<span style="color: #408080; font-style: italic"> * </span>
+<span style="color: #408080; font-style: italic"> * Note: The feature api provided by 2.10.2 is not compatible with scripts</span>
+<span style="color: #408080; font-style: italic"> * that worked with earlier Jalview versions. Apologies for the inconvenience.</span>
+<span style="color: #408080; font-style: italic"> */</span>
+<span style="color: #B00040">def</span> annotator <span style="color: #666666">=</span> 
+    <span style="color: #666666">[</span>
+     <span style="color: #A0A000">getNames:</span> <span style="color: #666666">{</span> <span style="color: #666666">[</span><span style="color: #BA2121">&#39;Phosphorylation&#39;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&#39;Turn&#39;</span><span style="color: #666666">]</span> <span style="color: #008000; font-weight: bold">as</span> String<span style="color: #666666">[]</span> <span style="color: #666666">},</span> 
+     <span style="color: #A0A000">getDescriptions:</span>  <span style="color: #666666">{</span> <span style="color: #666666">[</span><span style="color: #BA2121">&#39;Count of Phosphorylation features&#39;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&#39;Count of Turn features&#39;</span><span style="color: #666666">]</span> <span style="color: #008000; font-weight: bold">as</span> String<span style="color: #666666">[]</span> <span style="color: #666666">},</span>
+     <span style="color: #A0A000">getMinColour:</span> <span style="color: #666666">{</span> <span style="color: #666666">[0,</span> <span style="color: #666666">255,</span> <span style="color: #666666">255]</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #B00040">int</span><span style="color: #666666">[]</span> <span style="color: #666666">},</span> <span style="color: #408080; font-style: italic">// cyan</span>
+     <span style="color: #A0A000">getMaxColour:</span> <span style="color: #666666">{</span> <span style="color: #666666">[0,</span> <span style="color: #666666">0,</span> <span style="color: #666666">255]</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #B00040">int</span><span style="color: #666666">[]</span> <span style="color: #666666">},</span> <span style="color: #408080; font-style: italic">// blue</span>
+     <span style="color: #A0A000">count:</span> 
+         <span style="color: #666666">{</span> res<span style="color: #666666">,</span> feats <span style="color: #666666">-&gt;</span> 
+                <span style="color: #B00040">int</span> phos
+                <span style="color: #B00040">int</span> turn
+                <span style="color: #0000FF">for</span> <span style="color: #666666">(</span>sf <span style="color: #008000; font-weight: bold">in</span> feats<span style="color: #666666">)</span>
+                <span style="color: #666666">{</span>
+                         <span style="color: #408080; font-style: italic">/*</span>
+<span style="color: #408080; font-style: italic">                         * Here we inspect the type of the sequence feature.</span>
+<span style="color: #408080; font-style: italic">                         * You can also test sf.description, sf.score, sf.featureGroup,</span>
+<span style="color: #408080; font-style: italic">                         * sf.strand, sf.phase, sf.begin, sf.end</span>
+<span style="color: #408080; font-style: italic">                         * or sf.getValue(attributeName) for GFF &#39;column 9&#39; properties</span>
+<span style="color: #408080; font-style: italic">                         */</span>
+                          <span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">(</span>sf<span style="color: #666666">.</span><span style="color: #7D9029">type</span><span style="color: #666666">.</span><span style="color: #7D9029">contains</span><span style="color: #666666">(</span><span style="color: #BA2121">&#39;TURN&#39;</span><span style="color: #666666">))</span>
+                   <span style="color: #666666">{</span>
+                      turn<span style="color: #666666">++</span>
+                   <span style="color: #666666">}</span>
+                   <span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">(</span>sf<span style="color: #666666">.</span><span style="color: #7D9029">type</span><span style="color: #666666">.</span><span style="color: #7D9029">contains</span><span style="color: #666666">(</span><span style="color: #BA2121">&#39;PHOSPHORYLATION&#39;</span><span style="color: #666666">))</span>
+                   <span style="color: #666666">{</span>
+                      phos<span style="color: #666666">++</span>
+                   <span style="color: #666666">}</span>
+                <span style="color: #666666">}</span>
+                <span style="color: #666666">[</span>phos<span style="color: #666666">,</span> turn<span style="color: #666666">]</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #B00040">int</span><span style="color: #666666">[]</span>
+         <span style="color: #666666">}</span>
+     <span style="color: #666666">]</span> <span style="color: #008000; font-weight: bold">as</span> FeatureSetCounterI
+    
+<span style="color: #408080; font-style: italic">/*</span>
+<span style="color: #408080; font-style: italic"> * Register the annotation calculator with Jalview</span>
+<span style="color: #408080; font-style: italic"> */</span>
+AlignmentAnnotationFactory<span style="color: #666666">.</span><span style="color: #7D9029">newCalculator</span><span style="color: #666666">(</span>annotator<span style="color: #666666">)</span> 
+</pre></div>
+</body>
+</html>