Browse code

Added the GSVA package to the repository

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/GSVA@54777 bc3139a8-67e5-0310-9ffc-ced21a209358

Chao-Jen Wong authored on 13/04/2011 04:33:14
Showing 23 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+Package: GSVA
2
+Version: 0.99.3
3
+Date: 2011-04-12
4
+Title: Gene Set Variation Analysis
5
+Author: Justin Guinney <justin.guinney@sagebase.org> (with contributions from Robert Castelo <robert.castelo@upf.edu> and Sonja Haenzelmann <shanzelmann@imim.es)
6
+Maintainer: Justin Guinney <justin.guinney@sagebase.org>
7
+Depends: R (>= 2.13.0), methods
8
+Imports: methods, Biobase, GSEABase
9
+Enhances: snow, multicore
10
+Suggests: limma, qpgraph, graph, Rgraphviz, RColorBrewer, genefilter, GSVAdata
11
+SystemRequirements: GNU Scientific Library >= 1.12
12
+Description: Gene Set Variation Analysis (GSVA) is a non-parametric, unsupervised method for estimating variation of gene set enrichment through the samples of a expression data set. GSVA performs a change in coordinate systems, transforming the data from a gene by sample matrix to a gene-set by sample matrix, thereby allowing the evaluation of pathway enrichment for each sample. This new matrix of GSVA enrichment scores facilitates applying standard analytical methods like functional enrichment, survival analysis, clustering, CNV-pathway analysis or cross-tissue pathway analysis, in a pathway-centric manner. Users on all platforms must install the GNU Scientific Library; see the README file, available in the source distribution of this file, for details.
13
+License: GPL (>= 2)
14
+LazyLoad: yes
15
+biocViews: Bioinformatics, Microarray, Pathways
16
+URL: http://www.sagebase.org
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+useDynLib(GSVA)
2
+
3
+import(methods)
4
+importClassesFrom(Biobase)
5
+importClassesFrom(GSEABase)
6
+importFrom(Biobase, exprs)
7
+importFrom(Biobase, annotation)
8
+
9
+exportMethods("gsva",
10
+              "filterGeneSets",
11
+              "computeGeneSetsOverlap")
0 12
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+CHANGES IN VERSION 0.9
2
+----------------------
3
+
4
+USER VISIBLE CHANGES
5
+
6
+    o first version of the package
7
+
8
+(start date: 18 Feburary, 2011)
0 9
new file mode 100644
... ...
@@ -0,0 +1,587 @@
1
+##
2
+## function: gsva
3
+## purpose: main function of the package which estimates activity
4
+##          scores for each given gene-set
5
+
6
+setGeneric("gsva", function(expr, gset.idx.list, ...) standardGeneric("gsva"))
7
+
8
+setMethod("gsva", signature(expr="ExpressionSet", gset.idx.list="list"),
9
+          function(expr, gset.idx.list,
10
+  abs.ranking=FALSE,
11
+  min.sz=1,
12
+  max.sz=Inf,
13
+  no.bootstraps=0, 
14
+  bootstrap.percent = .632, 
15
+  parallel.sz=0, 
16
+  parallel.type="SOCK",
17
+  verbose=TRUE,
18
+  mx.diff=TRUE)
19
+{
20
+  ## map to the actual features for which expression data is available
21
+  mapped.gset.idx.list <- lapply(gset.idx.list,
22
+                                 function(x, y) na.omit(match(x, y)),
23
+                                 featureNames(expr))
24
+
25
+  ## remove gene sets from the analysis for which no features are available
26
+  ## and meet the minimum and maximum gene-set size specified by the user
27
+  mapped.gset.idx.list <- filterGeneSets(mapped.gset.idx.list,
28
+                                         min.sz=max(1, min.sz),
29
+                                         max.sz=max.sz)
30
+
31
+  eSco <- GSVA:::.gsva(Biobase::exprs(expr), mapped.gset.idx.list, abs.ranking,
32
+                       no.bootstraps, bootstrap.percent, parallel.sz, parallel.type,
33
+                       verbose, mx.diff)
34
+  eScoEset <- expr
35
+  eScoEset <- Biobase::`exprs<-`(eScoEset, eSco$es.obs)
36
+  eScoEset <- Biobase::`annotation<-`(eScoEset, "")
37
+
38
+	return(list(es.obs=eScoEset,
39
+				      bootstrap=eSco$bootstrap,
40
+              p.vals.sign=eSco$p.vals.sign))
41
+})
42
+
43
+setMethod("gsva", signature(expr="ExpressionSet", gset.idx.list="GeneSetCollection"),
44
+          function(expr, gset.idx.list,
45
+  abs.ranking=FALSE,
46
+  min.sz=1,
47
+  max.sz=Inf,
48
+  no.bootstraps=0, 
49
+  bootstrap.percent = .632, 
50
+  parallel.sz=0, 
51
+  parallel.type="SOCK",
52
+  verbose=TRUE,
53
+  mx.diff=TRUE)
54
+{
55
+  if (verbose)
56
+    cat("Mapping identifiers between gene sets and feature names\n")
57
+
58
+  ## map gene identifiers of the gene sets to the features in the chip
59
+  mapped.gset.idx.list <- mapIdentifiers(gset.idx.list,
60
+                                         AnnotationIdentifier(annotation(expr)))
61
+  
62
+  ## map to the actual features for which expression data is available
63
+  tmp <- lapply(geneIds(mapped.gset.idx.list),
64
+                                 function(x, y) na.omit(match(x, y)),
65
+                                 featureNames(expr))
66
+  names(tmp) <- names(mapped.gset.idx.list)
67
+  ## remove gene sets from the analysis for which no features are available
68
+  ## and meet the minimum and maximum gene-set size specified by the user
69
+  mapped.gset.idx.list <- filterGeneSets(tmp,
70
+                                         min.sz=max(1, min.sz),
71
+                                         max.sz=max.sz)
72
+
73
+  eSco <- GSVA:::.gsva(Biobase::exprs(expr), mapped.gset.idx.list, abs.ranking,
74
+                       no.bootstraps, bootstrap.percent, parallel.sz, parallel.type,
75
+                       verbose, mx.diff)
76
+  eScoEset <- expr
77
+  eScoEset <- Biobase::`exprs<-`(eScoEset, eSco$es.obs)
78
+  eScoEset <- Biobase::`annotation<-`(eScoEset, "")
79
+
80
+	return(list(es.obs=eScoEset,
81
+				      bootstrap=eSco$bootstrap,
82
+              p.vals.sign=eSco$p.vals.sign))
83
+})
84
+
85
+setMethod("gsva", signature(expr="matrix", gset.idx.list="list"),
86
+          function(expr, gset.idx.list,
87
+  abs.ranking=FALSE,
88
+  min.sz=1,
89
+  max.sz=Inf,
90
+  no.bootstraps=0, 
91
+  bootstrap.percent = .632, 
92
+  parallel.sz=0, 
93
+  parallel.type="SOCK",
94
+  verbose=TRUE,
95
+  mx.diff=TRUE)
96
+{
97
+  mapped.gset.idx.list <- lapply(gset.idx.list,
98
+                                 function(x ,y) na.omit(match(x, y)),
99
+                                 rownames(expr))
100
+
101
+  ## remove gene sets from the analysis for which no features are available
102
+  ## and meet the minimum and maximum gene-set size specified by the user
103
+  mapped.gset.idx.list <- filterGeneSets(mapped.gset.idx.list,
104
+                                         min.sz=max(1, min.sz),
105
+                                         max.sz=max.sz)
106
+
107
+  GSVA:::.gsva(expr, mapped.gset.idx.list, abs.ranking, no.bootstraps,
108
+               bootstrap.percent, parallel.sz, parallel.type,
109
+               verbose, mx.diff)
110
+})
111
+
112
+.gsva <- function(expr, gset.idx.list,
113
+  abs.ranking=FALSE,
114
+  no.bootstraps=0, 
115
+  bootstrap.percent = .632, 
116
+  parallel.sz=0, 
117
+  parallel.type="SOCK",
118
+  verbose=TRUE,
119
+  mx.diff=TRUE)
120
+{
121
+	
122
+	if(length(gset.idx.list) == 0){
123
+		stop("The gene set list is empty!  Filter may be too stringent.")
124
+	}
125
+	
126
+	if(verbose)
127
+		cat("Testing", length(gset.idx.list),"gene sets.\n")
128
+	
129
+	if(parallel.sz > 0 && no.bootstraps > 0){
130
+		if((no.bootstraps %% parallel.sz) != 0){
131
+			stop("'parrallel.sz' must be an integer divisor of 'no.bootsraps'" )
132
+		}
133
+	}
134
+	n.samples <- ncol(expr)
135
+	n.genes <- nrow(expr)
136
+	n.gset <- length(gset.idx.list)
137
+	
138
+	es.obs <- matrix(NaN, n.gset, n.samples, dimnames=list(names(gset.idx.list),colnames(expr)))
139
+	colnames(es.obs) <- colnames(expr)
140
+	rownames(es.obs) <- names(gset.idx.list)
141
+	
142
+	
143
+	if (verbose)
144
+    cat("Computing observed enrichment scores\n")
145
+	es.obs <- compute.geneset.es(expr, gset.idx.list, 1:n.samples,
146
+                               abs.ranking,parallel.sz,
147
+                               parallel.type,verbose=verbose, mx.diff=mx.diff)
148
+	
149
+	# es.bootstraps -> n.gset by n.samples by n.resamples
150
+	es.bootstraps=NULL
151
+	p.vals.wilcoxon=NULL
152
+	p.vals.sign=NULL
153
+	
154
+	if(no.bootstraps > 0){
155
+		if(verbose) cat("Computing bootstrap enrichment scores\n")
156
+		bootstrap.nsamples <- floor(bootstrap.percent * n.samples)
157
+		
158
+		p.vals.sign <- matrix(NaN, n.gset, n.samples,dimnames=list(names(gset.idx.list),colnames(expr)))
159
+		
160
+		es.bootstraps <- array(NaN, c(n.gset, n.samples, no.bootstraps))
161
+		if(parallel.sz > 0){
162
+			
163
+		  if(!GSVA:::.isPackageLoaded("snow")) {
164
+			  stop("Please load the 'snow' library")
165
+		  }
166
+      ## copying ShortRead's strategy, the calls to the 'get()' are
167
+      ## employed to quieten R CMD check, and for no other reason
168
+      makeCl <- get("makeCluster", mode="function")
169
+      clSetupRNG <- get("clusterSetupRNG", mode="function")
170
+      clEvalQ <- get("clusterEvalQ", mode="function")
171
+      clExport <- get("clusterExport", mode="function")
172
+      stopCl <- get("stopCluster", mode="function")
173
+			
174
+			cl <- makeCl(parallel.sz, type = parallel.type) 
175
+			.GlobalEnv[["expr"]] <- expr
176
+			.GlobalEnv[["bootstrap.nsamples"]] <- bootstrap.nsamples
177
+			.GlobalEnv[["n.samples"]] <- n.samples
178
+			.GlobalEnv[["gset.idx.list"]] <- gset.idx.list
179
+			clExport(cl,"expr")
180
+			clExport(cl,"bootstrap.nsamples")
181
+			clExport(cl, "n.samples")
182
+			clExport(cl, "gset.idx.list")
183
+			clEvalQ(cl, library(GSVA))
184
+			
185
+			clSetupRNG(cl)
186
+			
187
+			if(verbose) cat("Parallel bootstrap...\n")
188
+			## parallelized bootstrap
189
+			n.cycles <- floor(no.bootstraps / parallel.sz)
190
+			for(i in 1:n.cycles){
191
+				if(verbose) cat("bootstrap cycle ", i, "\n")
192
+				r <- clEvalQ(cl, compute.geneset.es(expr, gset.idx.list, 
193
+								sample(n.samples, bootstrap.nsamples, replace=T),
194
+								abs.ranking))
195
+				for(j in 1:length(r)){
196
+					es.bootstraps[,,(parallel.sz * (i-1) + j)] <- r[[j]]
197
+				}	
198
+			}
199
+			stopCl(cl)
200
+		}else{
201
+			if(verbose) cat("Sequential bootstrap...\n")
202
+			for(i in 1:no.bootstraps){
203
+				es.bootstraps[,,i] <- compute.geneset.es(expr, gset.idx.list,
204
+						sample(n.samples, bootstrap.nsamples, replace=T),
205
+						abs.ranking)
206
+			}
207
+		}
208
+	
209
+		
210
+		for(i in 1:n.gset){
211
+			
212
+			for(j in 1:n.samples){
213
+				# non-parametric test if median of empirical dist is 0 
214
+				if(es.obs[i,j] > 0){
215
+					p.vals.sign[i,j] <- (1 + sum(es.bootstraps[i,j,] < 0)) / (1 + no.bootstraps)
216
+				}else{
217
+					p.vals.sign[i,j] <- (1 + sum(es.bootstraps[i,j,] > 0)) / (1 + no.bootstraps)
218
+				}
219
+			}
220
+		}
221
+	}
222
+	
223
+	colnames(es.obs) <- colnames(expr)
224
+	rownames(es.obs) <- names(gset.idx.list)
225
+	return(list(es.obs=es.obs,
226
+				      bootstrap=list(es.bootstraps=es.bootstraps,
227
+              p.vals.sign=p.vals.sign)))
228
+}
229
+
230
+
231
+compute.gene.density <- function(expr, sample.idxs){
232
+	n.test.samples <- ncol(expr)
233
+	n.genes <- nrow(expr)
234
+	n.density.samples <- length(sample.idxs)
235
+	
236
+	A = .C("assess_matrix_density_R",
237
+			as.double(t(expr[,sample.idxs])),
238
+			as.double(t(expr)),
239
+			R = double(n.test.samples * n.genes),
240
+			n.density.samples,
241
+			n.test.samples,
242
+			n.genes)$R
243
+	
244
+	gene.density <- t(matrix(A, n.test.samples, n.genes))
245
+	return (gene.density)	
246
+}
247
+
248
+compute.geneset.es <- function(expr, gset.idx.list, sample.idxs, abs.ranking,
249
+                               parallel.sz=0, parallel.type="SOCK",
250
+                               verbose=FALSE, mx.diff){
251
+	num_genes <- nrow(expr)
252
+	if(verbose) cat("Computing gene densities\n")
253
+	gene.density <- compute.gene.density(expr, sample.idxs)
254
+	
255
+	compute_rank_score <- function(sort_idx_vec){
256
+		tmp <- rep(0, num_genes)
257
+		tmp[sort_idx_vec] <- abs(seq(from=num_genes,to=1) - num_genes/2)
258
+		return (tmp)
259
+	}
260
+	
261
+	rank.scores <- rep(0, num_genes)
262
+	if(abs.ranking){
263
+		sort.sgn.idxs <- apply(abs(gene.density), 2, order, decreasing=TRUE) # n.genes * n.samples	
264
+	}else{
265
+		sort.sgn.idxs <- apply(gene.density, 2, order, decreasing=TRUE) # n.genes * n.samples
266
+	}
267
+	
268
+	rank.scores <- apply(sort.sgn.idxs, 2, compute_rank_score)
269
+	
270
+	haveMulticore <- GSVA:::.isPackageLoaded("multicore")
271
+	haveSnow <- GSVA:::.isPackageLoaded("snow")
272
+	
273
+	if(parallel.sz > 0 || haveMulticore) {
274
+		if(!haveMulticore && !haveSnow) {
275
+			stop("In order to run calculations in parallel either the 'snow', or the 'multicore' library, should be loaded first")
276
+		}
277
+
278
+    if (!haveMulticore) {  ## use snow
279
+      ## copying ShortRead's strategy, the calls to the 'get()' are
280
+      ## employed to quieten R CMD check, and for no other reason
281
+      makeCl <- get("makeCluster", mode="function")
282
+      parSapp <- get("parSapply", mode="function")
283
+      clEvalQ <- get("clusterEvalQ", mode="function")
284
+      stopCl <- get("stopCluster", mode="function")
285
+
286
+      if (verbose)
287
+        cat("Allocating cluster\n")
288
+		  cl <- makeCl(parallel.sz, type = parallel.type) 
289
+		  clEvalQ(cl, library(GSVA))
290
+		  if (verbose) {
291
+		    cat("Evaluating parallel ks-tests...\n")
292
+	      if(mx.diff) {
293
+          cat("Taking diff of max KS.\n")
294
+        } else{
295
+          cat("Evaluting max KS.\n")
296
+        }
297
+      }
298
+	
299
+		  m <- t(parSapp(cl, gset.idx.list, ks_test_m, 
300
+						  gene.density=rank_scores, 
301
+						  sort.idxs=sort.sgn.idxs,
302
+						  mx.diff=mx.diff, verbose=FALSE))
303
+		  if(verbose)
304
+        cat("Cleaning up\n")
305
+		  stopCl(cl)
306
+
307
+    } else {             ## use multicore
308
+
309
+      mclapp <- get('mclapply', envir=getNamespace('multicore'))
310
+      detCor <- get('detectCores', envir=getNamespace('multicore'))
311
+      nCores <- detCor()
312
+      options(cores=nCores)
313
+      if (parallel.sz > 0 && parallel.sz < nCores)
314
+        options(cores=parallel.sz)
315
+
316
+      pb <- NULL
317
+      if (verbose){
318
+        cat("Using multicore with", getOption("cores"), "cores\n")
319
+        assign("progressBar", txtProgressBar(style=3), envir=globalenv()) ## show progress if verbose=TRUE
320
+        assign("nGeneSets", ceiling(length(gset.idx.list) / getOption("cores")), envir=globalenv())
321
+        assign("iGeneSet", 0, envir=globalenv())
322
+      }
323
+
324
+      m <- mclapp(gset.idx.list, GSVA:::ks_test_m,
325
+                  gene.density=rank.scores,
326
+                  sort.idxs=sort.sgn.idxs,
327
+                  mx.diff=mx.diff, verbose=verbose)
328
+      m <- do.call("rbind", m)
329
+      colnames(m) <- colnames(expr)
330
+
331
+      if (verbose) {
332
+        close(get("progressBar", envir=globalenv()))
333
+      }
334
+    }
335
+
336
+	} else {
337
+		if (verbose) {
338
+      cat("Evaluating ks-tests\n")
339
+	    if (mx.diff) {
340
+        cat("Taking diff of max KS.\n")
341
+      } else{
342
+        cat("Evaluting max KS.\n")
343
+      }
344
+    }
345
+    pb <- NULL
346
+    if (verbose){
347
+      assign("progressBar", txtProgressBar(style=3), envir=globalenv()) ## show progress if verbose=TRUE
348
+      assign("nGeneSets", length(gset.idx.list), envir=globalenv())
349
+      assign("iGeneSet", 0, envir=globalenv())
350
+    }
351
+
352
+		m <- t(sapply(gset.idx.list, ks_test_m, rank.scores, sort.sgn.idxs,
353
+                  mx.diff=mx.diff, verbose=verbose))
354
+
355
+    if (verbose) {
356
+      close(get("progressBar", envir=globalenv()))
357
+    }
358
+	}
359
+	return (m)
360
+}
361
+
362
+
363
+ks_test_m <- function(gset_idxs, gene.density, sort.idxs, tau.factor=1, mx.diff=TRUE, verbose=TRUE){
364
+	
365
+	n.genes <- nrow(gene.density)
366
+	n.samples <- ncol(gene.density)
367
+	n.geneset <- length(gset_idxs)
368
+
369
+	geneset.sample.es = .C("ks_matrix_R",
370
+			as.double(gene.density),
371
+			R = double(n.samples),
372
+			as.integer(sort.idxs),
373
+			n.genes,
374
+			as.integer(gset_idxs),
375
+			n.geneset,
376
+			as.double(tau.factor),
377
+			n.samples,
378
+			as.integer(mx.diff))$R
379
+
380
+  if (verbose) {
381
+    assign("iGeneSet", get("iGeneSet", envir=globalenv()) + 1, envir=globalenv())
382
+    setTxtProgressBar(get("progressBar", envir=globalenv()),
383
+                      get("iGeneSet", envir=globalenv()) / get("nGeneSets", envir=globalenv()))
384
+  }
385
+	
386
+	return (geneset.sample.es)
387
+}
388
+
389
+
390
+## ks-test in R code - testing only
391
+ks_test_Rcode <- function(gene.density, gset_idxs, tau.factor=1, make.plot=FALSE){
392
+	
393
+	n.genes = length(gene.density)
394
+	n.gset = length(gset_idxs)
395
+	
396
+	sum.gset <- sum(abs(gene.density[gset_idxs])^tau.factor)
397
+	
398
+	dec = 1 / (n.genes - n.gset)
399
+	
400
+	sort.idxs <- order(gene.density,decreasing=T)
401
+	offsets <- sort(match(gset_idxs, sort.idxs))
402
+	
403
+	last.idx = 0
404
+	values <- rep(NaN, length(gset_idxs))
405
+	current = 0
406
+	for(i in seq_along(offsets)){
407
+		current = current + abs(gene.density[sort.idxs[offsets[i]]])^tau.factor / sum.gset - dec * (offsets[i]-last.idx-1)
408
+		
409
+		values[i] = current
410
+		last.idx = offsets[i]
411
+	}
412
+	check_zero = current - dec * (n.genes-last.idx)
413
+	#if(check_zero > 10^-15){ 
414
+	#	stop(paste=c("Expected zero sum for ks:", check_zero))
415
+	#}
416
+	if(make.plot){ plot(offsets, values,type="l") } 
417
+	
418
+	max.idx = order(abs(values),decreasing=T)[1]
419
+	mx.value <- values[max.idx]
420
+	
421
+	return (mx.value)
422
+}
423
+
424
+setGeneric("filterGeneSets", function(gSets, ...) standardGeneric("filterGeneSets"))
425
+
426
+setMethod("filterGeneSets", signature(gSets="list"),
427
+          function(gSets, min.sz=1, max.sz=Inf) {
428
+	gSetsLen <- sapply(gSets,length)
429
+	return (gSets[gSetsLen >= min.sz & gSetsLen <= max.sz])	
430
+})
431
+
432
+setMethod("filterGeneSets", signature(gSets="GeneSetCollection"),
433
+          function(gSets, min.sz=1, max.sz=Inf) {
434
+	gSetsLen <- sapply(geneIds(gSets),length)
435
+	return (gSets[gSetsLen >= min.sz & gSetsLen <= max.sz])	
436
+})
437
+
438
+
439
+
440
+setGeneric("computeGeneSetsOverlap", function(gSets, uniqGenes=unique(unlist(gSets, use.names=FALSE)), ...) standardGeneric("computeGeneSetsOverlap"))
441
+
442
+setMethod("computeGeneSetsOverlap", signature(gSets="list", uniqGenes="character"),
443
+          function(gSets, uniqGenes, min.sz=1, max.sz=Inf) {
444
+  totalGenes <- length(uniqGenes)
445
+
446
+  ## map to the features requested
447
+  gSets <- lapply(gSets, function(x, y) as.vector(na.omit(match(x, y))), uniqGenes)
448
+
449
+  lenGsets <- sapply(gSets, length)
450
+  totalGsets <- length(gSets)
451
+
452
+  gSetsMembershipMatrix <- matrix(0, nrow=totalGenes, ncol=totalGsets,
453
+                                  dimnames=list(uniqGenes, names(gSets)))
454
+  members <- cbind(unlist(gSets, use.names=FALSE), rep(1:totalGsets, times=lenGsets))
455
+  gSetsMembershipMatrix[members] <- 1
456
+
457
+  GSVA:::.computeGeneSetsOverlap(gSetsMembershipMatrix, min.sz, max.sz)
458
+})
459
+
460
+setMethod("computeGeneSetsOverlap", signature(gSets="list", uniqGenes="ExpressionSet"),
461
+          function(gSets, uniqGenes, min.sz=1, max.sz=Inf) {
462
+  uniqGenes <- Biobase::featureNames(uniqGenes)
463
+  totalGenes <- length(uniqGenes)
464
+
465
+  ## map to the actual features for which expression data is available
466
+  gSets <- lapply(gSets, function(x, y) as.vector(na.omit(match(x, y))), uniqGenes)
467
+
468
+  lenGsets <- sapply(gSets, length)
469
+  totalGsets <- length(gSets)
470
+
471
+  gSetsMembershipMatrix <- matrix(0, nrow=totalGenes, ncol=totalGsets,
472
+                                  dimnames=list(uniqGenes, names(gSets)))
473
+  members <- cbind(unlist(gSets, use.names=FALSE), rep(1:totalGsets, times=lenGsets))
474
+  gSetsMembershipMatrix[members] <- 1
475
+
476
+  GSVA:::.computeGeneSetsOverlap(gSetsMembershipMatrix, min.sz, max.sz)
477
+})
478
+
479
+setMethod("computeGeneSetsOverlap", signature(gSets="GeneSetCollection", uniqGenes="character"),
480
+          function(gSets, uniqGenes, min.sz=1, max.sz=Inf) {
481
+
482
+  gSetsMembershipMatrix <- incidence(gSets)
483
+  gSetsMembershipMatrix <- t(gSetsMembershipMatrix[, colnames(gSetsMembershipMatrix) %in% uniqGenes])
484
+
485
+  GSVA:::.computeGeneSetsOverlap(gSetsMembershipMatrix, min.sz, max.sz)
486
+})
487
+
488
+setMethod("computeGeneSetsOverlap", signature(gSets="GeneSetCollection", uniqGenes="ExpressionSet"),
489
+          function(gSets, uniqGenes, min.sz=1, max.sz=Inf) {
490
+  ## map gene identifiers of the gene sets to the features in the chip
491
+  gSets <- mapIdentifiers(gSets, AnnotationIdentifier(annotation(uniqGenes)))
492
+  
493
+  uniqGenes <- Biobase::featureNames(uniqGenes)
494
+
495
+  gSetsMembershipMatrix <- incidence(gSets)
496
+  gSetsMembershipMatrix <- t(gSetsMembershipMatrix[, colnames(gSetsMembershipMatrix) %in% uniqGenes])
497
+
498
+  GSVA:::.computeGeneSetsOverlap(gSetsMembershipMatrix, min.sz, max.sz)
499
+})
500
+
501
+.computeGeneSetsOverlap <- function(gSetsMembershipMatrix, min.sz=1, max.sz=Inf) {
502
+  ## gSetsMembershipMatrix should be a (genes x gene-sets) incidence matrix
503
+
504
+  lenGsets <- colSums(gSetsMembershipMatrix)
505
+
506
+  szFilterMask <- lenGsets >= max(1, min.sz) & lenGsets <= max.sz
507
+  if (!any(szFilterMask))
508
+    stop("No gene set meets the minimum and maximum size filter\n")
509
+
510
+  gSetsMembershipMatrix <- gSetsMembershipMatrix[, szFilterMask]
511
+  lenGsets <- lenGsets[szFilterMask]
512
+
513
+  totalGsets <- ncol(gSetsMembershipMatrix)
514
+
515
+  M <- t(gSetsMembershipMatrix) %*% gSetsMembershipMatrix
516
+
517
+  M1 <- matrix(lenGsets, nrow=totalGsets, ncol=totalGsets,
518
+               dimnames=list(colnames(gSetsMembershipMatrix), colnames(gSetsMembershipMatrix)))
519
+  M2 <- t(M1)
520
+  M.min <- matrix(0, nrow=totalGsets, ncol=totalGsets)
521
+  M.min[M1 < M2] <- M1[M1 < M2]
522
+  M.min[M2 <= M1] <- M2[M2 <= M1]
523
+  overlapMatrix <- M / M.min
524
+
525
+  return (overlapMatrix)
526
+}
527
+
528
+## from https://stat.ethz.ch/pipermail/r-help/2005-September/078974.html
529
+## function: isPackageLoaded
530
+## purpose: to check whether the package specified by the name given in
531
+##          the input argument is loaded. this function is borrowed from
532
+##          the discussion on the R-help list found in this url:
533
+##          https://stat.ethz.ch/pipermail/r-help/2005-September/078974.html
534
+## parameters: name - package name
535
+## return: TRUE if the package is loaded, FALSE otherwise
536
+
537
+.isPackageLoaded <- function(name) {
538
+  ## Purpose: is package 'name' loaded?
539
+  ## --------------------------------------------------
540
+  (paste("package:", name, sep="") %in% search()) ||
541
+  (name %in% loadedNamespaces())
542
+}
543
+
544
+##
545
+## ARE THESE FUNCTIONS STILL NECESSARY ?????
546
+##
547
+
548
+##a <- replicate(1000, compute.null.enrichment(10000,50,make.plot=F))
549
+
550
+compute.null.enrichment <- function(n.genes, n.geneset, make.plot=FALSE){
551
+	ranks <- (n.genes/2) - rev(1:n.genes)
552
+	#null.gset.idxs <- seq(1, n.genes, by=round(n.genes / n.geneset))
553
+	null.gset.idxs <- sample(n.genes, n.geneset)
554
+	null.es <- ks_test_Rcode(ranks, null.gset.idxs,make.plot=make.plot)
555
+	return (null.es)
556
+}
557
+
558
+
559
+load.gmt.data <- function(gmt.file.path){
560
+	tmp <- readLines(gmt.file.path)
561
+	gsets <- list()
562
+	for(i in 1:length(tmp)){
563
+		t <- strsplit(tmp[i],'\t')[[1]]
564
+		gsets[[t[1]]] <- t[3:length(t)]
565
+	}
566
+	return (gsets)
567
+}
568
+
569
+compute.gset.overlap.score <- function(gset.idxs){
570
+	n <- length(gset.idxs)
571
+	mx.idx <- max(unlist(gset.idxs, use.names=F))
572
+	l <- c(sapply(gset.idxs, length))
573
+	
574
+	gset.M <- matrix(0, nrow=mx.idx, ncol=n)
575
+	for(i in 1:n){
576
+		gset.M[gset.idxs[[i]],i] = 1
577
+	}
578
+	M <- t(gset.M) %*% gset.M
579
+	
580
+	M1 <- matrix(l, nrow=n, ncol=n)
581
+	M2 <- t(M1)
582
+	M.min <- matrix(0, nrow=n, ncol=n)
583
+	M.min[M1 < M2] <- M1[M1 < M2]
584
+	M.min[M2 <= M1] <- M2[M2 <= M1]
585
+	M.score <- M / M.min
586
+	return (M.score)
587
+}
0 588
new file mode 100644
... ...
@@ -0,0 +1,30 @@
1
+===============
2
+Installing GSVA
3
+===============
4
+
5
+In order to successfully install and run GSVA you need to
6
+install first the GNU Scientific Library (GSL) which you
7
+can find in the following URL:
8
+
9
+http://www.gnu.org/software/gsl
10
+
11
+Once you have installed the GSL, if you have done it
12
+"system-wide" then you can install GSVA in the usual
13
+way as with any other Bioconductor package:
14
+
15
+biocLite("GSVA")
16
+
17
+However, if you have installed the GSL in a non system-wide
18
+location of you hard disk, you should provide this location
19
+to biocLite() as follows:
20
+
21
+biocLite("GSVA", configure.args="--with-gsl-lib=\"/where/gsl/lib/is\" --with-gsl-include=\"/where/gsl/include/is\"")
22
+
23
+If, alternatively, you have downloaded yourself the source
24
+tarball of GSVA and want to install it from the shell, then
25
+you should use:
26
+
27
+R CMD INSTALL --configure-args="--with-gsl-lib=`R RHOME`/lib --with-gsl-include=`R RHOME`/include" GSVA_X.Y.Z.tar.gz
28
+
29
+where X.Y.Z is the corresponding version of GSVA that you have
30
+actually downloaded.
0 31
new file mode 100755
... ...
@@ -0,0 +1,7 @@
1
+rm -f config.*
2
+
3
+rm -f src/Makevars
4
+
5
+rm -f src/*.o src/*.so
6
+
7
+rm -rf autom4te.cache
0 8
new file mode 100755
... ...
@@ -0,0 +1,4596 @@
1
+#! /bin/sh
2
+# Guess values for system-dependent variables and create Makefiles.
3
+# Generated by GNU Autoconf 2.61 for GSVA 0.1.
4
+#
5
+# Report bugs to <justin.guinney@sagebase.org>.
6
+#
7
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
8
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
9
+# This configure script is free software; the Free Software Foundation
10
+# gives unlimited permission to copy, distribute and modify it.
11
+## --------------------- ##
12
+## M4sh Initialization.  ##
13
+## --------------------- ##
14
+
15
+# Be more Bourne compatible
16
+DUALCASE=1; export DUALCASE # for MKS sh
17
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
18
+  emulate sh
19
+  NULLCMD=:
20
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
21
+  # is contrary to our usage.  Disable this feature.
22
+  alias -g '${1+"$@"}'='"$@"'
23
+  setopt NO_GLOB_SUBST
24
+else
25
+  case `(set -o) 2>/dev/null` in
26
+  *posix*) set -o posix ;;
27
+esac
28
+
29
+fi
30
+
31
+
32
+
33
+
34
+# PATH needs CR
35
+# Avoid depending upon Character Ranges.
36
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
37
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
38
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
39
+as_cr_digits='0123456789'
40
+as_cr_alnum=$as_cr_Letters$as_cr_digits
41
+
42
+# The user is always right.
43
+if test "${PATH_SEPARATOR+set}" != set; then
44
+  echo "#! /bin/sh" >conf$$.sh
45
+  echo  "exit 0"   >>conf$$.sh
46
+  chmod +x conf$$.sh
47
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
48
+    PATH_SEPARATOR=';'
49
+  else
50
+    PATH_SEPARATOR=:
51
+  fi
52
+  rm -f conf$$.sh
53
+fi
54
+
55
+# Support unset when possible.
56
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
57
+  as_unset=unset
58
+else
59
+  as_unset=false
60
+fi
61
+
62
+
63
+# IFS
64
+# We need space, tab and new line, in precisely that order.  Quoting is
65
+# there to prevent editors from complaining about space-tab.
66
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
67
+# splitting by setting IFS to empty value.)
68
+as_nl='
69
+'
70
+IFS=" ""	$as_nl"
71
+
72
+# Find who we are.  Look in the path if we contain no directory separator.
73
+case $0 in
74
+  *[\\/]* ) as_myself=$0 ;;
75
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
76
+for as_dir in $PATH
77
+do
78
+  IFS=$as_save_IFS
79
+  test -z "$as_dir" && as_dir=.
80
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
81
+done
82
+IFS=$as_save_IFS
83
+
84
+     ;;
85
+esac
86
+# We did not find ourselves, most probably we were run as `sh COMMAND'
87
+# in which case we are not to be found in the path.
88
+if test "x$as_myself" = x; then
89
+  as_myself=$0
90
+fi
91
+if test ! -f "$as_myself"; then
92
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
93
+  { (exit 1); exit 1; }
94
+fi
95
+
96
+# Work around bugs in pre-3.0 UWIN ksh.
97
+for as_var in ENV MAIL MAILPATH
98
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
99
+done
100
+PS1='$ '
101
+PS2='> '
102
+PS4='+ '
103
+
104
+# NLS nuisances.
105
+for as_var in \
106
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
107
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
108
+  LC_TELEPHONE LC_TIME
109
+do
110
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
111
+    eval $as_var=C; export $as_var
112
+  else
113
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
114
+  fi
115
+done
116
+
117
+# Required to use basename.
118
+if expr a : '\(a\)' >/dev/null 2>&1 &&
119
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
120
+  as_expr=expr
121
+else
122
+  as_expr=false
123
+fi
124
+
125
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
126
+  as_basename=basename
127
+else
128
+  as_basename=false
129
+fi
130
+
131
+
132
+# Name of the executable.
133
+as_me=`$as_basename -- "$0" ||
134
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
135
+	 X"$0" : 'X\(//\)$' \| \
136
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
137
+echo X/"$0" |
138
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
139
+	    s//\1/
140
+	    q
141
+	  }
142
+	  /^X\/\(\/\/\)$/{
143
+	    s//\1/
144
+	    q
145
+	  }
146
+	  /^X\/\(\/\).*/{
147
+	    s//\1/
148
+	    q
149
+	  }
150
+	  s/.*/./; q'`
151
+
152
+# CDPATH.
153
+$as_unset CDPATH
154
+
155
+
156
+if test "x$CONFIG_SHELL" = x; then
157
+  if (eval ":") 2>/dev/null; then
158
+  as_have_required=yes
159
+else
160
+  as_have_required=no
161
+fi
162
+
163
+  if test $as_have_required = yes && 	 (eval ":
164
+(as_func_return () {
165
+  (exit \$1)
166
+}
167
+as_func_success () {
168
+  as_func_return 0
169
+}
170
+as_func_failure () {
171
+  as_func_return 1
172
+}
173
+as_func_ret_success () {
174
+  return 0
175
+}
176
+as_func_ret_failure () {
177
+  return 1
178
+}
179
+
180
+exitcode=0
181
+if as_func_success; then
182
+  :
183
+else
184
+  exitcode=1
185
+  echo as_func_success failed.
186
+fi
187
+
188
+if as_func_failure; then
189
+  exitcode=1
190
+  echo as_func_failure succeeded.
191
+fi
192
+
193
+if as_func_ret_success; then
194
+  :
195
+else
196
+  exitcode=1
197
+  echo as_func_ret_success failed.
198
+fi
199
+
200
+if as_func_ret_failure; then
201
+  exitcode=1
202
+  echo as_func_ret_failure succeeded.
203
+fi
204
+
205
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
206
+  :
207
+else
208
+  exitcode=1
209
+  echo positional parameters were not saved.
210
+fi
211
+
212
+test \$exitcode = 0) || { (exit 1); exit 1; }
213
+
214
+(
215
+  as_lineno_1=\$LINENO
216
+  as_lineno_2=\$LINENO
217
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
218
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
219
+") 2> /dev/null; then
220
+  :
221
+else
222
+  as_candidate_shells=
223
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
224
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
225
+do
226
+  IFS=$as_save_IFS
227
+  test -z "$as_dir" && as_dir=.
228
+  case $as_dir in
229
+	 /*)
230
+	   for as_base in sh bash ksh sh5; do
231
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
232
+	   done;;
233
+       esac
234
+done
235
+IFS=$as_save_IFS
236
+
237
+
238
+      for as_shell in $as_candidate_shells $SHELL; do
239
+	 # Try only shells that exist, to save several forks.
240
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
241
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
242
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
243
+  emulate sh
244
+  NULLCMD=:
245
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
246
+  # is contrary to our usage.  Disable this feature.
247
+  alias -g '${1+"$@"}'='"$@"'
248
+  setopt NO_GLOB_SUBST
249
+else
250
+  case `(set -o) 2>/dev/null` in
251
+  *posix*) set -o posix ;;
252
+esac
253
+
254
+fi
255
+
256
+
257
+:
258
+_ASEOF
259
+}; then
260
+  CONFIG_SHELL=$as_shell
261
+	       as_have_required=yes
262
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
263
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
264
+  emulate sh
265
+  NULLCMD=:
266
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
267
+  # is contrary to our usage.  Disable this feature.
268
+  alias -g '${1+"$@"}'='"$@"'
269
+  setopt NO_GLOB_SUBST
270
+else
271
+  case `(set -o) 2>/dev/null` in
272
+  *posix*) set -o posix ;;
273
+esac
274
+
275
+fi
276
+
277
+
278
+:
279
+(as_func_return () {
280
+  (exit $1)
281
+}
282
+as_func_success () {
283
+  as_func_return 0
284
+}
285
+as_func_failure () {
286
+  as_func_return 1
287
+}
288
+as_func_ret_success () {
289
+  return 0
290
+}
291
+as_func_ret_failure () {
292
+  return 1
293
+}
294
+
295
+exitcode=0
296
+if as_func_success; then
297
+  :
298
+else
299
+  exitcode=1
300
+  echo as_func_success failed.
301
+fi
302
+
303
+if as_func_failure; then
304
+  exitcode=1
305
+  echo as_func_failure succeeded.
306
+fi
307
+
308
+if as_func_ret_success; then
309
+  :
310
+else
311
+  exitcode=1
312
+  echo as_func_ret_success failed.
313
+fi
314
+
315
+if as_func_ret_failure; then
316
+  exitcode=1
317
+  echo as_func_ret_failure succeeded.
318
+fi
319
+
320
+if ( set x; as_func_ret_success y && test x = "$1" ); then
321
+  :
322
+else
323
+  exitcode=1
324
+  echo positional parameters were not saved.
325
+fi
326
+
327
+test $exitcode = 0) || { (exit 1); exit 1; }
328
+
329
+(
330
+  as_lineno_1=$LINENO
331
+  as_lineno_2=$LINENO
332
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
333
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
334
+
335
+_ASEOF
336
+}; then
337
+  break
338
+fi
339
+
340
+fi
341
+
342
+      done
343
+
344
+      if test "x$CONFIG_SHELL" != x; then
345
+  for as_var in BASH_ENV ENV
346
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
347
+        done
348
+        export CONFIG_SHELL
349
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
350
+fi
351
+
352
+
353
+    if test $as_have_required = no; then
354
+  echo This script requires a shell more modern than all the
355
+      echo shells that I found on your system.  Please install a
356
+      echo modern shell, or manually run the script under such a
357
+      echo shell if you do have one.
358
+      { (exit 1); exit 1; }
359
+fi
360
+
361
+
362
+fi
363
+
364
+fi
365
+
366
+
367
+
368
+(eval "as_func_return () {
369
+  (exit \$1)
370
+}
371
+as_func_success () {
372
+  as_func_return 0
373
+}
374
+as_func_failure () {
375
+  as_func_return 1
376
+}
377
+as_func_ret_success () {
378
+  return 0
379
+}
380
+as_func_ret_failure () {
381
+  return 1
382
+}
383
+
384
+exitcode=0
385
+if as_func_success; then
386
+  :
387
+else
388
+  exitcode=1
389
+  echo as_func_success failed.
390
+fi
391
+
392
+if as_func_failure; then
393
+  exitcode=1
394
+  echo as_func_failure succeeded.
395
+fi
396
+
397
+if as_func_ret_success; then
398
+  :
399
+else
400
+  exitcode=1
401
+  echo as_func_ret_success failed.
402
+fi
403
+
404
+if as_func_ret_failure; then
405
+  exitcode=1
406
+  echo as_func_ret_failure succeeded.
407
+fi
408
+
409
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
410
+  :
411
+else
412
+  exitcode=1
413
+  echo positional parameters were not saved.
414
+fi
415
+
416
+test \$exitcode = 0") || {
417
+  echo No shell found that supports shell functions.
418
+  echo Please tell autoconf@gnu.org about your system,
419
+  echo including any error possibly output before this
420
+  echo message
421
+}
422
+
423
+
424
+
425
+  as_lineno_1=$LINENO
426
+  as_lineno_2=$LINENO
427
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
428
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
429
+
430
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
431
+  # uniformly replaced by the line number.  The first 'sed' inserts a
432
+  # line-number line after each line using $LINENO; the second 'sed'
433
+  # does the real work.  The second script uses 'N' to pair each
434
+  # line-number line with the line containing $LINENO, and appends
435
+  # trailing '-' during substitution so that $LINENO is not a special
436
+  # case at line end.
437
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
438
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
439
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
440
+  sed -n '
441
+    p
442
+    /[$]LINENO/=
443
+  ' <$as_myself |
444
+    sed '
445
+      s/[$]LINENO.*/&-/
446
+      t lineno
447
+      b
448
+      :lineno
449
+      N
450
+      :loop
451
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
452
+      t loop
453
+      s/-\n.*//
454
+    ' >$as_me.lineno &&
455
+  chmod +x "$as_me.lineno" ||
456
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
457
+   { (exit 1); exit 1; }; }
458
+
459
+  # Don't try to exec as it changes $[0], causing all sort of problems
460
+  # (the dirname of $[0] is not the place where we might find the
461
+  # original and so on.  Autoconf is especially sensitive to this).
462
+  . "./$as_me.lineno"
463
+  # Exit status is that of the last command.
464
+  exit
465
+}
466
+
467
+
468
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
469
+  as_dirname=dirname
470
+else
471
+  as_dirname=false
472
+fi
473
+
474
+ECHO_C= ECHO_N= ECHO_T=
475
+case `echo -n x` in
476
+-n*)
477
+  case `echo 'x\c'` in
478
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
479
+  *)   ECHO_C='\c';;
480
+  esac;;
481
+*)
482
+  ECHO_N='-n';;
483
+esac
484
+
485
+if expr a : '\(a\)' >/dev/null 2>&1 &&
486
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
487
+  as_expr=expr
488
+else
489
+  as_expr=false
490
+fi
491
+
492
+rm -f conf$$ conf$$.exe conf$$.file
493
+if test -d conf$$.dir; then
494
+  rm -f conf$$.dir/conf$$.file
495
+else
496
+  rm -f conf$$.dir
497
+  mkdir conf$$.dir
498
+fi
499
+echo >conf$$.file
500
+if ln -s conf$$.file conf$$ 2>/dev/null; then
501
+  as_ln_s='ln -s'
502
+  # ... but there are two gotchas:
503
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
504
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
505
+  # In both cases, we have to default to `cp -p'.
506
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
507
+    as_ln_s='cp -p'
508
+elif ln conf$$.file conf$$ 2>/dev/null; then
509
+  as_ln_s=ln
510
+else
511
+  as_ln_s='cp -p'
512
+fi
513
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
514
+rmdir conf$$.dir 2>/dev/null
515
+
516
+if mkdir -p . 2>/dev/null; then
517
+  as_mkdir_p=:
518
+else
519
+  test -d ./-p && rmdir ./-p
520
+  as_mkdir_p=false
521
+fi
522
+
523
+if test -x / >/dev/null 2>&1; then
524
+  as_test_x='test -x'
525
+else
526
+  if ls -dL / >/dev/null 2>&1; then
527
+    as_ls_L_option=L
528
+  else
529
+    as_ls_L_option=
530
+  fi
531
+  as_test_x='
532
+    eval sh -c '\''
533
+      if test -d "$1"; then
534
+        test -d "$1/.";
535
+      else
536
+	case $1 in
537
+        -*)set "./$1";;
538
+	esac;
539
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
540
+	???[sx]*):;;*)false;;esac;fi
541
+    '\'' sh
542
+  '
543
+fi
544
+as_executable_p=$as_test_x
545
+
546
+# Sed expression to map a string onto a valid CPP name.
547
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
548
+
549
+# Sed expression to map a string onto a valid variable name.
550
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
551
+
552
+
553
+
554
+exec 7<&0 </dev/null 6>&1
555
+
556
+# Name of the host.
557
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
558
+# so uname gets run too.
559
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
560
+
561
+#
562
+# Initializations.
563
+#
564
+ac_default_prefix=/usr/local
565
+ac_clean_files=
566
+ac_config_libobj_dir=.
567
+LIBOBJS=
568
+cross_compiling=no
569
+subdirs=
570
+MFLAGS=
571
+MAKEFLAGS=
572
+SHELL=${CONFIG_SHELL-/bin/sh}
573
+
574
+# Identity of this package.
575
+PACKAGE_NAME='GSVA'
576
+PACKAGE_TARNAME='gsva'
577
+PACKAGE_VERSION='0.1'
578
+PACKAGE_STRING='GSVA 0.1'
579
+PACKAGE_BUGREPORT='justin.guinney@sagebase.org'
580
+
581
+# Factoring default headers for most tests.
582
+ac_includes_default="\
583
+#include <stdio.h>
584
+#ifdef HAVE_SYS_TYPES_H
585
+# include <sys/types.h>
586
+#endif
587
+#ifdef HAVE_SYS_STAT_H
588
+# include <sys/stat.h>
589
+#endif
590
+#ifdef STDC_HEADERS
591
+# include <stdlib.h>
592
+# include <stddef.h>
593
+#else
594
+# ifdef HAVE_STDLIB_H
595
+#  include <stdlib.h>
596
+# endif
597
+#endif
598
+#ifdef HAVE_STRING_H
599
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
600
+#  include <memory.h>
601
+# endif
602
+# include <string.h>
603
+#endif
604
+#ifdef HAVE_STRINGS_H
605
+# include <strings.h>
606
+#endif
607
+#ifdef HAVE_INTTYPES_H
608
+# include <inttypes.h>
609
+#endif
610
+#ifdef HAVE_STDINT_H
611
+# include <stdint.h>
612
+#endif
613
+#ifdef HAVE_UNISTD_H
614
+# include <unistd.h>
615
+#endif"
616
+
617
+ac_subst_vars='SHELL
618
+PATH_SEPARATOR
619
+PACKAGE_NAME
620
+PACKAGE_TARNAME
621
+PACKAGE_VERSION
622
+PACKAGE_STRING
623
+PACKAGE_BUGREPORT
624
+exec_prefix
625
+prefix
626
+program_transform_name
627
+bindir
628
+sbindir
629
+libexecdir
630
+datarootdir
631
+datadir
632
+sysconfdir
633
+sharedstatedir
634
+localstatedir
635
+includedir
636
+oldincludedir
637
+docdir
638
+infodir
639
+htmldir
640
+dvidir
641
+pdfdir
642
+psdir
643
+libdir
644
+localedir
645
+mandir
646
+DEFS
647
+ECHO_C
648
+ECHO_N
649
+ECHO_T
650
+LIBS
651
+build_alias
652
+host_alias
653
+target_alias
654
+CC
655
+CFLAGS
656
+LDFLAGS
657
+CPPFLAGS
658
+ac_ct_CC
659
+EXEEXT
660
+OBJEXT
661
+CPP
662
+GREP
663
+EGREP
664
+GSL_CPPFLAGS
665
+LIBOBJS
666
+LTLIBOBJS'
667
+ac_subst_files=''
668
+      ac_precious_vars='build_alias
669
+host_alias
670
+target_alias
671
+CC
672
+CFLAGS
673
+LDFLAGS
674
+LIBS
675
+CPPFLAGS
676
+CPP'
677
+
678
+
679
+# Initialize some variables set by options.
680
+ac_init_help=
681
+ac_init_version=false
682
+# The variables have the same names as the options, with
683
+# dashes changed to underlines.
684
+cache_file=/dev/null
685
+exec_prefix=NONE
686
+no_create=
687
+no_recursion=
688
+prefix=NONE
689
+program_prefix=NONE
690
+program_suffix=NONE
691
+program_transform_name=s,x,x,
692
+silent=
693
+site=
694
+srcdir=
695
+verbose=
696
+x_includes=NONE
697
+x_libraries=NONE
698
+
699
+# Installation directory options.
700
+# These are left unexpanded so users can "make install exec_prefix=/foo"
701
+# and all the variables that are supposed to be based on exec_prefix
702
+# by default will actually change.
703
+# Use braces instead of parens because sh, perl, etc. also accept them.
704
+# (The list follows the same order as the GNU Coding Standards.)
705
+bindir='${exec_prefix}/bin'
706
+sbindir='${exec_prefix}/sbin'
707
+libexecdir='${exec_prefix}/libexec'
708
+datarootdir='${prefix}/share'
709
+datadir='${datarootdir}'
710
+sysconfdir='${prefix}/etc'
711
+sharedstatedir='${prefix}/com'
712
+localstatedir='${prefix}/var'
713
+includedir='${prefix}/include'
714
+oldincludedir='/usr/include'
715
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
716
+infodir='${datarootdir}/info'
717
+htmldir='${docdir}'
718
+dvidir='${docdir}'
719
+pdfdir='${docdir}'
720
+psdir='${docdir}'
721
+libdir='${exec_prefix}/lib'
722
+localedir='${datarootdir}/locale'
723
+mandir='${datarootdir}/man'
724
+
725
+ac_prev=
726
+ac_dashdash=
727
+for ac_option
728
+do
729
+  # If the previous option needs an argument, assign it.
730
+  if test -n "$ac_prev"; then
731
+    eval $ac_prev=\$ac_option