Merge branch 'develop' into features/JAL-2094_colourInterface
[jalview.git] / examples / groovy / featureCounter.groovy
index 42d3187..a16d8bb 100644 (file)
@@ -5,11 +5,15 @@ import jalview.workers.AlignmentAnnotationFactory;
  * Example script that registers two alignment annotation calculators
  * - one that counts residues in a column with Pfam annotation
  * - one that counts only charged residues with Pfam annotation
- * To try this, first load uniref50.fa from the examples folder, then load features
- * from examples/exampleFeatures.txt, before running this script from the Groovy console.
+ *
+ * To try:
+ * 1. load uniref50.fa from the examples folder
+ * 2. load features onto it from from examples/exampleFeatures.txt
+ * 3. Open this script in the Groovy console.
+ * 4. Either execute this script from the console, or via Calculate->Run Groovy Script
  
- * Modify this example as required to count by column any desired value that can be 
- * derived from the residue and sequence features at each position of an alignment.
+ * To explore further, try changing this script to count other kinds of occurrences of 
+ * residue and sequence features at columns in an alignment.
  */
 
 /*
@@ -45,7 +49,8 @@ def hasPfam = { features ->
 }
 
 /*
- * Closure that counts residues with a Pfam feature annotation
+ * Closure that computes an annotation based on 
+ * presence of particular residues and features
  * Parameters are
  * - the name (label) for the alignment annotation
  * - the description (tooltip) for the annotation
@@ -74,12 +79,12 @@ def getColumnCounter = { name, desc, acceptResidue, acceptFeatures ->
 }
 
 /*
- * Define an annotation that counts any residue with Pfam domain annotation
+ * Define an annotation row that counts any residue with Pfam domain annotation
  */
 def pfamAnnotation = getColumnCounter("Pfam", "Count of residues with Pfam domain annotation", {true}, hasPfam)
 
 /*
- * Define an annotation that counts charged residues with Pfam domain annotation
+ * Define an annotation row that counts charged residues with Pfam domain annotation
  */
 def chargedPfamAnnotation = getColumnCounter("Pfam charged", "Count of charged residues with Pfam domain annotation", isCharged, hasPfam)