... | ... |
@@ -1,14 +1,14 @@ |
1 | 1 |
Package: MiPP |
2 |
-Version: 1.5.0 |
|
3 |
-Date: 2007-01-01 |
|
2 |
+Version: 1.6.0 |
|
3 |
+Date: 2007-01-31 |
|
4 | 4 |
Title: Misclassification Penalized Posterior Classification |
5 | 5 |
Author: HyungJun Cho <[email protected]>, |
6 | 6 |
Sukwoo Kim <[email protected]>, |
7 | 7 |
Mat Soukup <[email protected]>, and |
8 | 8 |
Jae K. Lee <[email protected]> |
9 | 9 |
Maintainer: Sukwoo Kim <[email protected]> |
10 |
-Depends: R (>= 2.4), Biobase, e1071 |
|
11 |
-Description: This package finds optimal sets of genes that seperate samples into multiple classes. |
|
10 |
+Depends: R (>= 2.4), Biobase, e1071,MASS |
|
11 |
+Description: This package finds optimal sets of genes that seperate samples into two or more classes. |
|
12 | 12 |
License: GPL version 2 or newer |
13 | 13 |
URL:http://www.healthsystem.virginia.edu/internet/hes/biostat/bioinformatics/ |
14 |
-biocViews: Microarray, DifferentialExpression |
|
14 |
+biocViews: Microarray, Classification |
... | ... |
@@ -69,8 +69,8 @@ mipp <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
69 | 69 |
} |
70 | 70 |
if(length(ii) < 2) stop("There are too small number of candidate genes.") |
71 | 71 |
|
72 |
- x.tr <- x[,ii]; y.tr <- y |
|
73 |
- x.te <- x.test[,ii]; y.te <- y.test |
|
72 |
+ x.tr <- x[,ii,drop=FALSE]; y.tr <- y |
|
73 |
+ x.te <- x.test[,ii,drop=FALSE]; y.te <- y.test |
|
74 | 74 |
out <- mipp.rule(x.train=x.tr, y.train=y.tr, x.test=x.te, y.test=y.te, |
75 | 75 |
nfold=nfold, min.sMiPP=min.sMiPP, n.drops=n.drops, rule=rule) |
76 | 76 |
out[,2] <- probe.ID[ii[out[,2]]] |
... | ... |
@@ -113,7 +113,7 @@ mipp <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
113 | 113 |
} |
114 | 114 |
if(length(ii) < 2) stop("There are too small number of candidate genes.") |
115 | 115 |
|
116 |
- x.tr <- x[,ii] |
|
116 |
+ x.tr <- x[,ii,drop=FALSE] |
|
117 | 117 |
y.tr <- y |
118 | 118 |
out <- cv.mipp.rule(x=x.tr, y=y.tr, nfold=nfold, p.test=p.test, n.split=n.split, n.split.eval=n.split.eval, |
119 | 119 |
model.sMiPP.margin=model.sMiPP.margin, min.sMiPP=min.sMiPP, n.drops=n.drops, rule=rule) |
... | ... |
@@ -123,7 +123,7 @@ mipp <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
123 | 123 |
for(i in 1:n.split) { |
124 | 124 |
k <- ncol(out$CVCV.out)-9 ###note |
125 | 125 |
k <- max(which(!is.na(out$CVCV.out[i,1:k]))) |
126 |
- kk <- as.numeric(out$CVCV.out[i,2:k]) |
|
126 |
+ kk <- as.numeric(out$CVCV.out[i, 2:k, drop=FALSE]) |
|
127 | 127 |
out$CVCV.out[i,2:k] <- probe.ID[ii[kk]] |
128 | 128 |
} |
129 | 129 |
|
... | ... |
@@ -185,8 +185,8 @@ cv.mipp.rule <- function(x, y, nfold, p.test, n.split, n.split.eval, |
185 | 185 |
|
186 | 186 |
y.train <- y[-i.test] |
187 | 187 |
y.test <- y[ i.test] |
188 |
- x.train <- x[-i.test,] |
|
189 |
- x.test <- x[ i.test,] |
|
188 |
+ x.train <- x[-i.test,,drop=FALSE] |
|
189 |
+ x.test <- x[ i.test,,drop=FALSE] |
|
190 | 190 |
if(is.data.frame(x.train)==FALSE) x.train <- data.frame(x.train) |
191 | 191 |
if(is.data.frame(x.test)==FALSE) x.test <- data.frame(x.test) |
192 | 192 |
|
... | ... |
@@ -205,8 +205,8 @@ cv.mipp.rule <- function(x, y, nfold, p.test, n.split, n.split.eval, |
205 | 205 |
|
206 | 206 |
tmp <- apply(gene.list, 2, is.na) |
207 | 207 |
i <- which(apply(tmp, 2, sum) >= n.split) |
208 |
- gene.list <- gene.list[,-i] #fixed on 01/17/2007 |
|
209 |
- CV.out <- CV.out[-c(1:n.split),] |
|
208 |
+ gene.list <- gene.list[,-i,drop=FALSE] #fixed on 01/17/2007 |
|
209 |
+ CV.out <- CV.out[-c(1:n.split),,drop=FALSE] |
|
210 | 210 |
|
211 | 211 |
|
212 | 212 |
################################### |
... | ... |
@@ -229,17 +229,17 @@ cv.mipp.rule <- function(x, y, nfold, p.test, n.split, n.split.eval, |
229 | 229 |
|
230 | 230 |
y.train <- y[-i.test] |
231 | 231 |
y.test <- y[ i.test] |
232 |
- x.train <- x[-i.test,] |
|
233 |
- x.test <- x[ i.test,] |
|
232 |
+ x.train <- x[-i.test,,drop=FALSE] |
|
233 |
+ x.test <- x[ i.test,,drop=FALSE] |
|
234 | 234 |
if(is.data.frame(x.train)==FALSE) x.train <- data.frame(x.train) |
235 | 235 |
if(is.data.frame(x.test)==FALSE) x.test <- data.frame(x.test) |
236 | 236 |
|
237 | 237 |
for(jj in 1:n.split) { #Split |
238 | 238 |
|
239 |
- k <- max(which(!is.na(gene.list[jj,])==TRUE)) |
|
240 |
- kk <- as.numeric(gene.list[jj,1:k]) |
|
241 |
- xx.train <- x.train[,kk] |
|
242 |
- xx.test <- x.test[,kk] |
|
239 |
+ k <- max(which(!is.na(gene.list[jj,,drop=FALSE])==TRUE)) |
|
240 |
+ kk <- as.numeric(gene.list[jj,1:k,drop=FALSE]) |
|
241 |
+ xx.train <- x.train[,kk,drop=FALSE] |
|
242 |
+ xx.test <- x.test[,kk,drop=FALSE] |
|
243 | 243 |
if(is.data.frame(xx.train)==FALSE) xx.train <- data.frame(xx.train) |
244 | 244 |
if(is.data.frame(xx.test)==FALSE) xx.test <- data.frame(xx.test) |
245 | 245 |
|
... | ... |
@@ -300,8 +300,8 @@ mipp.rule <- function(x.train, y.train, x.test=NULL, y.test=NULL, nfold=5, min.s |
300 | 300 |
y.tr <- y.train[id!=i] |
301 | 301 |
y.te <- y.train[id==i] |
302 | 302 |
for(j in 1:n.gene) { |
303 |
- x.tr <- data.frame(x.train[id!=i,j]) |
|
304 |
- x.te <- data.frame(x.train[id==i,j]) |
|
303 |
+ x.tr <- data.frame(x.train[id!=i,j,drop=FALSE]) |
|
304 |
+ x.te <- data.frame(x.train[id==i,j,drop=FALSE]) |
|
305 | 305 |
out[i,j] <- get.mipp(x.tr, y.tr, x.te, y.te, rule=rule)$MiPP |
306 | 306 |
} |
307 | 307 |
} |
... | ... |
@@ -311,13 +311,13 @@ mipp.rule <- function(x.train, y.train, x.test=NULL, y.test=NULL, nfold=5, min.s |
311 | 311 |
pick.gene <- as.numeric(colnames(x.train)[pick.gene]) |
312 | 312 |
opt.genes <- c(opt.genes, pick.gene) |
313 | 313 |
|
314 |
- x.train.cand <- x.train[,-opt.genes] |
|
315 |
- x.train.opt <- data.frame(x.train[,opt.genes]) |
|
314 |
+ x.train.cand <- x.train[,-opt.genes,drop=FALSE] |
|
315 |
+ x.train.opt <- data.frame(x.train[,opt.genes,drop=FALSE]) |
|
316 | 316 |
colnames(x.train.opt) <- opt.genes |
317 | 317 |
|
318 | 318 |
#Evaluate by test set |
319 |
- xx.train <- data.frame(x.train[,opt.genes]) |
|
320 |
- xx.test <- data.frame(x.test[,opt.genes]) |
|
319 |
+ xx.train <- data.frame(x.train[,opt.genes,drop=FALSE]) |
|
320 |
+ xx.test <- data.frame(x.test[,opt.genes,drop=FALSE]) |
|
321 | 321 |
tmp <- get.mipp(xx.train, y.train, xx.test, y.test, rule=rule) |
322 | 322 |
opt.Er <-c(opt.Er, tmp$ErrorRate) |
323 | 323 |
opt.MiPP <-c(opt.MiPP, tmp$MiPP) |
... | ... |
@@ -341,8 +341,8 @@ mipp.rule <- function(x.train, y.train, x.test=NULL, y.test=NULL, nfold=5, min.s |
341 | 341 |
y.tr <- y.train[id!=i] |
342 | 342 |
y.te <- y.train[id==i] |
343 | 343 |
for(j in 1:n.gene.cand) { |
344 |
- x.tr <- data.frame(x.train.opt[id!=i,], x.train.cand[id!=i,j]) |
|
345 |
- x.te <- data.frame(x.train.opt[id==i,], x.train.cand[id==i,j]) |
|
344 |
+ x.tr <- data.frame(x.train.opt[id!=i,,drop=FALSE], x.train.cand[id!=i,j,drop=FALSE]) |
|
345 |
+ x.te <- data.frame(x.train.opt[id==i,,drop=FALSE], x.train.cand[id==i,j,drop=FALSE]) |
|
346 | 346 |
out[i,j] <- get.mipp(x.tr,y.tr, x.te, y.te, rule=rule)$MiPP |
347 | 347 |
} |
348 | 348 |
} |
... | ... |
@@ -351,13 +351,13 @@ mipp.rule <- function(x.train, y.train, x.test=NULL, y.test=NULL, nfold=5, min.s |
351 | 351 |
pick.gene <- min(which(out.sum >= max(out.sum))) |
352 | 352 |
pick.gene <- as.numeric(colnames(x.train.cand)[pick.gene]) |
353 | 353 |
opt.genes <- c(opt.genes, pick.gene) |
354 |
- x.train.opt <- x.train[, opt.genes] |
|
355 |
- x.train.cand <- x.train[,-opt.genes] |
|
354 |
+ x.train.opt <- x.train[, opt.genes,drop=FALSE] |
|
355 |
+ x.train.cand <- x.train[,-opt.genes,drop=FALSE] |
|
356 | 356 |
|
357 | 357 |
|
358 | 358 |
#Evaluate by test set |
359 |
- xx.train <- x.train[,opt.genes] |
|
360 |
- xx.test <- x.test[,opt.genes] |
|
359 |
+ xx.train <- x.train[,opt.genes,drop=FALSE] |
|
360 |
+ xx.test <- x.test[,opt.genes,drop=FALSE] |
|
361 | 361 |
tmp <- get.mipp(xx.train, y.train, xx.test, y.test, rule=rule) |
362 | 362 |
opt.Er <-c(opt.Er, tmp$ErrorRate) |
363 | 363 |
opt.MiPP <-c(opt.MiPP, tmp$MiPP) |
... | ... |
@@ -45,8 +45,8 @@ mipp.seq <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
45 | 45 |
nc <- ifelse(remove.gene.each.model=="first", 1, k) |
46 | 46 |
best.genes <- sort(unique(c(best.genes, out$model$Gene[1:nc]))) |
47 | 47 |
if(length(best.genes) < nrow(x)) { |
48 |
- x.sub <- x[-best.genes,] |
|
49 |
- x.test.sub <- x.test[-best.genes,] |
|
48 |
+ x.sub <- x[-best.genes,,drop=FALSE] |
|
49 |
+ x.test.sub <- x.test[-best.genes,,drop=FALSE] |
|
50 | 50 |
p.ID.sub <- p.ID[-best.genes] |
51 | 51 |
} |
52 | 52 |
|
... | ... |
@@ -59,7 +59,7 @@ mipp.seq <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
###GENE ID |
62 |
- out2 <- out2[-1,] |
|
62 |
+ out2 <- out2[-1,,drop=FALSE] |
|
63 | 63 |
out2$Gene <- probe.ID[out2$Gene] |
64 | 64 |
out2 <- cbind(Seq, out2) |
65 | 65 |
rownames(out2) <- 1:nrow(out2) |
... | ... |
@@ -108,9 +108,9 @@ mipp.seq <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
108 | 108 |
nc <- ifelse(remove.gene.each.model=="first", 2, (n.sample+1)) |
109 | 109 |
k <- which(CVCV.out2[,(1+n.sample+7)] >= cutoff.sMiPP) |
110 | 110 |
if(length(k) > 0) { |
111 |
- best.genes <- sort(unique(as.numeric(na.omit(as.vector(as.matrix(CVCV.out2[k,2:nc])))))) |
|
111 |
+ best.genes <- sort(unique(as.numeric(na.omit(as.vector(as.matrix(CVCV.out2[k,2:nc,drop=FALSE])))))) |
|
112 | 112 |
if(length(best.genes) < nrow(x)) { |
113 |
- x.sub <- x[-best.genes,] |
|
113 |
+ x.sub <- x[-best.genes,,drop=FALSE] |
|
114 | 114 |
p.ID.sub <- p.ID[-best.genes] |
115 | 115 |
} |
116 | 116 |
} |
... | ... |
@@ -126,7 +126,7 @@ mipp.seq <- function(x, y, x.test=NULL, y.test=NULL, probe.ID=NULL, rule="lda", |
126 | 126 |
|
127 | 127 |
###GENE ID |
128 | 128 |
CV.out2$Gene <- probe.ID[CV.out2$Gene] |
129 |
- kk <- as.numeric(as.vector(as.matrix(CVCV.out2[,2:(n.sample+1)]))) |
|
129 |
+ kk <- as.numeric(as.vector(as.matrix(CVCV.out2[,2:(n.sample+1),drop=FALSE]))) |
|
130 | 130 |
CVCV.out2[,2:(n.sample+1)] <- probe.ID[kk] |
131 | 131 |
|
132 | 132 |
#Remove missing columns and add seq |
... | ... |
@@ -23,7 +23,7 @@ get.mipp.lda <- function(x.train, y.train, x.test, y.test){ |
23 | 23 |
post.prob <-0 |
24 | 24 |
for(j in 1:n.class) { |
25 | 25 |
i <- which(True.class == u.class[j]) |
26 |
- post.prob <- post.prob + sum(out$post[i,j]) |
|
26 |
+ post.prob <- post.prob + sum(out$post[i,j,drop=FALSE]) |
|
27 | 27 |
} |
28 | 28 |
|
29 | 29 |
N <- length(True.class) |
... | ... |
@@ -12,7 +12,7 @@ get.mipp.svm.linear <- function(x.train, y.train, x.test, y.test){ |
12 | 12 |
|
13 | 13 |
fofx <- numeric(length(y.test)) |
14 | 14 |
for(i in 1:length(y.test)){ |
15 |
- xin <- x.test[i,] |
|
15 |
+ xin <- x.test[i,,drop=FALSE] |
|
16 | 16 |
fofx[i] <- linearkernel.decision.function(xin, x.train, fit) |
17 | 17 |
} |
18 | 18 |
|
... | ... |
@@ -41,10 +41,10 @@ linearkernel.decision.function <-function(newx, oldx, svmobj) { |
41 | 41 |
# Extract b: |
42 | 42 |
svconstant <- -1*svmobj$rho |
43 | 43 |
# Get the support vectors |
44 |
- svdata <- oldx[svmobj$index,] |
|
44 |
+ svdata <- oldx[svmobj$index,,drop=FALSE] |
|
45 | 45 |
# Reformat the new x |
46 | 46 |
xt <- newx |
47 |
- nrowxt <- length(oldx[1,]) |
|
47 |
+ nrowxt <- length(oldx[1,,drop=FALSE]) |
|
48 | 48 |
dim(xt) <- c(nrowxt,1) |
49 | 49 |
# linear kernel: |
50 | 50 |
prods <- svdata %*% xt |
... | ... |
@@ -13,7 +13,7 @@ get.mipp.svm.rbf <- function(x.train, y.train, x.test, y.test){ |
13 | 13 |
|
14 | 14 |
fofx <- numeric(length(y.test)) |
15 | 15 |
for(i in 1:length(y.test)){ |
16 |
- xin <- x.test[i,] |
|
16 |
+ xin <- x.test[i,,drop=FALSE] |
|
17 | 17 |
fofx[i] <- rbfkernel.decision.function(xin, x.train, fit) |
18 | 18 |
} |
19 | 19 |
|
... | ... |
@@ -43,11 +43,11 @@ rbfkernel.decision.function <- function(newx, oldx, svmobj) { |
43 | 43 |
# Extract gamma: |
44 | 44 |
svgamma <- svmobj$gamma |
45 | 45 |
# Get the support vectors |
46 |
- svdata <- oldx[svmobj$index,] |
|
46 |
+ svdata <- oldx[svmobj$index,,drop=FALSE] |
|
47 | 47 |
# How many support vectors? |
48 | 48 |
numsv <- length(svmobj$index) |
49 | 49 |
# reformat newx |
50 |
- p <- length(oldx[1,]) |
|
50 |
+ p <- length(oldx[1,,drop=FALSE]) |
|
51 | 51 |
xt <- matrix(0, nrow=numsv, ncol=p) |
52 | 52 |
for(i in 1:p){ |
53 | 53 |
xt[,i] <- rep(newx[i], numsv) |