2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
22 import jalview.workers.AlignmentAnnotationFactory;
23 import jalview.workers.FeatureSetCounterI;
26 * Example script to compute two alignment annotations
27 * - count of Phosphorylation features
28 * - count of Turn features
29 * To try this, first load example file uniref50.fa and load on features file
30 * exampleFeatures.txt, before running this script
32 * The script only needs to be run once - it will be registered by Jalview
33 * and recalculated automatically when the alignment changes.
35 * Note: The feature api provided by 2.10.2 is not compatible with scripts
36 * that worked with earlier Jalview versions. Apologies for the inconvenience.
41 getNames: { ['Phosphorylation', 'Turn'] as String[] },
42 getDescriptions: { ['Count of Phosphorylation features', 'Count of Turn features'] as String[] },
43 getMinColour: { [0, 255, 255] as int[] }, // cyan
44 getMaxColour: { [0, 0, 255] as int[] }, // blue
52 * Here we inspect the type of the sequence feature.
53 * You can also test sf.description, sf.score, sf.featureGroup,
54 * sf.strand, sf.phase, sf.begin, sf.end
55 * or sf.getValue(attributeName) for GFF 'column 9' properties
57 if (sf.type.contains('TURN'))
61 if (sf.type.contains('PHOSPHORYLATION'))
68 ] as FeatureSetCounterI
71 * Register the annotation calculator with Jalview
73 AlignmentAnnotationFactory.newCalculator(annotator)