From: tcofoegbu
Date: Wed, 14 Jun 2017 12:25:28 +0000 (+0100)
Subject: JAL-2136 New Phyre2 branch + attempt to resynced with develop
X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c51dbe7933683b64548f5353e67561d2b5e377f7;hp=b8cd52fe7bed59130e5b080acfd42c3ef2effdbb;p=jalview.git
JAL-2136 New Phyre2 branch + attempt to resynced with develop
---
diff --git a/.classpath b/.classpath
index 8aef745..c4a2832 100644
--- a/.classpath
+++ b/.classpath
@@ -39,7 +39,7 @@
-
+
diff --git a/RELEASE b/RELEASE
index 9bc5817..6dffc29 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,2 +1,2 @@
-jalview.release=releases/Release_2_10_1_Branch
-jalview.version=2.10.1
+jalview.release=releases/Release_2_10_2_Branch
+jalview.version=2.10.2
diff --git a/examples/groovy/colourConserved.groovy b/examples/groovy/colourConserved.groovy
new file mode 100644
index 0000000..4a15922
--- /dev/null
+++ b/examples/groovy/colourConserved.groovy
@@ -0,0 +1,88 @@
+/*
+ * 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 .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+import java.awt.Color
+import jalview.schemes.ColourSchemeI
+import jalview.schemes.ColourSchemes
+import jalview.datamodel.AnnotatedCollectionI
+import jalview.datamodel.SequenceI
+import jalview.datamodel.SequenceCollectionI
+import jalview.util.Comparison
+
+/*
+ * Closure that defines a colour scheme where fully conserved residues are red,
+ * partly conserved (match consensus but < 100% consensus) are yellow,
+ * unconserved and gaps are white
+ */
+def conserved
+conserved = { ->
+ [
+ /*
+ * name shown in the colour menu
+ */
+ getSchemeName: { -> 'Conserved' },
+
+ /*
+ * to make a new instance for each alignment view
+ */
+ getInstance: { AnnotatedCollectionI coll, Map map -> conserved() },
+
+ /*
+ * method only needed if colour scheme has to recalculate
+ * values when an alignment is modified
+ */
+ alignmentChanged: { AnnotatedCollectionI coll, Map map -> },
+
+ /*
+ * determine colour for a residue at an aligned position of a
+ * sequence, given consensus residue(s) for the column and the
+ * consensus percentage identity score for the column
+ */
+ findColour: { char res, int col, SequenceI seq, String consensus, float pid ->
+ if ('a' <= res && res <= 'z')
+ {
+ res -= ('a' - 'A');
+ }
+ if (Comparison.isGap(res) || !consensus.contains(String.valueOf(res)))
+ {
+ Color.white
+ } else if (pid < 100)
+ {
+ Color.yellow
+ } else
+ {
+ Color.red
+ }
+ },
+
+ /*
+ * true means applicable to nucleotide or peptide data
+ */
+ isApplicableTo: {AnnotatedCollectionI coll -> true},
+
+ /*
+ * simple colour schemes are those that depend on the residue
+ * only (these are also available to colour structure viewers)
+ */
+ isSimple: { false }
+ ] as ColourSchemeI
+}
+
+ColourSchemes.instance.registerColourScheme(conserved())
diff --git a/examples/groovy/colourUnconserved.groovy b/examples/groovy/colourUnconserved.groovy
new file mode 100644
index 0000000..68730f3
--- /dev/null
+++ b/examples/groovy/colourUnconserved.groovy
@@ -0,0 +1,84 @@
+/*
+ * 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 .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+import java.awt.Color
+import jalview.schemes.ColourSchemeI
+import jalview.schemes.ColourSchemes
+import jalview.datamodel.AnnotatedCollectionI
+import jalview.datamodel.SequenceI
+import jalview.datamodel.SequenceCollectionI
+import jalview.util.Comparison
+
+/*
+ * Closure that defines a colour scheme where non-consensus residues are pink,
+ * other residues (and gaps) are white
+ */
+def unconserved
+unconserved = { ->
+ [
+ /*
+ * name shown in the colour menu
+ */
+ getSchemeName: { -> 'Unconserved' },
+
+ /*
+ * to make a new instance for each alignment view
+ */
+ getInstance: { AnnotatedCollectionI coll, Map map -> unconserved() },
+
+ /*
+ * method only needed if colour scheme has to recalculate
+ * values when an alignment is modified
+ */
+ alignmentChanged: { AnnotatedCollectionI coll, Map map -> },
+
+ /*
+ * determine colour for a residue at an aligned position of a
+ * sequence, given consensus residue(s) for the column and the
+ * consensus percentage identity score for the column
+ */
+ findColour: { char res, int col, SequenceI seq, String consensus, float pid ->
+ if ('a' <= res && res <= 'z')
+ {
+ res -= ('a' - 'A');
+ }
+ if (Comparison.isGap(res) || consensus.contains(String.valueOf(res)))
+ {
+ Color.white
+ } else
+ {
+ Color.pink
+ }
+ },
+
+ /*
+ * true means applicable to nucleotide or peptide data
+ */
+ isApplicableTo: {AnnotatedCollectionI coll -> true},
+
+ /*
+ * simple colour schemes are those that depend on the residue
+ * only (these are also available to colour structure viewers)
+ */
+ isSimple: { false }
+ ] as ColourSchemeI
+}
+
+ColourSchemes.instance.registerColourScheme(unconserved())
diff --git a/examples/groovy/featureCounter.groovy b/examples/groovy/featureCounter.groovy
deleted file mode 100644
index 9059dd0..0000000
--- a/examples/groovy/featureCounter.groovy
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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 .
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-
-import jalview.workers.FeatureCounterI;
-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:
- * 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
-
- * To explore further, try changing this script to count other kinds of occurrences of
- * residue and sequence features at columns in an alignment.
- */
-
-/*
- * A closure that returns true for any Charged residue
- */
-def isCharged = { residue ->
- switch(residue) {
- case ['D', 'd', 'E', 'e', 'H', 'h', 'K', 'k', 'R', 'r']:
- return true
- }
- false
-}
-
-/*
- * A closure that returns 1 if sequence features include type 'Pfam', else 0
- * Argument should be a list of SequenceFeature
- */
-def hasPfam = { features ->
- for (sf in features)
- {
- /*
- * 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 ("Pfam".equals(sf.type))
- {
- return true
- }
- }
- false
-}
-
-/*
- * 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
- * - a closure (groovy function) that tests whether to include a residue
- * - a closure that tests whether to increment count based on sequence features
- */
-def getColumnCounter = { name, desc, acceptResidue, acceptFeatures ->
- [
- getName: { name },
- getDescription: { desc },
- getMinColour: { [0, 255, 255] }, // cyan
- getMaxColour: { [0, 0, 255] }, // blue
- count:
- { res, feats ->
- def c = 0
- if (acceptResidue.call(res))
- {
- if (acceptFeatures.call(feats))
- {
- c++
- }
- }
- c
- }
- ] as FeatureCounterI
-}
-
-/*
- * 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 row that counts charged residues with Pfam domain annotation
- */
-def chargedPfamAnnotation = getColumnCounter("Pfam charged", "Count of charged residues with Pfam domain annotation", isCharged, hasPfam)
-
-/*
- * Register the annotations
- */
-AlignmentAnnotationFactory.newCalculator(pfamAnnotation)
-AlignmentAnnotationFactory.newCalculator(chargedPfamAnnotation)
diff --git a/examples/groovy/featuresCounter.groovy b/examples/groovy/featuresCounter.groovy
new file mode 100644
index 0000000..dc4c97c
--- /dev/null
+++ b/examples/groovy/featuresCounter.groovy
@@ -0,0 +1,73 @@
+/*
+ * 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 .
+ * 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)
diff --git a/examples/groovy/multipleFeatureAnnotations.groovy b/examples/groovy/multipleFeatureAnnotations.groovy
deleted file mode 100644
index 592c7f5..0000000
--- a/examples/groovy/multipleFeatureAnnotations.groovy
+++ /dev/null
@@ -1,110 +0,0 @@
-import jalview.workers.AlignmentAnnotationFactory;
-import jalview.workers.AnnotationProviderI;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.Annotation;
-import jalview.util.ColorUtils;
-import jalview.util.Comparison;
-import java.awt.Color;
-
-/*
- * 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.
- */
-
-/*
- * A closure that returns true if value includes "PHOSPHORYLATION"
- */
-def phosCounter = { type -> type.contains("PHOSPHORYLATION") }
-
-/*
- * A closure that returns true if value includes "TURN"
- */
-def turnCounter = { type -> type.contains("TURN") }
-
-/*
- * A closure that computes and returns an array of Annotation values,
- * one for each column of the alignment
- */
-def getAnnotations(al, fr, counter)
-{
- def width = al.width
- def counts = new int[width]
- def max = 0
-
- /*
- * count features in each column, record the maximum value
- */
- for (col = 0 ; col < width ; col++)
- {
- def count = 0
- for (row = 0 ; row < al.height ; row++)
- {
- seq = al.getSequenceAt(row)
- if (seq != null && col < seq.getLength())
- {
- def res = seq.getCharAt(col)
- if (!Comparison.isGap(res))
- {
- pos = seq.findPosition(col)
- features = fr.findFeaturesAtRes(seq, pos)
- for (feature in features)
- {
- if (counter.call(feature.type))
- {
- count++
- }
- }
- }
- }
- }
- counts[col] = count
- if (count > max)
- {
- max = count
- }
- }
-
- /*
- * make the Annotation objects, with a graduated colour scale
- * (from min value to max value) for the histogram bars
- */
- def zero = '0' as char
- def anns = new Annotation[width]
- for (col = 0 ; col < width ; col++)
- {
- def c = counts[col]
- if (c > 0)
- {
- Color color = ColorUtils.getGraduatedColour(c, 0, Color.cyan,
- max, Color.blue)
- anns[col] = AlignmentAnnotationFactory.newAnnotation(String.valueOf(c),
- String.valueOf(c), zero, c, color)
- }
- }
- anns
-}
-
-/*
- * Define the method that performs the calculations, and builds two
- * AlignmentAnnotation objects
- */
-def annotator =
- [ calculateAnnotation: { al, fr ->
- def phosAnns = getAnnotations(al, fr, phosCounter)
- def ann1 = AlignmentAnnotationFactory.newAlignmentAnnotation("Phosphorylation", "Count of Phosphorylation features", phosAnns)
- def turnAnns = getAnnotations(al, fr, turnCounter)
- def ann2 = AlignmentAnnotationFactory.newAlignmentAnnotation("Turn", "Count of Turn features", turnAnns)
- return [ann1, ann2]
- }
- ] as AnnotationProviderI
-
-/*
- * Register the annotation calculator with Jalview
- */
-AlignmentAnnotationFactory.newCalculator(annotator)
diff --git a/examples/groovy/visibleFeaturesCounter.groovy b/examples/groovy/visibleFeaturesCounter.groovy
new file mode 100644
index 0000000..b3180f8
--- /dev/null
+++ b/examples/groovy/visibleFeaturesCounter.groovy
@@ -0,0 +1,89 @@
+/*
+ * 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 .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+import jalview.bin.Jalview
+import jalview.workers.FeatureSetCounterI
+import jalview.workers.AlignmentAnnotationFactory
+
+/*
+ * Demonstration of FeatureSetCounterI
+ * compute annotation tracks counting number of displayed
+ * features of each type in each column
+ */
+
+/*
+ * discover features on the current view
+ */
+
+def featuresDisp=Jalview.currentAlignFrame.currentView.featuresDisplayed
+if (featuresDisp == null) {
+ print 'Need at least one feature visible on alignment'
+}
+def visibleFeatures=featuresDisp.visibleFeatures.toList()
+assert 'java.util.ArrayList' == visibleFeatures.class.name
+
+/*
+ * A closure that returns an array of features present
+ * for each feature type in visibleFeatures
+ * Argument 'features' will be a list of SequenceFeature
+ */
+def getCounts =
+ { features ->
+ int[] obs = new int[visibleFeatures.size]
+ for (sf in features)
+ {
+ /*
+ * 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
+ */
+ int pos = 0
+ for (type in visibleFeatures)
+ {
+ if (type.equals(sf.type))
+ {
+ obs[pos]++
+ }
+ pos++
+ }
+ }
+ obs
+}
+
+/*
+ * Define something that counts each visible feature type
+ */
+def columnSetCounter =
+ [
+ getNames: { visibleFeatures as String[] },
+ getDescriptions: { visibleFeatures as String[] },
+ getMinColour: { [0, 255, 255] as int[] }, // cyan
+ getMaxColour: { [0, 0, 255] as int[] }, // blue
+ count:
+ { res, feats ->
+ getCounts.call(feats)
+ }
+ ] as FeatureSetCounterI
+
+/*
+ * and register the counter
+ */
+AlignmentAnnotationFactory.newCalculator(columnSetCounter)
diff --git a/examples/testdata/example_annot_file.jva b/examples/testdata/example_annot_file.jva
index 794f42b..1779247 100644
--- a/examples/testdata/example_annot_file.jva
+++ b/examples/testdata/example_annot_file.jva
@@ -18,5 +18,5 @@ SEQUENCE_GROUP Group_A 30 50 *
SEQUENCE_GROUP Group_B 1 351 2-5
SEQUENCE_GROUP Group_C 12 14 -1 seq1 seq2 seq3
PROPERTIES Group_A description=This is the description colour=Helix Propensity pidThreshold=0 outlineColour=red displayBoxes=true displayText=false colourText=false textCol1=black textCol2=black textColThreshold=0
-PROPERTIES Group_B outlineColour=red
+PROPERTIES Group_B outlineColour=red colour=None
PROPERTIES Group_C colour=Clustal
diff --git a/help/help.jhm b/help/help.jhm
index 984c2d1..54cce2a 100755
--- a/help/help.jhm
+++ b/help/help.jhm
@@ -22,7 +22,7 @@
-
+
@@ -75,6 +75,7 @@
+
@@ -130,7 +131,8 @@
-
+
+
@@ -158,4 +160,6 @@
+
+
diff --git a/help/helpTOC.xml b/help/helpTOC.xml
index 482ccdf..a8aadf5 100755
--- a/help/helpTOC.xml
+++ b/help/helpTOC.xml
@@ -24,6 +24,11 @@
+
+
+
+
+
@@ -132,7 +137,7 @@
-
+
@@ -157,7 +162,7 @@
-
+
diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html
index 5ae00af..68ac465 100644
--- a/help/html/features/chimera.html
+++ b/help/html/features/chimera.html
@@ -211,10 +211,41 @@
structure in the alignment. The regions used to calculate
the superposition will be highlighted using the 'Cartoon'
rendering style, and the remaining data shown as a chain
- trace.
+ trace.
-
- Help
+ EXPERIMENTAL FEATURES
+
+ These are only available if the Tools→Enable
+ Experimental Features option is enabled. (Since Jalview 2.10.2)
+
+ - Write Jalview features
Selecting
+ this option will create new residue attributes for any
+ features currently visible in the associated alignment
+ views, allowing those positions to be selected and
+ analysed with via Chimera's 'Render by Attribute' tool
+ (found in the Tools submenu called Structure Analysis).
+
If you use this option, please remember to select
+ the Refresh Menus option in Chimera's Render by
+ Attribute dialog box in order to see the attributes
+ derived from Jalview sequence features.
+
+ View
+ this function's issue in Jalview's bug tracker
+ - Fetch Chimera Attributes
This
+ submenu lists available Chimera residue attributes that
+ can be imported as Jalview features on associated
+ sequences.
This is particularly useful for
+ transferring quantitative positional annotation. For
+ example, structure similarity for an alignment can be
+ visualised by transferring the local RMSD attributes
+ generated by Chimera's Match->Align tool onto aligned
+ sequences and displayed with a Graduated feature colour
+ scheme.
+ View
+ this function's issue in Jalview's bug tracker
+
+ Help
- Chimera Help
diff --git a/help/html/features/groovy.html b/help/html/features/groovy.html
index 254f92e..ead4436 100644
--- a/help/html/features/groovy.html
+++ b/help/html/features/groovy.html
@@ -108,9 +108,18 @@ print currentAlFrame.getTitle();
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 featureCounter.groovy
+ href="../groovy/featuresCounter.html">featuresCounter.groovy
example for more information.
+
+ Creating custom colourschemes
+ You can create your own alignment colourschemes with a groovy script. We've provided two examples:
+
+