From: Jim Procter Date: Thu, 23 Jun 2016 13:58:42 +0000 (+0100) Subject: Merge branch 'develop' into merge_JAL-2110 X-Git-Tag: Release_2_10_0~140^2~5^2~36 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d2299844ae932a515a5007f30caf766a2c83ad97;hp=629b52f62abbbede793a81b24f07e36b7c6880ab;p=jalview.git Merge branch 'develop' into merge_JAL-2110 --- diff --git a/examples/appletDeployment.html b/examples/appletDeployment.html index 87953df..7fcca00 100644 --- a/examples/appletDeployment.html +++ b/examples/appletDeployment.html @@ -18,10 +18,10 @@ --> - + -

Notes on applet deployment

+

Notes on applet deployment

@@ -46,26 +46,55 @@
Required Dependency Downloads
-
- -

**NEW FEATURES** in Jalview 2.9

+

To run Jalview applet in your web page download the Jars listed above. The snippet below shows a minimal code for embedding Jalview applet into a web page. +


+<applet code="jalview.bin.JalviewLite" width="756" height="560" archive="jalviewApplet.jar,JmolApplet-14.2.14_2015.06.11.jar,java-json.jar,json_simple-1.1.jar">
+	<param name="permissions" value="sandbox" />
+	<param name="file" value="plantfdx.fa" />
+	<param name="features" value="plantfdx.features" />
+	<param name="userDefinedColour" value="C=yellow; R,K,H=FF5555; D,E=5555FF" />
+	<param name="showFullId" value="false" />
+	<param name="embedded" value="true" />
+	<param name="linkLabel_1" value="Uniprot" />
+	<param name="linkUrl_1"	value="http://www.uniprot.org/uniprot/$SEQUENCE_ID$" />
+	<param name="linkLabel_2" value="EMBL-EBI Search" />
+	<param name="linkUrl_2"	value="http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$" />
+	<param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp" />
+</applet>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Applet Release History
ReleaseNew Features / required changes
2.9
(Latest)
  • Split Views for cDNA and Protein alignments
    Specify second alignment with 'file2' parameter, and set cDNA/Protein column scaling with scaleProteinAsCdna
  • @@ -78,9 +107,11 @@
    archive="jalviewApplet.jar,JmolApplet-14.2.14_2015.06.11.jar,java-json.jar,json_simple-1.1.jar"
-

-

**NEW FEATURES** in Jalview 2.8

-
    +
2.8
  • Normalised sequence logo display
  • RNA secondary structure annotation row @@ -95,9 +126,11 @@ original Jalview structure viewer will still be available.
  • -
-

**NEW FEATURES** in Jalview 2.7

-
    +
2.7
  • Javascript callbacks capabilities
    • oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.
    • To use javascript callbacks, ensure the applet tag includes the 'mayscript' attribute - either as a parameter (<param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).
  • @@ -110,13 +143,17 @@ the Jmol binary distribution available at the Jmol Sourceforge site, or download the Jmol applet from here
  • Minimum recommended version of Java runtime for the applet is now 1.5 (JalviewLite v2.6 without the Jmol viewer may work ok on earlier Java environments but compatibility can no-longer be guaranteed).
  • -
-
**NEW FEATURES** in Jalview 2.5

-
    -
  • New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.
  • -
-
**NEW FEATURES** in Jalview 2.4

-
    +
2.5
    +
  • New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.
+
2.4
  • New applet API methods for feature display control, views, and obtaining current selection via javascript.
  • Group show and hide parameters: "showfeaturegroups" and @@ -128,9 +165,11 @@
  • "debug" parameter to control verbosity of the applet's console output.
  • "showbutton" parameter to disable launch button and open JalviewLite immediatly.
  • "nojmol" parameter to disable check for Jmol classes.
  • -

- **NEW FEATURES** in Jalview 2.3

-
    +
2.3
  • Note that Parameter "PDBFile" now takes the PDB file followed by a space separated list of alignment sequence ids to associate the structure to. It is also possible to associate @@ -150,11 +189,12 @@
  • Note parameter "PDBSeq" is no longer required.
  • Jalview 2.3 was updated to work with Jmol 11. See the versions archive if you want to download the old Jmol applet.
  • -

     

    - -
- **NEW FEATURES** in Jalview 2.1 -
    + +
2.1
  • Jalview Applet can read and display JNet secondary structure annotation directly via the jnetfile parameter.
  • @@ -182,5 +222,9 @@ <param name="sequence2" value="FER1_PEA/14-29 TSFLRTQPMPMSVTTT">
    (All the usual Jalview File formats are valid, however each new line in an alignment file must be entered as a parameter) -
+
+ + diff --git a/examples/applets.html b/examples/applets.html index 34118b8..1f65565 100644 --- a/examples/applets.html +++ b/examples/applets.html @@ -22,19 +22,14 @@
-
-
-

Quick Links to jars for example:
jalviewApplet.jar and JmolApplet.jar -

-
-

JalviewLite Button Examples

-Try out JalviewLite by pressing one of the buttons below.
- For more information on how to use the applet in your website, see the applet parameters and other documentation in the links to the left.

+Try out JalviewLite by pressing one of the buttons below. + View the source for the examples below here (If the link doesn't work on your browser try going to this page and viewing the page source manually).
+ For more information on how to use the applet in your website, see the applet deployment, applet parameters, and other documentation in the links to the left.

 

Ferredoxins, chloroplast precursor related UniRef50 diff --git a/examples/embedded.html b/examples/embedded.html index aa67325..0d5ddf3 100644 --- a/examples/embedded.html +++ b/examples/embedded.html @@ -23,9 +23,6 @@
-
-

Quick Links to jars for example:
jalviewApplet.jar and JmolApplet.jar -

@@ -40,6 +37,7 @@
  • plantfdx.annotations - Jalview Alignment Annotations File
  • + View the source code for this example here (If the link doesn't work on your browser try going to this page and viewing the page source manually).

    diff --git a/examples/embeddedWJmol.html b/examples/embeddedWJmol.html index f629312..1ecff58 100644 --- a/examples/embeddedWJmol.html +++ b/examples/embeddedWJmol.html @@ -260,11 +260,7 @@ jmolInitialize("","JmolApplet-14.2.14_2015.06.11.jar"); modeltofiles+="1gaq.txt";
    -
    -
    -

    Quick Links to jars for example:
    jalviewApplet.jar and JmolApplet.jar -

    -
    +
    diff --git a/examples/formComplete.html b/examples/formComplete.html index 91d94f8..9e89990 100644 --- a/examples/formComplete.html +++ b/examples/formComplete.html @@ -24,9 +24,7 @@
    -
    -

    Quick Links to jars for example:
    jalviewApplet.jar and JmolApplet.jar -

    +
    @@ -35,7 +33,7 @@

    Using the Javascript API to fill out forms using data from JalviewLite
    Click the Javascript buttons below to interact with the Applet instance on the page.

    -View the source in your browser to see how it has been done.
    + View the source here to see how it has been done (If the link doesn't work on your browser try going to this page and viewing the page source manually).
    View the full JalviewLite API documentation. diff --git a/examples/javascriptLaunch.html b/examples/javascriptLaunch.html index e161ad6..35b1d81 100644 --- a/examples/javascriptLaunch.html +++ b/examples/javascriptLaunch.html @@ -21,12 +21,7 @@
    -
    -
    -

    Quick Links to jars for example:
    jalviewApplet.jar and JmolApplet.jar -

    -
    @@ -120,7 +115,7 @@ archive="jalviewApplet.jar,JmolApplet-14.2.14_2015.06.11.jar,java-json.jar,json_
    -

    Javascript Launch Button

    The button below demonstrates how JalviewLite can be launched via a javascript action.

    +

    Javascript Launch Button

    The button below demonstrates how JalviewLite can be launched via a javascript action. View the source here to see how it has been done (If the link doesn't work on your browser try going to this page and viewing the page source manually).

    diff --git a/examples/linkedapplets_ng.html b/examples/linkedapplets_ng.html index 0449c0b..5890515 100644 --- a/examples/linkedapplets_ng.html +++ b/examples/linkedapplets_ng.html @@ -22,9 +22,7 @@
    -
    -

    Quick Links to jars for example:
    jalviewApplet.jar and JmolApplet.jar -

    +
    @@ -36,7 +34,7 @@

    JalviewLite Linked Applets Demo

    The two applets below use JalviewLite's javascript API to exchange events about the currently selected region and mouse position in the alignment. -

    + View the source here to see how it has been done (If the link doesn't work on your browser try going to this page and viewing the page source manually).

    types, List forSequences, boolean anyType, boolean doShow) { - for (AlignmentAnnotation aa : al.getAlignmentAnnotation()) + AlignmentAnnotation[] anns = al.getAlignmentAnnotation(); + if (anns != null) { - if (anyType || types.contains(aa.label)) + for (AlignmentAnnotation aa : anns) { - if ((aa.sequenceRef != null) - && (forSequences == null || forSequences - .contains(aa.sequenceRef))) + if (anyType || types.contains(aa.label)) { - aa.visible = doShow; + if ((aa.sequenceRef != null) + && (forSequences == null || forSequences + .contains(aa.sequenceRef))) + { + aa.visible = doShow; + } } } } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c5fb11f..54b1cb6 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -5950,8 +5950,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void setAnnotationsVisibility(boolean visible, boolean forSequences, boolean forAlignment) { - for (AlignmentAnnotation aa : alignPanel.getAlignment() - .getAlignmentAnnotation()) + AlignmentAnnotation[] anns = alignPanel.getAlignment() + .getAlignmentAnnotation(); + if (anns == null) + { + return; + } + for (AlignmentAnnotation aa : anns) { /* * don't display non-positional annotations on an alignment diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 8b3aa98..d738882 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1760,6 +1760,10 @@ public class AnnotationFile */ public String printCSVAnnotations(AlignmentAnnotation[] annotations) { + if (annotations == null) + { + return ""; + } StringBuffer sp = new StringBuffer(); for (int i = 0; i < annotations.length; i++) { diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index 36980f8..3cda444 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -744,11 +744,14 @@ public class JSONFile extends AlignFile implements ComplexAlignFile fr = avpanel.cloneFeatureRenderer(); // Add non auto calculated annotation to AlignFile - for (AlignmentAnnotation annot : annots) + if (annots != null) { - if (annot != null && !annot.autoCalculated) + for (AlignmentAnnotation annot : annots) { - annotations.add(annot); + if (annot != null && !annot.autoCalculated) + { + annotations.add(annot); + } } } globalColourScheme = ColourSchemeProperty.getColourName(viewport diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 213868b..bdc70c9 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -317,6 +317,7 @@ public class FeatureColour implements FeatureColourI */ public FeatureColour(FeatureColour fc) { + graduatedColour = fc.graduatedColour; colour = fc.colour; minColour = fc.minColour; maxColour = fc.maxColour; diff --git a/src/jalview/schemes/RNAHelicesColour.java b/src/jalview/schemes/RNAHelicesColour.java index d17f510..9729a83 100644 --- a/src/jalview/schemes/RNAHelicesColour.java +++ b/src/jalview/schemes/RNAHelicesColour.java @@ -91,6 +91,10 @@ public class RNAHelicesColour extends ResidueColourScheme // This loop will find the first rna structure annotation by which to colour // the sequences. AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation(); + if (annotations == null) + { + return; + } for (int i = 0; i < annotations.length; i++) { diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java index 1a13bbe..b1b3c5a 100644 --- a/src/jalview/schemes/RNAHelicesColourChooser.java +++ b/src/jalview/schemes/RNAHelicesColourChooser.java @@ -22,6 +22,7 @@ package jalview.schemes; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceGroup; import java.awt.event.ActionEvent; @@ -77,16 +78,20 @@ public class RNAHelicesColourChooser adjusting = true; Vector list = new Vector(); int index = 1; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); + if (anns != null) { - String label = av.getAlignment().getAlignmentAnnotation()[i].label; - if (!list.contains(label)) + for (int i = 0; i < anns.length; i++) { - list.addElement(label); - } - else - { - list.addElement(label + "_" + (index++)); + String label = anns[i].label; + if (!list.contains(label)) + { + list.addElement(label); + } + else + { + list.addElement(label + "_" + (index++)); + } } } diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 0f6d66b..91ee3c1 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -1420,11 +1420,15 @@ public abstract class AlignmentViewport implements AlignViewportI, protected void setSequenceAnnotationsVisible(SequenceI sequenceI, boolean visible) { - for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation()) + AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation(); + if (anns != null) { - if (ann.sequenceRef == sequenceI) + for (AlignmentAnnotation ann : anns) { - ann.visible = visible; + if (ann.sequenceRef == sequenceI) + { + ann.visible = visible; + } } } } diff --git a/src/jalview/workers/StrucConsensusThread.java b/src/jalview/workers/StrucConsensusThread.java index 3483dac..4249112 100644 --- a/src/jalview/workers/StrucConsensusThread.java +++ b/src/jalview/workers/StrucConsensusThread.java @@ -94,12 +94,15 @@ public class StrucConsensusThread extends AlignCalcWorker .getAlignmentAnnotation(); AlignmentAnnotation rnaStruc = null; // select rna struct to use for calculation - for (int i = 0; i < aa.length; i++) + if (aa != null) { - if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc()) + for (int i = 0; i < aa.length; i++) { - rnaStruc = aa[i]; - break; + if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc()) + { + rnaStruc = aa[i]; + break; + } } } // check to see if its valid diff --git a/test/jalview/schemes/FeatureColourTest.java b/test/jalview/schemes/FeatureColourTest.java index 9b1bd73..e13f542 100644 --- a/test/jalview/schemes/FeatureColourTest.java +++ b/test/jalview/schemes/FeatureColourTest.java @@ -15,6 +15,44 @@ import org.testng.annotations.Test; public class FeatureColourTest { @Test(groups = { "Functional" }) + public void testCopyConstructor() + { + /* + * plain colour + */ + FeatureColour fc = new FeatureColour(Color.RED); + FeatureColour fc1 = new FeatureColour(fc); + assertTrue(fc1.getColour().equals(Color.RED)); + assertFalse(fc1.isGraduatedColour()); + assertFalse(fc1.isColourByLabel()); + + /* + * min-max colour + */ + fc = new FeatureColour(Color.gray, Color.black, 10f, 20f); + fc.setAboveThreshold(true); + fc.setThreshold(12f); + fc1 = new FeatureColour(fc); + assertTrue(fc1.isGraduatedColour()); + assertFalse(fc1.isColourByLabel()); + assertTrue(fc1.isAboveThreshold()); + assertEquals(12f, fc1.getThreshold()); + assertEquals(Color.gray, fc1.getMinColour()); + assertEquals(Color.black, fc1.getMaxColour()); + assertEquals(10f, fc1.getMin()); + assertEquals(20f, fc1.getMax()); + + /* + * colour by label + */ + fc = new FeatureColour(); + fc.setColourByLabel(true); + fc1 = new FeatureColour(fc); + assertTrue(fc1.isColourByLabel()); + assertFalse(fc1.isGraduatedColour()); + } + + @Test(groups = { "Functional" }) public void testIsColored_simpleColour() { FeatureColour fc = new FeatureColour(Color.RED); @@ -297,5 +335,10 @@ public class FeatureColourTest assertEquals(Color.GREEN, fc.getMaxColour()); assertEquals(10f, fc.getMin()); assertEquals(20f, fc.getMax()); + + descriptor = String + .format("blue|255,0,255|absolute|20.0|95.0|below|66.0"); + fc = FeatureColour.parseJalviewFeatureColour(descriptor); + assertTrue(fc.isGraduatedColour()); } }