●
R Data Import/Export (PDF, approx. 35 pages, 270kB) describes the import and export facilities available either
in R itself or via packages which are available from CRAN.
●
R Installation and Administration (PDF, approx. 30 pages, 200kB).
●
The R Reference Index (PDF, approx. 2200 pages, 12MB) contains all help files of the R standard and
recommended packages in printable form.
Accessing GenePattern from R
The GenePattern R library allows you to invoke a GenePattern task as if it were a local R method running on your
client and to get back from the task a list of result files. The R library is available on your GenePattern server in both
Windows (zip) and Unix (tar.gz) formats.
To download the R library to your computer:
1. Start the GenePattern Web Client.
2. Under Programming Libraries in the right column, click the
zip or tar.gz link for the R library.
3. After downloading the zip file, extract it into your
R/library directory.
If you cannot add files to your
R/library directory (because it is a publicly-shared version and you do not
have appropriate privileges), you can load the GenePattern library by setting the environment variable
R_LIBS=
<GenePattern install directory>/R/library in your autoexec.bat, .cshrc,
.bashrc or other shell startup file. R will then load from its usual location, but will also search for and find the
GenePattern library.
Running a Program
This section explores a simple R program that runs a task, displays the resulting output, and loads it into an R matrix
for further analysis. The included code can be copied and pasted into your R client so that you can try it out, modify it,
and create your own solutions.
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 user name (typically, your e-mail
address). The
gpTasksAsFunctions method creates a function for each GenePattern task on the server, which
invokes the latest version of that task.
# Load GenePattern library
library(GenePattern)
defaultServer <- "cp409-6ac.domain.com:8080"
# The server will want to know whose tasks to provide
# Ask the server to create R methods that proxy
# each of the installed tasks.
gpTasksAsFunctions();
Note: In GenePattern 2.0.2, the R programming environment does not handle HTTP redirects; therefore, you must
set the value of the defaultServer variable to the full host name of your GenePattern server, as shown above. To find
the host name of your GenePattern server, open the GenePattern Web Client and check the URL displayed in the
web browser window.
After initializing the required settings, the application runs the TransposeDataset task to transpose a dataset. This
example references the dataset using a publicly-accessible URL, but a filename would be equally valid. When you
call an R method, such as
TransposeDataset, 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 method in a separate thread.)
# input dataset for transpose operation
input.ds <-
"http://www.broad.mit.edu/mpr/publications/projects/Leukemia/ALL_vs_AML_train_
set_38_sorted.res";
# transpose the dataset
transpose.out <- TransposeDataset(input.filename=input.ds,
output.file.name="transposed");
21
Commenti su questo manuale