A function to perform initial non-spatial clustering and sub-clustering of normalised gene expression to generate 'initial clusters'.
Arguments
- spe
SpatialExperiment object. For reclust = FALSE, the object should contain logcounts and PCA, but for reculst = TRUE, the object should contain smoothed gene expression.
- dimRed
a character indicating the name of the reduced dimensions to use from the SpatialExperiment object (i.e., from reducedDimNames(spe)). Default value is 'PCA'.
- batch
a logical parameter for whether or not to perform batch correction. Default value is FALSE.
- batch_by
a character indicating name of colData(spe) column containing the batch names.
- clustParams
a list of parameters for TwoStepParam clustering methods. The clustering parameters are in the order - centers (centers) for clustering with KmeansParam, centers (centers) for sub-clustering clusters with KmeansParam, maximum iterations (iter.max) for clustering with KmeansParam, k values (k) for clustering with NNGraphParam, and community detection method (cluster.fun) to use with NNGraphParam.
Examples
data(example)
spe <- clustSIGNAL::p1_clustering(spe, dimRed = "PCA", batch = FALSE,
batch_by = "None",
clustParams = list(0, 0, 30, 5, "louvain"))
#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 01:21:08"
#> Warning: You're computing too large a percentage of total singular values, use a standard svd instead.
#> Warning: You're computing too large a percentage of total singular values, use a standard svd instead.
#> Warning: You're computing too large a percentage of total singular values, use a standard svd instead.
#> [1] "Nonspatial subclustering performed. Subclusters = 20 Time 01:21:09"
head(spe$nsCluster)
#> [1] 5 5 7 5 5 5
#> Levels: 1 2 3 4 5 6 7
head(spe$initCluster)
#> embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 embryo2_Pos29_cell128_z2
#> 5.2 5.2 7.1
#> embryo2_Pos29_cell134_z2 embryo2_Pos29_cell14_z2 embryo2_Pos29_cell141_z2
#> 5.2 5.2 5.2
#> 20 Levels: 1.1 1.2 2.1 2.2 3.1 3.2 3.3 4.1 4.2 4.3 5.1 5.2 5.3 5.4 5.5 ... 7.3