Description Usage Arguments Value Examples
View source: R/pilot_tfe_scDesign2.R
Use scDesign2 as the generative model and generate data.
1 2 3 4 5 6 7 8 9 10 | pilot_tfe_scDesign2(
x_pilot,
y_pilot,
n0_train,
n1_train,
n0_test,
n1_test,
copula_model_0 = NULL,
copula_model_1 = NULL
)
|
x_pilot |
input variables of pilot data |
y_pilot |
labels of pilot data |
n0_train |
the number of training data of class 0 |
n1_train |
the number of training data of class 1 |
n0_test |
the number of test data of class 0 |
n1_test |
the number of test data of class 1 |
the generated data list including train_x, train_y and test_x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data_mat <- readRDS(system.file("extdata", "mouse_sie_10x.rds", package = "scDesign2"))
nonspikes <- which(!grepl("ercc", rownames(data_mat), ignore.case = TRUE))
data_mat <- data_mat[nonspikes, , drop = FALSE]
dim(data_mat)
table(colnames(data_mat))
needed_cell_type <- c("Enterocyte.Progenitor.Early", "Stem")
set.seed(1)
all_idx <- unlist(sapply(needed_cell_type, function(x) {
cell_type_idx <- which(colnames(data_mat) == x)
n_cell_total <- length(cell_type_idx)
sample(cell_type_idx, 800)
}))
allcount <- data_mat[, all_idx]
x_data = t(allcount)
y_data = c(rep(0, 800), rep(1, 800))
data = list(x_data = x_data, y_data = y_data)
pilot_rest_data = split_data(data$x_data, data$y_data, n_train = 15, seed = 1)
data_list = pilot_tfe_scDesign2(pilot_rest_data$x_train, pilot_rest_data$y_train,
n0_train = 60, n1_train = 60, n0_test = 300, n1_test = 300)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.