clustify {clustifyr} | R Documentation

## Compare scRNA-seq data to reference data.

### Description

Compare scRNA-seq data to reference data.

### Usage

    clustify(input, ...)

    ## Default S3 method:
    clustify(
      input,
      ref_mat,
      metadata = NULL,
      cluster_col = NULL,
      query_genes = NULL,
      n_genes = 1000,
      per_cell = FALSE,
      n_perm = 0,
      compute_method = "spearman",
      verbose = TRUE,
      lookuptable = NULL,
      rm0 = FALSE,
      obj_out = TRUE,
      seurat_out = TRUE,
      rename_prefix = NULL,
      threshold = "auto",
      low_threshold_cell = 0,
      exclude_genes = c(),
      if_log = TRUE,
      organism = "hsapiens",
      plot_name = NULL,
      rds_name = NULL,
      expand_unassigned = FALSE,
      ...
    )

    ## S3 method for class 'Seurat'
    clustify(
      input,
      ref_mat,
      cluster_col = NULL,
      query_genes = NULL,
      n_genes = 1000,
      per_cell = FALSE,
      n_perm = 0,
      compute_method = "spearman",
      use_var_genes = TRUE,
      dr = "umap",
      seurat_out = TRUE,
      obj_out = TRUE,
      threshold = "auto",
      verbose = TRUE,
      rm0 = FALSE,
      rename_prefix = NULL,
      exclude_genes = c(),
      metadata = NULL,
      organism = "hsapiens",
      plot_name = NULL,
      rds_name = NULL,
      expand_unassigned = FALSE,
      ...
    )

    ## S3 method for class 'SingleCellExperiment'
    clustify(
      input,
      ref_mat,
      cluster_col = NULL,
      query_genes = NULL,
      per_cell = FALSE,
      n_perm = 0,
      compute_method = "spearman",
      use_var_genes = TRUE,
      dr = "umap",
      seurat_out = TRUE,
      obj_out = TRUE,
      threshold = "auto",
      verbose = TRUE,
      rm0 = FALSE,
      rename_prefix = NULL,
      exclude_genes = c(),
      metadata = NULL,
      organism = "hsapiens",
      plot_name = NULL,
      rds_name = NULL,
      expand_unassigned = FALSE,
      ...
    )

### Arguments

`input` | single-cell expression matrix or Seurat object
`...` | additional arguments to pass to compute_method function
`ref_mat` | reference expression matrix
`metadata` | cell cluster assignments, supplied as a vector or data.frame. If data.frame is supplied then `cluster_col` needs to be set. Not required if running correlation per cell.
`cluster_col` | column in metadata that contains cluster ids per cell. Will default to first column of metadata if not supplied. Not required if running correlation per cell.
`query_genes` | A vector of genes of interest to compare. If NULL, then common genes between the expr_mat and ref_mat will be used for comparision.
`n_genes` | number of genes limit for Seurat variable genes, by default 1000, set to 0 to use all variable genes (generally not recommended)
`per_cell` | if true run per cell, otherwise per cluster.
`n_perm` | number of permutations, set to 0 by default
`compute_method` | method(s) for computing similarity scores
`verbose` | whether to report certain variables chosen and steps
`lookuptable` | if not supplied, will look in built-in table for object parsing
`rm0` | consider 0 as missing data, recommended for per_cell
`obj_out` | whether to output object instead of cor matrix
`seurat_out` | output cor matrix or called seurat object (deprecated, use obj_out instead)
`rename_prefix` | prefix to add to type and r column names
`threshold` | identity calling minimum correlation score threshold, only used when obj_out = TRUE
`low_threshold_cell` | option to remove clusters with too few cells
`exclude_genes` | a vector of gene names to throw out of query
`if_log` | input data is natural log, averaging will be done on unlogged data
`organism` | for GO term analysis, organism name: human - 'hsapiens', mouse - 'mmusculus'
`plot_name` | name for saved pdf, if NULL then no file is written (default)
`rds_name` | name for saved rds of rank_diff, if NULL then no file is written (default)
`expand_unassigned` | test all ref clusters for unassigned results
`use_var_genes` | if providing a seurat object, use the variable genes (stored in seurat_object@var.genes) as the query_genes.
`dr` | stored dimension reduction

### Value

single cell object with identity assigned in metadata, or matrix of correlation values, clusters from input as row names, cell types from ref_mat as column names

### Examples

    # Annotate a matrix and metadata
    clustify(
        input = pbmc_matrix_small,
        metadata = pbmc_meta,
        ref_mat = cbmc_ref,
        query_genes = pbmc_vargenes,
        cluster_col = "classified",
        verbose = TRUE
    )

    # Annotate using a different method
    clustify(
        input = pbmc_matrix_small,
        metadata = pbmc_meta,
        ref_mat = cbmc_ref,
        query_genes = pbmc_vargenes,
        cluster_col = "classified",
        compute_method = "cosine"
    )

    # Annotate a Seurat object
    clustify(
        s_small3,
        cbmc_ref,
        cluster_col = "RNA_snn_res.1",
        obj_out = TRUE,
        per_cell = FALSE,
        dr = "tsne"
    )

    # Annotate (and return) a Seurat object per-cell
    clustify(
        input = s_small3,
        ref_mat = cbmc_ref,
        cluster_col = "RNA_snn_res.1",
        obj_out = TRUE,
        per_cell = TRUE,
        dr = "tsne"
    )

[Package clustifyr version 1.6.0 Index]