MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE Manual do Utilizador Página 17: Running a Program

GenePattern Java Library

The GenePattern Java library allows you to invoke a GenePattern task as if it were a local Java method running on
your client and to get back from the task a list of result files. A zip file containing the Java library (and Javadoc that
describes the API for accessing the server and running tasks) is available on your GenePattern server.
To download the GenePattern Java library to your computer:
1.
Start the GenePattern Web Client.
2.
Under Programming Libraries in the right column, click the
zip
link for the Java library.
3.
After downloading the zip file, unzip it into the directory where you will be doing your Java development.

Running a Program

This section explores a simple Java application that preprocesses a dataset and displays it using the
HeatMapViewer. The included code can be copied and pasted into your Java program so that you can try it out,
modify it, and create your own solutions. The full source code of the sample application is available
here
.
The first statements in the application initialize various settings, which you must do once in every application that
accesses GenePattern. You will need to customize the
italicized
GenePattern server URL and GenePattern user
name (typically, your e-mail address) with values appropriate for your GenePattern server.
import
org.genepattern.data.expr.ExpressionData;
import
org.genepattern.client.GPServer;
import
org.genepattern.webservice.JobResult;
import
org.genepattern.webservice.Parameter;
import
org.genepattern.io.IOUtil;
import
java.io.File;
public
class
MyProgram
{
public static
void
main
(String[] args)
throws
Exception
{
GPServer gpServer
=
new
GPServer
(
"
http://localhost:8080
"
,
"
your email address"
);
After initializing the required settings, the application runs the PreprocessDataset task to preprocess a dataset. This
example references the dataset using a publicly-accessible URL, but a filename would be equally valid. When you
invoke the
runAnalysis
method, the GenePattern library invokes the appropriate task on the server, passing all of
the input parameters and input files. Control returns to your application when the task completes. (To run a task
asynchronously, invoke the
runAnalysis
method in a separate thread.)
String inputDataset
=
"ftp://ftp.broad.mit.edu/pub/genepattern/all_aml/all_aml_train.res"
;
JobResult preprocess
=
gpServer.
runAnalysis
(
"PreprocessDataset"
,
new
Parameter[]
{
new
Parameter
(
"input.filename"
, inputDataset)
}
);
When the task completes, you can query the
JobResult
object for an array of filenames that are the output from
the task. You can download the result files or leave them on the server and refer to them by URL. Referring to result
files by URL is especially useful for intermediate results. In this example, the
JobResult
object named
preprocess
contains a list of filenames (of length 1, in this case), which the application displays in a heat map:
// view results in a HeatMapViewer visualizer
17
gpServer.
runVisualizer
(
"HeatMapViewer"
,

Ficheiro PDF · ·

Imprimir

Imprimir documento

Partilha

Perguntas sobre MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE

Ainda não há perguntas sobre este manual. Faça a primeira.

Fazer uma pergunta

Respondemos a partir do manual e indicamos a página. A pergunta é publicada no site depois de verificada.

Todas as perguntas e respostas ›

Manuais e produtos relacionados com Software MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE