### Install Development Version Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Install the latest development version of the clustifyr package directly from GitHub. ```r BiocManager::install("rnabioco/clustifyr") ``` -------------------------------- ### Install Bioconductor Version Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Install the stable version of the clustifyr package from Bioconductor. Ensure BiocManager is installed first. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("clustifyr") ``` -------------------------------- ### Get Citation for clustifyr Package Source: https://github.com/rnabioco/clustifyr/wiki/Frequently-asked-questions Use the `citation()` function to retrieve the recommended citation for the clustifyr R package. ```r citation("clustifyr") ``` -------------------------------- ### Get Assignments as Vector Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Obtain cell type assignments directly as a vector, which is useful for integrating into existing metadata dataframes or other workflows. This option bypasses object output. ```r # New output option, directly as a vector (in the order of the metadata), which can then be inserted into metadata dataframes and other workflows clustify( input = s_small, cluster_col = "RNA_snn_res.0.5", ref_mat = cbmc_ref, vec_out = TRUE )[1:10] ``` -------------------------------- ### Build Reference from UCSC Cell Browser Link Source: https://github.com/rnabioco/clustifyr/wiki/Frequently-asked-questions Use this function to build a reference dataset directly from a UCSC Cell Browser link. Ensure the link points to a valid UCSC dataset. ```r get_ucsc_reference() ``` -------------------------------- ### Run Clustifyr Shiny App Source: https://github.com/rnabioco/clustifyr/wiki/Frequently-asked-questions Launches the Clustifyr Shiny application, which allows for direct preview and use of GEO files for reference building. ```r run_clustifyr_app() ``` -------------------------------- ### Use Marker Gene Lists with Clustifyr Source: https://github.com/rnabioco/clustifyr/wiki/Frequently-asked-questions Demonstrates how to use marker gene lists as input for Clustifyr, including handling positive and negative markers and uneven marker counts per cell type. ```r # pbmc_markers as FindAllMarkers output gene list pbmc_input <- split(pbmc_markers$gene, pbmc_markers$cluster) # reference gene list that is uneven length pbmc_ref_mm <- pos_neg_marker( list(B = c("CD79A", "CD79B", "MS4A1"), NK = c("GZMB", "GNLY")) ) ``` -------------------------------- ### Calculate and Print Assignments Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Calculate correlation coefficients between input data and a reference matrix, then print the resulting cell type assignments. Requires loading the library and having input data objects defined. ```r library(clustifyr) # calculate correlation res <- clustify( input = pbmc_matrix_small, metadata = pbmc_meta$classified, ref_mat = cbmc_ref, query_genes = pbmc_vargenes ) # print assignments cor_to_call(res) ``` -------------------------------- ### Create Reference Matrix from SingleCellExperiment Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Generate a reference matrix for `clustifyr` from a SingleCellExperiment object. Specify the column in the object's colData that contains the cell identities. ```r # make reference from SingleCellExperiment objects sce_small <- sce_pbmc() object_ref( input = sce_small, # SCE object cluster_col = "cell_type" # name of column in colData containing cell identities ) ``` -------------------------------- ### Create Reference from Seurat Object Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Generates a reference profile from a Seurat object using specified cluster annotations. This is useful for downstream cell type identification. ```r s_small <- so_pbmc() s_ref <- seurat_ref( seurat_object = s_small, cluster_col = "RNA_snn_res.0.5" ) head(s_ref) ``` -------------------------------- ### Plot Assignments on Projection Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Visualize the cell type assignments on a pre-calculated projection using the results from `clustify` and the original metadata. Requires the correlation matrix and metadata object. ```r # plot assignments on a projection plot_best_call( cor_mat = res, metadata = pbmc_meta, cluster_col = "classified" ) ``` -------------------------------- ### Annotate Cells using Marker Gene Lists Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Assigns cell types to input data (matrix or SingleCellExperiment) based on provided marker gene lists and cluster metadata. Set `marker_inmatrix = FALSE` if markers are gene names, not in the input matrix. ```r clustify_lists( input = pbmc_matrix_small, metadata = pbmc_meta, cluster_col = "classified", marker = pbmc_markers, marker_inmatrix = FALSE ) ``` -------------------------------- ### Annotate Seurat Object using Marker Gene Lists Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Annotates a Seurat object directly using marker gene lists. The function returns a Seurat object with updated metadata and potentially new assays or dimensional reductions. `seurat_out = TRUE` ensures the output is a Seurat object. ```r clustify_lists( input = s_small, marker = pbmc_markers, marker_inmatrix = FALSE, cluster_col = "RNA_snn_res.0.5", seurat_out = TRUE ) ``` -------------------------------- ### Classify Seurat Object Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Use `clustify` to assign cell types to a Seurat object. The function can output the modified Seurat object with cell type assignments. Requires the Seurat package to be loaded. ```r # for Seurat library(Seurat) s_small <- so_pbmc() clustify( input = s_small, cluster_col = "RNA_snn_res.0.5", ref_mat = cbmc_ref, seurat_out = TRUE ) ``` -------------------------------- ### Classify SingleCellExperiment Object Source: https://github.com/rnabioco/clustifyr/blob/devel/README.md Use `clustify` to assign cell types to a SingleCellExperiment object. The function can directly output the modified object with cell type assignments added. ```r # for SingleCellExperiment sce_small <- sce_pbmc() clustify( input = sce_small, # anSCE object ref_mat = cbmc_ref, # matrix of RNA-seq expression data for each cell type cluster_col = "cell_type", # name of column in meta.data containing cell clusters obj_out = TRUE # output SCE object with cell type inserted as "type" column ) ``` -------------------------------- ### Extract Overlapping Genes with clustify_lists Source: https://github.com/rnabioco/clustifyr/wiki/Frequently-asked-questions Use `details_out = TRUE` in `clustify_lists()` to obtain a matrix of overlapping genes between reference and query pairs, in addition to the standard score matrix. ```r res <- clustify_lists( pbmc_ref_mm, pbmc_input, metric = "jaccard", input_markers = TRUE ) ``` ```r res <- clustify_lists( pbmc_matrix_small, metadata = pbmc_meta, cluster_col = "classified", marker = cbmc_m, details_out = TRUE ) names(res) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.