ElasticNet and LDA prediction for each of all the subpopulations in the new mixed population after training the model for a subpopulation in the first mixed population. The number of bootstraps to be run can be specified.

bootstrap_prediction(
  nboots = 1,
  genes = genes,
  mixedpop1 = mixedpop1,
  mixedpop2 = mixedpop2,
  c_selectID = NULL,
  listData = list(),
  cluster_mixedpop1 = NULL,
  cluster_mixedpop2 = NULL,
  trainset_ratio = 0.5,
  LDA_run = TRUE,
  verbose = FALSE,
  log_transform = FALSE
)

Arguments

nboots

a number specifying how many bootstraps to be run

genes

a gene list to build the model

mixedpop1

a SingleCellExperiment object from a mixed population for training

mixedpop2

a SingleCellExperiment object from a target mixed population for prediction

c_selectID

the root cluster in mixedpop1 to becompared to clusters in mixedpop2

listData

a list object, which contains trained results for the first mixed population

cluster_mixedpop1

a vector of cluster assignment for mixedpop1

cluster_mixedpop2

a vector of cluster assignment for mixedpop2

trainset_ratio

a number specifying the proportion of cells to be part of the training subpopulation

LDA_run

logical, if the LDA prediction is added to compare to ElasticNet

verbose

a logical whether to display additional messages

log_transform

boolean whether log transform should be computed

Value

a list with prediction results written in to the index out_idx

See also

bootstrap_parallel for parallel options

Author

Quan Nguyen, 2017-11-25

Examples

day2 <- day_2_cardio_cell_sample mixedpop1 <-new_scGPS_object(ExpressionMatrix = day2$dat2_counts, GeneMetadata = day2$dat2geneInfo, CellMetadata = day2$dat2_clusters) day5 <- day_5_cardio_cell_sample mixedpop2 <-new_scGPS_object(ExpressionMatrix = day5$dat5_counts, GeneMetadata = day5$dat5geneInfo, CellMetadata = day5$dat5_clusters) genes <-training_gene_sample genes <-genes$Merged_unique cluster_mixedpop1 <- colData(mixedpop1)[,1] cluster_mixedpop2 <- colData(mixedpop2)[,1] c_selectID <- 2 test <- bootstrap_prediction(nboots = 1, mixedpop1 = mixedpop1, mixedpop2 = mixedpop2, genes=genes, listData =list(), cluster_mixedpop1 = cluster_mixedpop1, cluster_mixedpop2 = cluster_mixedpop2, c_selectID = c_selectID)
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> Warning: variables are collinear
#> done training for bootstrap 1, moving to prediction...
names(test)
#> [1] "Accuracy" "ElasticNetGenes" "Deviance" #> [4] "ElasticNetFit" "LDAFit" "predictor_S1" #> [7] "ElasticNetPredict" "LDAPredict" "cell_results"
test$ElasticNetPredict
#> [[1]] #> [[1]][[1]] #> NULL #> #> [[1]][[2]] #> NULL #> #> [[1]][[3]] #> NULL #> #> [[1]][[4]] #> NULL #> #> [[1]][[5]] #> [1] "ElasticNet for subpop1 in target mixedpop2" #> #> [[1]][[6]] #> [1] 37.43316 #> #> [[1]][[7]] #> [1] "ElasticNet for subpop2 in target mixedpop2" #> #> [[1]][[8]] #> [1] 32.14286 #> #> [[1]][[9]] #> [1] "ElasticNet for subpop3 in target mixedpop2" #> #> [[1]][[10]] #> [1] 100 #> #> [[1]][[11]] #> [1] "ElasticNet for subpop4 in target mixedpop2" #> #> [[1]][[12]] #> [1] 82.5 #> #>
test$LDAPredict
#> [[1]] #> [[1]][[1]] #> NULL #> #> [[1]][[2]] #> NULL #> #> [[1]][[3]] #> NULL #> #> [[1]][[4]] #> NULL #> #> [[1]][[5]] #> [1] "LDA for subpop 1 in target mixedpop2" #> #> [[1]][[6]] #> [1] 94.65241 #> #> [[1]][[7]] #> [1] "LDA for subpop 2 in target mixedpop2" #> #> [[1]][[8]] #> [1] 9.285714 #> #> [[1]][[9]] #> [1] "LDA for subpop 3 in target mixedpop2" #> #> [[1]][[10]] #> [1] 87.96992 #> #> [[1]][[11]] #> [1] "LDA for subpop 4 in target mixedpop2" #> #> [[1]][[12]] #> [1] 70 #> #>