X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=help%2Fhtml%2Fgroovy%2FfeaturesCounter.html;fp=help%2Fhtml%2Fgroovy%2FfeaturesCounter.html;h=0000000000000000000000000000000000000000;hb=4f77328104498504339216829abf5ea87e2791ec;hp=3b6705b31b1a9a72628df6e8a556057abd820518;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/help/html/groovy/featuresCounter.html b/help/html/groovy/featuresCounter.html deleted file mode 100644 index 3b6705b..0000000 --- a/help/html/groovy/featuresCounter.html +++ /dev/null @@ -1,123 +0,0 @@ - - -
-
- Extending Jalview with Groovy - A customisable
- feature counter
The groovy script below shows how to
- add a new calculation track to a Jalview alignment window.
-
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.
-To try it for yourself:
-/* - * 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; - -/* - * Example script to compute two alignment annotations - * - count of Phosphorylation features - * - count of Turn features - * To try this, first load example file uniref50.fa and load on features file - * exampleFeatures.txt, before running this script - * - * 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[] }, - getDescriptions: { ['Count of Phosphorylation features', 'Count of Turn features'] as String[] }, - getMinColour: { [0, 255, 255] as int[] }, // cyan - getMaxColour: { [0, 0, 255] as int[] }, // blue - count: - { res, feats -> - int phos - int turn - for (sf in feats) - { - /* - * Here we inspect the type of the sequence feature. - * You can also test sf.description, sf.score, sf.featureGroup, - * sf.strand, sf.phase, sf.begin, sf.end - * or sf.getValue(attributeName) for GFF 'column 9' properties - */ - if (sf.type.contains('TURN')) - { - turn++ - } - if (sf.type.contains('PHOSPHORYLATION')) - { - phos++ - } - } - [phos, turn] as int[] - } - ] as FeatureSetCounterI - -/* - * Register the annotation calculator with Jalview - */ -AlignmentAnnotationFactory.newCalculator(annotator) -