257 |
20 Apr 07 |
mattias |
1 |
###################################################################### |
259 |
20 Apr 07 |
jari |
2 |
# |
259 |
20 Apr 07 |
jari |
# $Id$ |
259 |
20 Apr 07 |
jari |
4 |
# |
257 |
20 Apr 07 |
mattias |
# Copyright (C) Authors contributing to this file. |
257 |
20 Apr 07 |
mattias |
6 |
# |
257 |
20 Apr 07 |
mattias |
# This file is part of BASE - BioArray Software Environment. |
257 |
20 Apr 07 |
mattias |
# Available at http://base.thep.lu.se/ |
257 |
20 Apr 07 |
mattias |
9 |
# |
257 |
20 Apr 07 |
mattias |
# BASE is free software; you can redistribute it and/or |
257 |
20 Apr 07 |
mattias |
# modify it under the terms of the GNU General Public License |
257 |
20 Apr 07 |
mattias |
# as published by the Free Software Foundation; either version 2 |
257 |
20 Apr 07 |
mattias |
# of the License, or (at your option) any later version. |
257 |
20 Apr 07 |
mattias |
14 |
# |
257 |
20 Apr 07 |
mattias |
# BASE is distributed in the hope that it will be useful, |
257 |
20 Apr 07 |
mattias |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
257 |
20 Apr 07 |
mattias |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
257 |
20 Apr 07 |
mattias |
# GNU General Public License for more details. |
257 |
20 Apr 07 |
mattias |
19 |
# |
257 |
20 Apr 07 |
mattias |
# You should have received a copy of the GNU General Public License |
257 |
20 Apr 07 |
mattias |
# along with this program; if not, write to the Free Software |
257 |
20 Apr 07 |
mattias |
# Foundation, Inc., 59 Temple Place - Suite 330, |
257 |
20 Apr 07 |
mattias |
# Boston, MA 02111-1307, USA. |
257 |
20 Apr 07 |
mattias |
24 |
###################################################################### |
257 |
20 Apr 07 |
mattias |
25 |
|
257 |
20 Apr 07 |
mattias |
26 |
###################################################################### |
257 |
20 Apr 07 |
mattias |
27 |
# |
257 |
20 Apr 07 |
mattias |
# These R function are just simple wrappers of the |
257 |
20 Apr 07 |
mattias |
# methods defined in the BaseWebService perl module. |
257 |
20 Apr 07 |
mattias |
30 |
# |
257 |
20 Apr 07 |
mattias |
# One can use the below functions pretty much in the |
257 |
20 Apr 07 |
mattias |
# same ways as the perl module object methods. |
257 |
20 Apr 07 |
mattias |
33 |
# |
257 |
20 Apr 07 |
mattias |
# See the webs-test.R for an example of how to use |
257 |
20 Apr 07 |
mattias |
# these R functions. |
257 |
20 Apr 07 |
mattias |
36 |
###################################################################### |
257 |
20 Apr 07 |
mattias |
37 |
|
257 |
20 Apr 07 |
mattias |
# Function to login |
257 |
20 Apr 07 |
mattias |
login <- function(url, login, passwd) |
257 |
20 Apr 07 |
mattias |
40 |
{ |
257 |
20 Apr 07 |
mattias |
# obj <- .PerlNew("BaseWebService", "baseUrl", "http://localhost:8080/base2") |
261 |
20 Apr 07 |
jari |
# obj <- .PerlNew("BaseWebService", "baseUrl", "http://base2.thep.lu.se:8080/demo") |
257 |
20 Apr 07 |
mattias |
obj <- .PerlNew("BaseWebService", "baseUrl", url); |
257 |
20 Apr 07 |
mattias |
obj$login(login, passwd); |
257 |
20 Apr 07 |
mattias |
ret <- obj; |
257 |
20 Apr 07 |
mattias |
ret; |
257 |
20 Apr 07 |
mattias |
47 |
} |
257 |
20 Apr 07 |
mattias |
48 |
|
257 |
20 Apr 07 |
mattias |
# Logout |
257 |
20 Apr 07 |
mattias |
logout <- function(obj) |
257 |
20 Apr 07 |
mattias |
51 |
{ |
257 |
20 Apr 07 |
mattias |
obj$logout(); |
257 |
20 Apr 07 |
mattias |
53 |
} |
257 |
20 Apr 07 |
mattias |
54 |
|
257 |
20 Apr 07 |
mattias |
55 |
|
257 |
20 Apr 07 |
mattias |
getProjects <- function(obj) |
257 |
20 Apr 07 |
mattias |
57 |
{ |
257 |
20 Apr 07 |
mattias |
# Get the projects |
257 |
20 Apr 07 |
mattias |
projs <- obj$getProjects(); |
257 |
20 Apr 07 |
mattias |
60 |
|
257 |
20 Apr 07 |
mattias |
# Store in better list |
257 |
20 Apr 07 |
mattias |
ret = list(); |
257 |
20 Apr 07 |
mattias |
for (i in 1:length(projs)) { |
257 |
20 Apr 07 |
mattias |
name <- as.character(projs[[i]]["name"]); |
257 |
20 Apr 07 |
mattias |
desc <- as.character(projs[[i]]["description"]); |
257 |
20 Apr 07 |
mattias |
id <- as.integer(projs[[i]]["id"]); |
257 |
20 Apr 07 |
mattias |
ret[[i]] <- list(name=name, description=desc, id=id); |
257 |
20 Apr 07 |
mattias |
68 |
} |
257 |
20 Apr 07 |
mattias |
69 |
|
257 |
20 Apr 07 |
mattias |
ret; |
257 |
20 Apr 07 |
mattias |
# Note that the 'ret' is a list of lists. |
257 |
20 Apr 07 |
mattias |
72 |
} |
257 |
20 Apr 07 |
mattias |
73 |
|
257 |
20 Apr 07 |
mattias |
74 |
|
257 |
20 Apr 07 |
mattias |
setActiveProject <- function(obj, id) |
257 |
20 Apr 07 |
mattias |
76 |
{ |
257 |
20 Apr 07 |
mattias |
obj$setActiveProject(as.integer(id)); |
257 |
20 Apr 07 |
mattias |
78 |
} |
257 |
20 Apr 07 |
mattias |
79 |
|
257 |
20 Apr 07 |
mattias |
80 |
|
257 |
20 Apr 07 |
mattias |
getExperiments <- function(obj) |
257 |
20 Apr 07 |
mattias |
82 |
{ |
257 |
20 Apr 07 |
mattias |
exps <- obj$getExperiments(); |
257 |
20 Apr 07 |
mattias |
84 |
|
257 |
20 Apr 07 |
mattias |
# Store in better list |
257 |
20 Apr 07 |
mattias |
ret = list(); |
257 |
20 Apr 07 |
mattias |
for (i in 1:length(exps)) { |
257 |
20 Apr 07 |
mattias |
name <- as.character(exps[[i]]["name"]); |
257 |
20 Apr 07 |
mattias |
desc <- as.character(exps[[i]]["description"]); |
257 |
20 Apr 07 |
mattias |
id <- as.integer(exps[[i]]["id"]); |
257 |
20 Apr 07 |
mattias |
ret[[i]] <- list(name=name, description=desc, id=id); |
257 |
20 Apr 07 |
mattias |
92 |
} |
257 |
20 Apr 07 |
mattias |
93 |
|
257 |
20 Apr 07 |
mattias |
ret; |
257 |
20 Apr 07 |
mattias |
# Note that the 'ret' is a list of lists. |
257 |
20 Apr 07 |
mattias |
96 |
} |
257 |
20 Apr 07 |
mattias |
97 |
|
257 |
20 Apr 07 |
mattias |
98 |
|
257 |
20 Apr 07 |
mattias |
getRawBioAssays_by_expID <- function(obj, id) |
257 |
20 Apr 07 |
mattias |
100 |
{ |
257 |
20 Apr 07 |
mattias |
files <- obj$getRawBioAssays_by_expID(as.integer(id)); |
257 |
20 Apr 07 |
mattias |
102 |
|
257 |
20 Apr 07 |
mattias |
# Store in better list |
257 |
20 Apr 07 |
mattias |
ret = list(); |
257 |
20 Apr 07 |
mattias |
for (i in 1:length(files)) { |
257 |
20 Apr 07 |
mattias |
cel <- as.character(files[[i]]["celFile"]); |
257 |
20 Apr 07 |
mattias |
cdf <- as.character(files[[i]]["cdfFile"]); |
257 |
20 Apr 07 |
mattias |
ret[[i]] <- list(celFile=cel, cdfFile=cdf); |
257 |
20 Apr 07 |
mattias |
109 |
} |
257 |
20 Apr 07 |
mattias |
110 |
|
257 |
20 Apr 07 |
mattias |
ret; |
257 |
20 Apr 07 |
mattias |
# Note that the 'ret' is a list of lists. |
257 |
20 Apr 07 |
mattias |
113 |
} |
257 |
20 Apr 07 |
mattias |
114 |
|
257 |
20 Apr 07 |
mattias |
115 |
|
257 |
20 Apr 07 |
mattias |
downloadRawBioAssays_by_expID <- function(obj, id, path) |
257 |
20 Apr 07 |
mattias |
117 |
{ |
257 |
20 Apr 07 |
mattias |
obj$downloadRawBioAssays_by_expID(as.integer(id), path); |
257 |
20 Apr 07 |
mattias |
119 |
|
257 |
20 Apr 07 |
mattias |
120 |
} |