## Not run:
# set.seed(123)
# n <- 10 ## number of samples
# k <- 3 ## number of markers
#
# ## generate some sample data
# sid_vec <- paste0("sid_", 1:n) ## sample ids; unique names used to denote samples
# iid_vec <- rep_len( paste0("iid_", 1:(n/2) ), n ) ## individual ids
# data <- replicate(n, {
# nrow <- round(runif(1) * 1E4 + 1000)
# ncol <- k
# vals <- rexp( nrow * ncol, runif(1, 1E-5, 1E-3) )
# vals[ vals < 2000 ] <- 0
# output <- matrix(vals, nrow, ncol)
# output <- output[ apply(output, 1, sum) > 0, ]
# colnames(output) <- paste0("M", 1:k)
# return(output)
# })
# meta <- data.frame(
# sid=sid_vec,
# iid=iid_vec,
# trt=rep( c("Control", "Treatment"), each=(n/2) )
# )
#
# ## generate counts for n_s, n_u
# n_s <- CellCounts( data[1:(n/2)], Combinations(k) )
# n_u <- CellCounts( data[(n/2+1):n], Combinations(k) )
#
# ## A smaller number of iterations is used here for running speed;
# ## prefer using more iterations for a real fit
# SimpleCOMPASS(n_s, n_u, meta, "iid", "sid", iterations=100)
# ## End(Not run)
Run the code above in your browser using DataLab