Runs a canonical correlation analysis using a diagonal implementation of CCA. For details about stored CCA calculation parameters, see PrintCCAParams.

RunCCA(object1, object2, ...)

# S3 method for default
RunCCA(
  object1,
  object2,
  standardize = TRUE,
  num.cc = 20,
  seed.use = 42,
  verbose = FALSE,
  ...
)

# S3 method for Seurat
RunCCA(
  object1,
  object2,
  assay1 = NULL,
  assay2 = NULL,
  num.cc = 20,
  features = NULL,
  renormalize = FALSE,
  rescale = FALSE,
  compute.gene.loadings = TRUE,
  add.cell.id1 = NULL,
  add.cell.id2 = NULL,
  verbose = TRUE,
  ...
)

Arguments

object1

First Seurat object

object2

Second Seurat object.

...

Extra parameters (passed onto MergeSeurat in case with two objects passed, passed onto ScaleData in case with single object and rescale.groups set to TRUE)

standardize

Standardize matrices - scales columns to have unit variance and mean 0

num.cc

Number of canonical vectors to calculate

seed.use

Random seed to set. If NULL, does not set a seed

verbose

Show progress messages

assay1, assay2

Assays to pull from in the first and second objects, respectively

features

Set of genes to use in CCA. Default is the union of both the variable features sets present in both objects.

renormalize

Renormalize raw data after merging the objects. If FALSE, merge the data matrices also.

rescale

Rescale the datasets prior to CCA. If FALSE, uses existing data in the scale data slots.

compute.gene.loadings

Also compute the gene loadings. NOTE - this will scale every gene in the dataset which may impose a high memory cost.

add.cell.id1, add.cell.id2

Add ...

Value

Returns a combined Seurat object with the CCA results stored.

See also

merge.Seurat

Examples

data("pbmc_small") pbmc_small
#> An object of class Seurat #> 230 features across 80 samples within 1 assay #> Active assay: RNA (230 features, 20 variable features) #> 2 dimensional reductions calculated: pca, tsne
# As CCA requires two datasets, we will split our test object into two just for this example pbmc1 <- subset(pbmc_small, cells = colnames(pbmc_small)[1:40]) pbmc2 <- subset(pbmc_small, cells = colnames(x = pbmc_small)[41:80]) pbmc1[["group"]] <- "group1" pbmc2[["group"]] <- "group2" pbmc_cca <- RunCCA(object1 = pbmc1, object2 = pbmc2)
#> Warning: Fewer than 50 features used as input for CCA.
#> Running CCA
#> Warning: You're computing too large a percentage of total singular values, use a standard svd instead.
#> Merging objects
# Print results print(x = pbmc_cca[["cca"]])
#> Warning: Requested number is larger than the number of available items (16). Setting to 16.
#> CC_ 1 #> Positive: GNLY, PF4, TUBB1, SDPR, VDAC3, PPBP, PGRMC1, TREML1 #> Negative: HLA-DPB1, S100A9, S100A8, HLA-DQA1, RP11-290F20.3, CD1C, PARVB, RUFY1
#> Warning: Requested number is larger than the number of available items (16). Setting to 16.
#> CC_ 2 #> Positive: SDPR, PF4, TUBB1, RUFY1, PPBP, TREML1, HLA-DPB1, PGRMC1 #> Negative: GNLY, S100A9, S100A8, RP11-290F20.3, VDAC3, HLA-DQA1, CD1C, PARVB
#> Warning: Requested number is larger than the number of available items (16). Setting to 16.
#> CC_ 3 #> Positive: S100A9, S100A8, PPBP, TUBB1, SDPR, TREML1, PF4, PGRMC1 #> Negative: GNLY, HLA-DQA1, HLA-DPB1, CD1C, VDAC3, RUFY1, RP11-290F20.3, PARVB
#> Warning: Requested number is larger than the number of available items (16). Setting to 16.
#> CC_ 4 #> Positive: RP11-290F20.3, HLA-DQA1, VDAC3, CD1C, HLA-DPB1, PARVB, RUFY1, S100A9 #> Negative: PGRMC1, SDPR, TUBB1, TREML1, PF4, GNLY, PPBP, S100A8
#> Warning: Requested number is larger than the number of available items (16). Setting to 16.
#> CC_ 5 #> Positive: HLA-DQA1, VDAC3, CD1C, PF4, RUFY1, TUBB1, SDPR, PPBP #> Negative: RP11-290F20.3, GNLY, HLA-DPB1, S100A8, PGRMC1, S100A9, TREML1, PARVB