This function subsamples a matrix using either random sampling or meta cells method.
subsampling(
matrix,
subsampling_method = "sample",
subsampling_ratio = 1,
seed = 1,
verbose = TRUE,
...
)
The input matrix to be subsampled.
The method to use for subsampling. Options are "sample" or "meta_cells".
The percent of all samples used for sparse_regression
, default is 1
.
The random seed for cross-validation, default is 1
.
Logical value, default is TRUE
, whether to print progress messages.
Parameters for other methods.
The subsampled matrix.
data("example_matrix")
data("example_ground_truth")
subsample_matrix <- subsampling(
example_matrix,
subsampling_ratio = 0.5
)
#> ✔ Subsample matrix generated, dimensions: 2500 cells by 18 genes.
subsample_matrix_2 <- subsampling(
example_matrix,
subsampling_method = "meta_cells",
subsampling_ratio = 0.5,
fast_pca = FALSE
)
#> ! Warning: number of PCs of PCA result is less than the desired number, using all PCs.
#> ✔ Subsample matrix generated, dimensions: 2500 cells by 18 genes.
subsample_matrix_3 <- subsampling(
example_matrix,
subsampling_method = "pseudobulk",
subsampling_ratio = 0.5
)
#> ✔ Subsample matrix generated, dimensions: 2500 cells by 18 genes.
calculate_metrics(
inferCSN(example_matrix),
example_ground_truth,
plot = TRUE
)
#> ✔ Running for <dense matrix>.
#> ✔ Checking input parameters.
#> ✔ Using L0 sparse regression model.
#> ✔ Using 1 core.
#> ✔ Run done.
#> AUROC AUPRC ACC Precision Recall F1 JI SI
#> 1 0.963 0.495 0.944 1 0.514 0.679 0.5 18
calculate_metrics(
inferCSN(subsample_matrix),
example_ground_truth,
plot = TRUE
)
#> ✔ Running for <dense matrix>.
#> ✔ Checking input parameters.
#> ✔ Using L0 sparse regression model.
#> ✔ Using 1 core.
#> ✔ Run done.
#> AUROC AUPRC ACC Precision Recall F1 JI SI
#> 1 0.964 0.506 0.944 1 0.514 0.679 0.5 18
calculate_metrics(
inferCSN(subsample_matrix_2),
example_ground_truth,
plot = TRUE
)
#> ✔ Running for <dense matrix>.
#> ✔ Checking input parameters.
#> ✔ Using L0 sparse regression model.
#> ✔ Using 1 core.
#> ✔ Run done.
#> AUROC AUPRC ACC Precision Recall F1 JI SI
#> 1 0.959 0.47 0.948 1 0.529 0.692 0.514 18
calculate_metrics(
inferCSN(subsample_matrix_3),
example_ground_truth,
plot = TRUE
)
#> ✔ Running for <dense matrix>.
#> ✔ Checking input parameters.
#> ✔ Using L0 sparse regression model.
#> ✔ Using 1 core.
#> ✔ Run done.
#> AUROC AUPRC ACC Precision Recall F1 JI SI
#> 1 0.964 0.506 0.944 1 0.514 0.679 0.5 18