1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
4 <!-- InstanceBeginEditable name="doctitle" -->
5 <TITLE>JalviewLite Applet API and Form Complete Example</TITLE>
6 <!-- InstanceEndEditable -->
7 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
8 <!-- InstanceBeginEditable name="head" -->
9 <!-- InstanceEndEditable -->
10 <style type="text/css">
13 font-family: Geneva, Arial, Helvetica, sans-serif;
17 font-family: Verdana, Arial, Helvetica, sans-serif;
19 text-decoration: none;
22 background-color:#000000; color: #F2F2FF;
27 <script language="JavaScript">
30 var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
32 {href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }
35 function getEventTarget(e)
45 <body alink="#000000" vlink="#000000" link="#000000">
46 <script type="text/javascript">
47 var gaJsHost = (("https:" == document.location.protocol) ?
48 "https://ssl." : "http://www.");
49 document.write(unescape("%3Cscript src='" + gaJsHost +
50 "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
52 <script type="text/javascript">
54 var pageTracker = _gat._getTracker("UA-9060947-1");
55 pageTracker._trackPageview();
59 <table width="805" height="100" cellpadding="5">
61 <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
64 <table width="805" border="0" cellpadding="5" cellspacing="5">
66 <td width="183" valign="top" bgcolor="#F2F2FF" border="5">
69 <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
71 <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
74 <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
77 <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
80 <td align="left" valign="middle"><a href="applets.html" class="plain">Applet
84 <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
87 <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
90 <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
93 <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release
97 <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source
101 <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
104 <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
107 <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News
108 Mailing List</a></td>
111 <td align="left" valign="middle"><a
112 href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
113 class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
114 bug reports to the discussion list.</em></td>
118 <!--<td align="left" valign="middle"><br>
119 Please send problems<br>and
120 bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
124 <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
125 <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
128 <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
130 Click the Javascript buttons below to interact with the Applet
131 instance on the page.<br>
132 View the source in your browser to see how it has been done.<br>
133 The applet's public API methods are <a href="#api">listed below</a>
134 the following example.<br>
135 <applet code="jalview.bin.JalviewLite" width="140" height="35"
136 archive="jalviewApplet.jar" name="Jalview">
137 <param name="file" value="plantfdx.fa">
138 <param name="features" value="plantfdx.features">
139 <param name="wrap" value="true">
140 <param name="showAnnotation" value="false">
141 <param name="windowHeight" value="500">
142 <param name="windowWidth" value="650">
143 <param name="showFullId" value="false">
144 <param name="RGB" value="F2F2FF">
145 <param name="linkLabel_1" value="SRS">
146 <param name="linkUrl_1"
147 value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
148 <param name="linkLabel_2" value="Uniprot">
149 <param name="linkUrl_2"
150 value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
151 <param name="hidefeaturegroups" value="uniprot" />
152 <param name="showbutton" value="false" />
154 <form name="exampleForm"><br>
156 <center><strong>Using the Jalview Applet for Input
157 to an HTML Form</strong></center>
158 <div align="center"><input type="button"
159 onClick="document.forms.exampleForm.exampleTextarea.value=document.applets.Jalview.getAlignment('fasta', 'false')"
160 value="Fill Form from Jalview" /> <br>
162 <textarea name="exampleTextarea" cols="55" rows="9"></textarea></div>
164 <center><strong>Make a new View and Get and Set
165 Group Display List</strong></center>
166 <form name="groupForm">
167 <div align="center"><input type="button"
168 onClick="document.forms.groupForm.groups.value=document.applets.Jalview.getFeatureGroups()"
169 value="Get groups" /> <input type="button"
170 onClick="document.applets.Jalview.newView()" value="new View" /> <br>
171 <textarea name="groups" cols="55" rows="9"></textarea> <br>
173 onClick="document.applets.Jalview.setFeatureGroupState(document.forms.groupForm.groups.value, true)"
174 value="Display groups" /> <input type="button"
175 onClick="document.applets.Jalview.setFeatureGroupState(document.forms.groupForm.groups.value, false)"
176 value="Hide groups" /></div>
178 <p><a name="api" /> Since Jalview 2.5, the public methods listed
179 below are available to be called via Javascript.</p>
180 <p>Unfortunately Javascript - Java communication is not possible
181 using Internet Explorer or Opera on Macs. Please use Safari or
183 <p>If more than one Jalview window is open, Jalview returns the
184 alignment in the active window, unless you provide an AlignFrame
185 object reference.</p>
186 <p>The alignment output format can be either Fasta, PFAM, Clustal,
187 MSF, PIR, or BLC.</p>
188 <p>When referring to the Jalview applet in javascript, you must
189 either give Jalview a name in the applet tag or use the applets index.</p>
191 <pre>//get list of IDs of selected sequences
192 public String getSelectedSequences()
194 // list of IDs of selected sequences terminated by sep or, if sep is null, '¬' (&#172;)
195 public String getSelectedSequences(sep)
197 // get selected sequences as alignment as format with or without start-end suffix
198 public String getSelectedSequencesAsAlignment(String format, boolean suffix)
200 // get selected sequences as alignment from given view as format with or without start-end suffix
201 public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, boolean suffix)
203 // get alignment as format
204 public String getAlignment(String format)
206 // get alignment as format with jalview
207 // start-end sequence suffix appended
208 public String getAlignment(String format, String suffix)
210 // get alignment displayed in alf as format
211 public String getAlignmentFrom(AlignFrame alf, String format)
213 // get alignment displayed in alf as format
214 // with jalview start-end sequence suffix appended
215 public String getAlignmentFrom(AlignFrame alf, String format, String suffix)
217 // add the given features or annotation to the current alignment
218 public void loadAnnotation(String annotation)
220 // add the given features or annotation to the given alignment view
221 public void loadAnnotationFrom(AlignFrame alf, String annotation)
223 // get the sequence features in the given format (Jalview or GFF)
224 public String getFeatures(String format)
226 // get the sequence features in alf in the given format (Jalview or GFF)
227 public String getFeaturesFrom(AlignFrame alf, String format)
229 // get current alignment's annotation as an annotation file
230 public String getAnnotation()
232 // get alignment view alf's annotation as an annotation file
233 public String getAnnotationFrom(AlignFrame alf)
235 // create a new view and return the alignFrame instance
236 public AlignFrame newView()
238 // create a new view named name and return the alignFrame instance
239 public AlignFrame newView(String name)
241 // create a new view on alf and return the alignFrame instance
242 public AlignFrame newViewFrom(AlignFrame alf)
244 // create a new view named name on alf
245 // and return the alignFrame instance
246 public AlignFrame newViewFrom(AlignFrame alf, String name)
248 // load a new alignment
249 public AlignFrame loadAlignment(String text, String title)
251 // return separator separated list of feature groups
252 // on the current alignment
253 public String getFeatureGroups()
255 // return separator separated list of feature groups on alf
256 public String getFeatureGroupsOn(AlignFrame alf)
258 // return separator separated list of feature groups
259 // either visible or hidden
260 public String getFeatureGroupsOfState(boolean state)
262 // return separator separated list of feature groups
263 // either visible or hidden on alf
264 public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean state)
266 // set the separator separated list of feature groups as
267 // visible or hidden on the current alignment
268 public void setFeatureGroupState(String groupList, boolean state)
270 // set the separator separated list of feature groups
271 // as visible or hidden on alf
272 public void setFeatureGroupStateOn(AlignFrame alf, String groupList, boolean state)
276 // convert list to a separator separated array
277 public String arrayToSeparatorList(String[] list)
279 // get a string array from a list
280 public String[] separatorListToArray(String list)
282 // get the current separator
283 public String getSeparator()
285 // set the current separator
286 public void setSeparator(String)
288 //// JalviewLite global state methods and fields
290 // return the build date as a string
291 public static String getBuildDate()
293 // return the JalviewLite version as a string
294 public static String getVersion()
296 // debug flag - controls output to standard out
297 public static boolean debug
299 </pre> <!-- InstanceEndEditable --></td>
304 <!-- InstanceEnd --></html>