man/internal.Rd
34c73929
 % Generated by roxygen2: do not edit by hand
a5d06e36
 % Please edit documentation in R/class.R, R/classifier.R, R/support.R
34c73929
 \name{checkObjectValidity}
 \alias{checkObjectValidity}
 \alias{checkCellTypeValidity}
7e9ee09d
 \alias{checkMarkerGenesValidity}
34c73929
 \alias{checkParentValidity}
 \alias{checkPThresValidity}
adb6f19c
 \alias{checkCaretModelValidity}
34c73929
 \alias{parent<-}
a599c916
 \alias{parent<-,scAnnotatR-method}
adb6f19c
 \alias{caret_model<-}
 \alias{caret_model<-,scAnnotatR-method}
7e9ee09d
 \alias{marker_genes<-}
 \alias{marker_genes<-,scAnnotatR-method}
a212ecf0
 \alias{train_classifier_seurat}
 \alias{train_classifier_sce}
 \alias{train_classifier_from_mat}
506e25af
 \alias{preprocess_seurat_object}
 \alias{preprocess_sce_object}
a212ecf0
 \alias{test_classifier_seurat}
 \alias{test_classifier_sce}
 \alias{test_classifier_from_mat}
7114049b
 \alias{classify_cells_seurat}
 \alias{classify_cells_sce}
34c73929
 \alias{balance_dataset}
 \alias{train_func}
 \alias{transform_to_zscore}
7e9ee09d
 \alias{select_marker_genes}
34c73929
 \alias{check_parent_child_coherence}
 \alias{filter_cells}
 \alias{construct_tag_vect}
adb6f19c
 \alias{process_parent_classifier}
34c73929
 \alias{make_prediction}
 \alias{simplify_prediction}
 \alias{verify_parent}
 \alias{test_performance}
6c63e3c2
 \alias{classify_clust}
a5d06e36
 \alias{.get_cache}
 \alias{download_data_file}
499496a2
 \title{Internal functions of scAnnotatR package}
34c73929
 \usage{
 checkObjectValidity(object)
 
 checkCellTypeValidity(cell_type)
 
7e9ee09d
 checkMarkerGenesValidity(marker_genes)
34c73929
 
 checkParentValidity(parent)
 
 checkPThresValidity(p_thres)
 
adb6f19c
 checkCaretModelValidity(caret_model)
34c73929
 
 parent(classifier) <- value
 
a599c916
 \S4method{parent}{scAnnotatR}(classifier) <- value
 
adb6f19c
 caret_model(classifier) <- value
34c73929
 
adb6f19c
 \S4method{caret_model}{scAnnotatR}(classifier) <- value
a599c916
 
7e9ee09d
 marker_genes(classifier) <- value
34c73929
 
7e9ee09d
 \S4method{marker_genes}{scAnnotatR}(classifier) <- value
a599c916
 
a212ecf0
 train_classifier_seurat(
   train_obj,
   cell_type,
   marker_genes,
   parent_cell = NA_character_,
   parent_classifier = NULL,
   path_to_models = "default",
   zscore = TRUE,
   seurat_tag_slot,
   seurat_parent_tag_slot = "predicted_cell_type",
   seurat_assay,
   seurat_slot
 )
 
 train_classifier_sce(
   train_obj,
   cell_type,
   marker_genes,
   parent_cell = NA_character_,
   parent_classifier = NULL,
   path_to_models = "default",
   zscore = TRUE,
   sce_tag_slot,
   sce_parent_tag_slot = "predicted_cell_type",
   sce_assay
 )
 
 train_classifier_from_mat(
a5d06e36
   mat,
   tag,
   cell_type,
   marker_genes,
   parent_tag,
   parent_cell,
   parent_classifier,
   path_to_models,
   zscore
 )
 
506e25af
 preprocess_seurat_object(
   seurat_obj,
   seurat_assay,
   seurat_slot,
   seurat_tag_slot,
   seurat_parent_tag_slot
 )
 
 preprocess_sce_object(sce_obj, sce_assay, sce_tag_slot, sce_parent_tag_slot)
 
a212ecf0
 test_classifier_seurat(
   test_obj,
   classifier,
   target_cell_type = NULL,
   parent_classifier = NULL,
   path_to_models = "default",
   zscore = TRUE,
   seurat_tag_slot,
   seurat_parent_tag_slot = "predicted_cell_type",
   seurat_assay,
   seurat_slot
 )
 
 test_classifier_sce(
   test_obj,
   classifier,
   target_cell_type = NULL,
   parent_classifier = NULL,
   path_to_models = "default",
   zscore = TRUE,
   sce_tag_slot,
   sce_parent_tag_slot = "predicted_cell_type",
   sce_assay
 )
 
 test_classifier_from_mat(
a5d06e36
   mat,
   tag,
   classifier,
   parent_tag,
   target_cell_type,
   parent_classifier,
   path_to_models,
   zscore
 )
 
7114049b
 classify_cells_seurat(
   classify_obj,
   classifiers = NULL,
   cell_types = "all",
   chunk_size = 5000,
   path_to_models = "default",
   ignore_ambiguous_result = FALSE,
   cluster_slot,
   seurat_assay,
   seurat_slot
 )
 
 classify_cells_sce(
   classify_obj,
   classifiers = NULL,
   cell_types = "all",
   chunk_size = 5000,
   path_to_models = "default",
   ignore_ambiguous_result = FALSE,
   sce_assay,
   cluster_slot = NULL
 )
 
34c73929
 balance_dataset(mat, tag)
 
 train_func(mat, tag)
 
 transform_to_zscore(mat)
 
7e9ee09d
 select_marker_genes(mat, marker_genes)
34c73929
 
 check_parent_child_coherence(
b867bcaa
   mat,
   tag,
34c73929
   pos_parent,
   parent_cell,
   cell_type,
b867bcaa
   target_cell_type
34c73929
 )
 
b867bcaa
 filter_cells(mat, tag)
34c73929
 
b867bcaa
 construct_tag_vect(tag, cell_type)
34c73929
 
adb6f19c
 process_parent_classifier(
b867bcaa
   mat,
   parent_tag,
34c73929
   parent_cell_type,
adb6f19c
   parent_classifier,
34c73929
   path_to_models,
a212ecf0
   zscore
34c73929
 )
 
 make_prediction(mat, classifier, pred_cells, ignore_ambiguous_result = TRUE)
 
71f93b35
 simplify_prediction(meta.data, full_pred, classifiers)
34c73929
 
 verify_parent(mat, classifier, meta.data)
 
 test_performance(mat, classifier, tag)
6c63e3c2
 
 classify_clust(clusts, most_probable_cell_type)
a5d06e36
 
 .get_cache()
 
 download_data_file(verbose = FALSE)
34c73929
 }
 \arguments{
 \item{object}{The request classifier to check.}
 
 \item{cell_type}{name of cell type}
 
7e9ee09d
 \item{marker_genes}{list of selected marker genes}
34c73929
 
 \item{parent}{Classifier parent to check.}
 
 \item{p_thres}{Classifier probability threshold to check.}
 
adb6f19c
 \item{caret_model}{Classifier to check.}
34c73929
 
 \item{classifier}{classifier}
 
 \item{value}{the new classifier}
 
a212ecf0
 \item{train_obj}{SCE object}
34c73929
 
a5d06e36
 \item{parent_cell}{name of parent cell type}
34c73929
 
adb6f19c
 \item{parent_classifier}{\code{\link{scAnnotatR}} object corresponding 
34c73929
 to classification model for the parent cell type}
 
a5d06e36
 \item{path_to_models}{path to databases, or by default}
 
34c73929
 \item{zscore}{boolean indicating the transformation of gene expression 
 in object to zscore or not}
 
a212ecf0
 \item{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. 
 Expected values are string (A-Z, a-z, 0-9, no special character accepted) 
 or binary/logical, 0/"no"/F/FALSE: not being new cell type, 
 1/"yes"/T/TRUE: being new cell type.}
 
 \item{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.}
 
7114049b
 \item{seurat_assay}{name of assay to use in Seurat object}
a212ecf0
 
7114049b
 \item{seurat_slot}{type of expression data to use in Seurat object. 
 Some available types are: "counts", "data" and "scale.data".}
a212ecf0
 
 \item{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. 
 Expected values are string (A-Z, a-z, 0-9, no special character accepted) 
 or binary/logical, 0/"no"/F/FALSE: not being new cell type, 
 1/"yes"/T/TRUE: being new cell type.}
 
 \item{sce_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.}
 
7114049b
 \item{sce_assay}{name of assay to use in SCE object}
a212ecf0
 
 \item{mat}{expression matrix}
 
 \item{tag}{tag of data}
 
 \item{parent_tag}{vector, named list indicating pre-assigned/predicted 
 parent cell type}
 
506e25af
 \item{seurat_obj}{Seurat object}
 
 \item{sce_obj}{Seurat object}
 
a212ecf0
 \item{test_obj}{SCE object used for testing}
 
a5d06e36
 \item{target_cell_type}{alternative cell types (in case of testing classifier)}
 
7114049b
 \item{classify_obj}{the SCE object containing cells to be classified}
 
 \item{classifiers}{classifiers}
 
 \item{cell_types}{list of cell types containing models to be used
 for classification, only applicable if the models have been saved to package.}
 
 \item{chunk_size}{size of data chunks to be predicted separately.
 This option is recommended for large datasets to reduce running time.
 Default value at 5000, because smaller datasets can be predicted rapidly.}
 
 \item{ignore_ambiguous_result}{whether ignore ambigouous result}
 
 \item{cluster_slot}{name of slot in meta data containing cluster 
 information, in case users want to have additional cluster-level 
 prediction}
 
a5d06e36
 \item{pos_parent}{a vector indicating parent classifier prediction}
 
 \item{parent_cell_type}{name of parent cell type}
 
34c73929
 \item{pred_cells}{a whole prediction for all cells}
 
c8374b12
 \item{meta.data}{object meta data}
34c73929
 
71f93b35
 \item{full_pred}{full prediction}
 
6c63e3c2
 \item{clusts}{cluster info}
 
 \item{most_probable_cell_type}{predicted cell type}
a5d06e36
 
 \item{verbose}{logical indicating downloading the file or not}
34c73929
 }
 \value{
 TRUE if the classifier is valid or the reason why it is not
 
 TRUE if the cell type is valid or the reason why it is not.
 
7e9ee09d
 TRUE if the marker_genes is valid or the reason why it is not.
34c73929
 
 TRUE if the parent is valid or the reason why it is not.
 
 TRUE if the p_thres is valid or the reason why it is not.
 
 TRUE if the classifier is valid or the reason why it is not.
 
a599c916
 the classifier with the new parent.
 
 scAnnotatR object with the new parent
 
adb6f19c
 the classifier with the new core caret model.
34c73929
 
499496a2
 scAnnotatR object with the new trained classifier.
34c73929
 
7e9ee09d
 the classifier with the new marker genes
a599c916
 
7e9ee09d
 scAnnotatR object with the new marker genes.
34c73929
 
a212ecf0
 \code{\link{scAnnotatR}} object
 
 \code{\link{scAnnotatR}} object
 
a5d06e36
 caret trained model
 
506e25af
 a list containing: expression matrix of size n x m, n: genes, m: cells;
 a vector indicating cell type, and a vector containing parent cell type.
 
 a list containing: expression matrix of size n x m, n: genes, m: cells;
 a vector indicating cell type, and a vector containing parent cell type.
 
a212ecf0
 result of testing process in form of a list, 
 including predicted values, prediction accuracy at a probability threshold, 
 and roc curve information.
 
 result of testing process in form of a list, 
 including predicted values, prediction accuracy at a probability threshold, 
 and roc curve information.
 
a5d06e36
 model performance statistics
 
7114049b
 the input object with new slots in cells meta data
 New slots are: predicted_cell_type, most_probable_cell_type,
 slots in form of [cell_type]_p, [cell_type]_class, and clust_pred 
 (if cluster_slot was provided).
 
 the input object with new slots in cells meta data
 New slots are: predicted_cell_type, most_probable_cell_type,
 slots in form of [cell_type]_p, [cell_type]_class, and clust_pred 
 (if cluster_slot was provided).
 
34c73929
 a list of balanced count matrix
 and corresponding tags of balanced count matrix
 
 the classification model (caret object)
 
 row wise center-scaled count matrix
 
 filtered matrix
 
b867bcaa
 list of adjusted tag
34c73929
 
b867bcaa
 filtered matrix and corresponding tag
34c73929
 
 a binary vector for cell tag
 
adb6f19c
 list of cells which are positive to parent classifier
34c73929
 
 prediction
 
 simplified prediction
 
 applicable matrix
 
adb6f19c
 classifier performance
a5d06e36
 
 BiocFileCache object
 
 path to the downloaded file in cache
34c73929
 }
 \description{
499496a2
 Check if a scAnnotatR object is valid
a5d06e36
 
a212ecf0
 Train a classifier for a new cell type 
 If cell type has a parent, only available for \code{\link{scAnnotatR}}
 object as parent cell classifying model.
 
 Train a classifier for a new cell type 
 If cell type has a parent, only available for \code{\link{scAnnotatR}}
 object as parent cell classifying model.
 
a5d06e36
 Train a classifier for a new cell type from expression matrix
 and tag 
 If cell type has a parent, only available for \code{\link{scAnnotatR}}
 object as parent cell classifying model.
 
506e25af
 Preprocess Seurat object to produce expression matrix,
 tag, parent cell tag.
 
 Preprocess Seurat object to produce expression matrix,
 tag, parent cell tag.
 
a212ecf0
 Testing process when test object is of type Seurat
 
 Testing process when test object is of type SCE
 
a5d06e36
 Testing process from matrix and tag
34c73929
 }