###################################################################### # # $Id: websFunc.R 261 2007-04-20 16:36:47Z jari $ # # Copyright (C) Authors contributing to this file. # # This file is part of BASE - BioArray Software Environment. # Available at http://base.thep.lu.se/ # # BASE is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # BASE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ###################################################################### ###################################################################### # # These R function are just simple wrappers of the # methods defined in the BaseWebService perl module. # # One can use the below functions pretty much in the # same ways as the perl module object methods. # # See the webs-test.R for an example of how to use # these R functions. ###################################################################### # Function to login login <- function(url, login, passwd) { # obj <- .PerlNew("BaseWebService", "baseUrl", "http://localhost:8080/base2") # obj <- .PerlNew("BaseWebService", "baseUrl", "http://base2.thep.lu.se:8080/demo") obj <- .PerlNew("BaseWebService", "baseUrl", url); obj$login(login, passwd); ret <- obj; ret; } # Logout logout <- function(obj) { obj$logout(); } getProjects <- function(obj) { # Get the projects projs <- obj$getProjects(); # Store in better list ret = list(); for (i in 1:length(projs)) { name <- as.character(projs[[i]]["name"]); desc <- as.character(projs[[i]]["description"]); id <- as.integer(projs[[i]]["id"]); ret[[i]] <- list(name=name, description=desc, id=id); } ret; # Note that the 'ret' is a list of lists. } setActiveProject <- function(obj, id) { obj$setActiveProject(as.integer(id)); } getExperiments <- function(obj) { exps <- obj$getExperiments(); # Store in better list ret = list(); for (i in 1:length(exps)) { name <- as.character(exps[[i]]["name"]); desc <- as.character(exps[[i]]["description"]); id <- as.integer(exps[[i]]["id"]); ret[[i]] <- list(name=name, description=desc, id=id); } ret; # Note that the 'ret' is a list of lists. } getRawBioAssays_by_expID <- function(obj, id) { files <- obj$getRawBioAssays_by_expID(as.integer(id)); # Store in better list ret = list(); for (i in 1:length(files)) { cel <- as.character(files[[i]]["celFile"]); cdf <- as.character(files[[i]]["cdfFile"]); ret[[i]] <- list(celFile=cel, cdfFile=cdf); } ret; # Note that the 'ret' is a list of lists. } downloadRawBioAssays_by_expID <- function(obj, id, path) { obj$downloadRawBioAssays_by_expID(as.integer(id), path); }