-->
-<div id="view_decorated" name="view_decorated" style="margin:8px; padding:10px; border: 2px solid red; text-align:center; display:none;"><b>Click <a href="index.html#appletDeployment"> here</a> to view decorated page</b></div>
+<div id="view_decorated" name="view_decorated" style="margin:8px; padding:10px; border: 2px solid red; text-align:center; display:none;"><b>Click <a href="index.html#appletDeployment"> here </a> to view decorated page</b></div>
<!-- content start -->
-<h2><a name="appletDeployment"/>Notes on applet deployment</h2>
+<h2 name="appletDeployment"> Notes on applet deployment</h2>
<table width=80% border="1">
<tr><th colspan="2" align="center">Required Dependency Downloads</th></tr>
<tr>
</tr>
</table>
- <ul>
- <li>Package all your data files into a single (or multiple) zip / jar
- files. This is very useful to reduce download time of large data files.
- The applet archive tag can take multiple entries separated by commas,
- eg<br>
- <pre><applet code="jalview.bin.JalviewLite"<em><strong>
- archive="jalviewApplet.jar, mydata.zip"</strong></em>>
- </pre></li>
- <li> Use Jalview for input to a HTML form. For an example of how to
- code this using Javascript, click <a href="javascript:doSubmit('formComplete')">here</a>.
- <br>
- </li>
- <li>Embed Jalview into the web page, without the "Start Jalview"
- button by setting the embed parameter to true;<br>
- <param name="embedded"
- value="true"> </li>
- <li><a href="javascript:doSubmit('appletParameters')">View full list of supported parameters here.</a> </li>
- </ul>
-
- <p><strong>**NEW FEATURES** in Jalview 2.9</strong></p>
+<p>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.
+<pre><code>
+<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>
+</code></pre>
+
+
+
+
+<ul>
+ <li>View full list of <a href="javascript:doSubmit('appletParameters')"> supported applet parameters here.</a></li>
+ <li>Package all your data files into a single (or multiple) zip /
+ jar files. This is very useful to reduce download time of large data
+ files. The applet archive tag can take multiple entries separated by
+ commas, eg<br> <pre><applet code="jalview.bin.JalviewLite"<em><strong> archive="jalviewApplet.jar, mydata.zip"</strong></em>>
+ </pre>
+ </li>
+ <li>Use Jalview for input to a HTML form. For an example of how to
+ code this using Javascript, click <a
+ href="javascript:doSubmit('formComplete')">here</a>. <br>
+ </li>
+ <li>Embed Jalview into the web page, without the "Start
+ Jalview" button by setting the embed parameter to true;<br>
+ <param name="embedded" value="true">
+ </li>
+ <li>For more examples, see the links to the left.</li>
+</ul>
+
+<table border="1" width=80%>
+ <tr><th colspan="2">Applet Release History</th>
+ <tr>
+ <th>Release</th>
+
+ <th>New Features / required changes</th>
+ </tr>
+ <tr>
+ <td><strong>2.9<br>(Latest)</strong></td>
+ <td>
<ul>
<li>Split Views for cDNA and Protein alignments<br/>Specify second alignment with 'file2' parameter, and set cDNA/Protein column scaling with scaleProteinAsCdna
</li>
<pre>archive="jalviewApplet.jar,JmolApplet-14.2.14_2015.06.11.jar,<font color="red">java-json.jar,json_simple-1.1.jar</font>"</pre>
</li>
</ul>
- </p>
- <p><strong>**NEW FEATURES** in Jalview 2.8</strong></p>
- <ul>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>2.8</strong></td>
+ <td><ul>
<li>Normalised sequence logo display
</li>
<li>RNA secondary structure annotation row
original Jalview structure viewer will still be available. <br>
</li>
- </ul>
- <p><strong>**NEW FEATURES** in Jalview 2.7</strong></p>
- <ul>
+ </ul></td>
+ </tr>
+ <tr>
+ <td><strong>2.7</strong></td>
+ <td><ul>
<li>Javascript callbacks capabilities<ul><li>oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.</li>
<li>To use javascript callbacks, ensure the applet tag includes the '<a href="http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html">mayscript</a>' attribute - either as a parameter (<param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).</li></ul>
</li>
the Jmol binary distribution available at the Jmol Sourceforge site,
or <a href="JmolApplet-12.1.13.jar">download the Jmol applet from here</a></li>
<li>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).</li>
- </ul>
- <br><strong>**NEW FEATURES** in Jalview 2.5</strong></p>
- <ul>
- <li>New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</li>
- </ul>
- <br><strong>**NEW FEATURES** in Jalview 2.4</strong></p>
- <ul>
+ </ul></td>
+ </tr>
+ <tr>
+ <td><strong>2.5</strong></td>
+ <td><ul>
+ <li>New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</li> </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>2.4</strong></td>
+ <td><ul>
<li>New applet API methods for feature display control, views, and obtaining current selection via javascript.</li>
<li>Group show and hide parameters:
"showfeaturegroups" and
<li>"debug" parameter to control verbosity of the applet's console output.</li>
<li>"showbutton" parameter to disable launch button and open JalviewLite immediatly.</li>
<li>"nojmol" parameter to disable check for Jmol classes.</li>
- </ul><br>
- <strong>**NEW FEATURES** in Jalview 2.3</strong></p>
- <ul>
+ </ul></td>
+ </tr>
+ <tr>
+ <td><strong>2.3</strong></td>
+ <td><ul>
<li>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
<li>Note parameter "PDBSeq" is no longer required.<br>
</li>
<li>Jalview 2.3 was updated to work with Jmol 11. See the <a href="/development">versions archive if you want to download the old Jmol applet</a>.</li>
- <p> </p>
- </li>
- </ul>
- <strong>**NEW FEATURES** in Jalview 2.1</strong>
- <ul>
+
+ </ul></td>
+ </tr>
+ <tr>
+ <td><strong>2.1</strong></td>
+ <td><ul>
<li>Jalview Applet can read and display JNet secondary structure annotation
directly via the <strong>jnetfile</strong> parameter. <br>
</li>
<param name="sequence2" value="FER1_PEA/14-29 TSFLRTQPMPMSVTTT"><br>
</pre>(All the usual Jalview File formats are valid, however each
new line in an alignment file must be entered as a parameter)</li>
- </ul>
+ </ul></td>
+ </tr>
+</table>
+
+
<!-- content end -->
<!-- boiler plate link to alternate demopage -->
<div style="width: 100%">
-<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
</div>
-</div>
-
<!-- content template start -->
<p align="left">
<h2>JalviewLite Button Examples</h2>
-Try out JalviewLite by pressing one of the buttons below.<br/>
- For more information on how to use the applet in your website, see the <a href="javascript:doSubmit('appletParameters')"><strong>applet parameters</strong></a> and other documentation in the links to the left.</p>
+Try out JalviewLite by pressing one of the buttons below.
+ <a href="view-source:http://www.jalview.org/builds/develop/examples/applets.html" target="_blank">View the source for the examples below here</a> (If the link doesn't work on your browser try going to <a href="http://www.jalview.org/builds/develop/examples/applets.html">this page</a> and viewing the page source manually).<br/>
+ For more information on how to use the applet in your website, see the <a href="javascript:doSubmit('appletDeployment')"><strong>applet deployment,</strong></a> <a href="javascript:doSubmit('appletParameters')"><strong>applet parameters,</strong></a> and other documentation in the links to the left.</p>
<p> </p><div align="center">
<p align="center">
<h2>Ferredoxins, chloroplast precursor related UniRef50
<!-- boiler plate link to alternate demopage -->
<div style="width: 100%">
<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
</div>
</div>
<li><a href="plantfdx.annotations">plantfdx.annotations</a> -
Jalview Alignment Annotations File</li>
</ul>
+ <a href="view-source:http://www.jalview.org/builds/develop/examples/embedded.html" target="_blank">View the source code for this example here</a> (If the link doesn't work on your browser try going to <a href="http://www.jalview.org/builds/develop/examples/embedded.html">this page</a> and viewing the page source manually).<p>
<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">
modeltofiles+="1gaq.txt";
</script>
<div style="width: 100%">
-<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
-</div>
+
</div>
<!-- content template start -->
<!-- boiler plate link to alternate demopage -->
<div style="width: 100%">
<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
+
</div>
</div>
<p>Using the Javascript API to fill out forms using data from JalviewLite
<br/>Click the Javascript buttons below to interact with the Applet
instance on the page.</p>
-View the source in your browser to see how it has been done. <br/>
+ <a href="view-source:http://www.jalview.org/builds/develop/examples/formComplete.html" target="_blank">View the source here to see how it has been done</a> (If the link doesn't work on your browser try going to <a href="http://www.jalview.org/builds/develop/examples/formComplete.html">this page</a> and viewing the page source manually).<br/>
<a name="api">View the full <a href="javascript:doSubmit('jalviewLiteJs')">JalviewLite API documentation</a>.</a>
<applet code="jalview.bin.JalviewLite" width="0" height="0"
archive="jalviewApplet.jar,JmolApplet-14.2.14_2015.06.11.jar,java-json.jar,json_simple-1.1.jar" name="Jalview">
<!-- boiler plate link to alternate demopage -->
<div style="width: 100%">
-<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
-</div>
</div>
<!-- content template start -->
<param name="showbutton" value="false"/>
</applet>
-<h2>Javascript Launch Button</h2><p>The button below demonstrates how JalviewLite can be launched via a javascript action.</p>
+<h2>Javascript Launch Button</h2><p>The button below demonstrates how JalviewLite can be launched via a javascript action. <a href="view-source:http://www.jalview.org/builds/develop/examples/javascriptLaunch.html" target="_blank">View the source here to see how it has been done</a> (If the link doesn't work on your browser try going to <a href="http://www.jalview.org/builds/develop/examples/javascriptLaunch.html">this page</a> and viewing the page source manually). </p>
<input type="button" name="Button1" value="Start"
onClick="startJalview('plantfdx.fa','Button1.alignment','alwvar')"/>
<!-- boiler plate link to alternate demopage -->
<div style="width: 100%">
<div style="width:35%; align:left; float:right;">
-<div style="margin:8px; padding:10px; border: 2px solid black; align: left;">
-<p>Quick Links to jars for example:<br/><a href="jalviewApplet.jar">jalviewApplet.jar</a> and <a href="JmolApplet-14.2.14_2015.06.11.jar">JmolApplet.jar</a>
-</p></div>
+
</div>
</div>
<h2>JalviewLite Linked Applets Demo</h2>
<p>The two applets below use <a href="javascript:doSubmit('jalviewLiteJs')">JalviewLite's javascript API</a> to exchange events about the currently selected region and mouse position in the alignment.
- </p>
+ <a href="view-source:http://www.jalview.org/builds/develop/examples/linkedapplets_ng.html" target="_blank">View the source here to see how it has been done</a> (If the link doesn't work on your browser try going to <a href="http://www.jalview.org/builds/develop/examples/linkedapplets_ng.html">this page</a> and viewing the page source manually).</p>
<applet
Collection<String> types, List<SequenceI> 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;
+ }
}
}
}
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
*/
public String printCSVAnnotations(AlignmentAnnotation[] annotations)
{
+ if (annotations == null)
+ {
+ return "";
+ }
StringBuffer sp = new StringBuffer();
for (int i = 0; i < annotations.length; i++)
{
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
*/
public FeatureColour(FeatureColour fc)
{
+ graduatedColour = fc.graduatedColour;
colour = fc.colour;
minColour = fc.minColour;
maxColour = fc.maxColour;
// 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++)
{
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
import java.awt.event.ActionEvent;
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++));
+ }
}
}
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;
+ }
}
}
}
.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
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);
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());
}
}