test_classifier {scClassifR} | R Documentation |
Testing process.
test_classifier( test_obj, classifier, target_cell_type = NULL, parent_clf = NULL, path_to_models = c("default", "."), zscore = TRUE, ... ) ## S4 method for signature 'Seurat,scClassifR' test_classifier( test_obj, classifier, target_cell_type = NULL, parent_clf = NULL, path_to_models = c("default", "."), zscore = TRUE, seurat_tag_slot = "active.ident", seurat_parent_tag_slot = "predicted_cell_type", seurat_assay = "RNA", seurat_slot = "counts", ... ) ## S4 method for signature 'SingleCellExperiment,scClassifR' test_classifier( test_obj, classifier, target_cell_type = NULL, parent_clf = NULL, path_to_models = c("default", "."), zscore = TRUE, sce_tag_slot = "ident", sce_parent_tag_slot = "predicted_cell_type", sce_assay = "logcounts", ... )
test_obj |
xxobject that can be used for testing |
classifier |
classification model |
target_cell_type |
vector indicating other cell types than cell labels that can be considered as the main cell type in classifier, for example, c("plasma cell", "b cell", "b cells", "activating b cell"). Default as NULL. |
parent_clf |
|
path_to_models |
path to the folder containing the list of models. As default, the pretrained models in the package will be used. If user has trained new models, indicate the folder containing the new_models.rda file. |
zscore |
boolean, whether gene expression is transformed to zscore |
... |
arguments passed to other methods |
seurat_tag_slot |
string, name of annotation slot
indicating cell tag/label in the testing object.
Strings indicating cell types are expected in this slot.
For |
seurat_parent_tag_slot |
string, name of tag slot in cell meta data indicating pre-assigned/predicted parent cell type. Default field is "predicted_cell_type". The slot must contain only string values. |
seurat_assay |
name of assay to use in
|
seurat_slot |
type of expression data to use in
|
sce_tag_slot |
string, name of annotation slot indicating cell tag/label in the testing object. Strings indicating cell types are expected in this slot. Default value is "ident". Expected values are string or binary/logical, 0/"no"/F/FALSE: not being new cell type, 1/"yes"/T/TRUE: being new cell type. |
sce_parent_tag_slot |
string, name of tag slot in cell meta data indicating pre-assigned/predicted parent cell type. Default is "predicted_cell_type". The slot must contain only string values. |
sce_assay |
name of assay to use in |
result of testing process in form of a list, including predicted values, prediction accuracy at a probability threshold, and roc curve information.
Only one cell type is expected for each cell. Ambiguous cell type, such as: "T cells/NK cells/ILC", will be ignored. Subtypes used in testing model for parent cell types can be indicated as parent cell type, or can be indicated in target_cell_type. For example, when testing for B cells, plasma cells can be annotated as B cells, or target_cell_type is set c("plasma cells").
# load small example dataset data("tirosh_mel80_example") # train the classifier selected_features_B = c("CD19", "MS4A1", "CD79A") set.seed(123) clf_b <- train_classifier(train_obj = tirosh_mel80_example, features = selected_features_B, cell_type = "B cells") # test the classifier, target cell type can be in other formats or # alternative cell type that can be considered as the classified cell type clf_b_test <- test_classifier(test_obj = tirosh_mel80_example, classifier = clf_b, target_cell_type = c("B cell")) clf_b_test