Package 'concordexR'

Title: Identify Spatial Homogeneous Regions with concordex
Description: Spatial homogeneous regions (SHRs) in tissues are domains that are homogenous with respect to cell type composition. We present a method for identifying SHRs using spatial transcriptomics data, and demonstrate that it is efficient and effective at finding SHRs for a wide variety of tissue types. concordex relies on analysis of k-nearest-neighbor (kNN) graphs. The tool is also useful for analysis of non-spatial transcriptomics data, and can elucidate the extent of concordance between partitions of cells derived from clustering algorithms, and transcriptomic similarity as represented in kNN graphs.
Authors: Kayla Jackson [aut, cre] , A. Sina Booeshaghi [aut] , Angel Galvez-Merchan [aut] , Lambda Moses [aut] , Alexandra Kim [ctb], Laura Luebbert [ctb] , Lior Pachter [aut, rev, ths]
Maintainer: Kayla Jackson <[email protected]>
License: Artistic-2.0
Version: 1.5.5
Built: 2024-07-24 02:45:01 UTC
Source: https://github.com/bioc/concordexR

Help Index


Identify Spatially Homogeneous Regions with concordex

Description

Compute the neighborhood consolidation matrix and identify spatial homogeneous regions.

Usage

calculateConcordex(x, ...)

## S4 method for signature 'ANY'
calculateConcordex(
  x,
  labels,
  ...,
  n_neighbors = 30,
  compute_similarity = FALSE,
  BLUSPARAM,
  BNINDEX,
  BNPARAM = KmknnParam(),
  BPPARAM = SerialParam()
)

## S4 method for signature 'SummarizedExperiment'
calculateConcordex(x, labels, ..., assay.type = "logcounts")

## S4 method for signature 'SingleCellExperiment'
calculateConcordex(x, labels, ..., use.dimred = NULL)

## S4 method for signature 'SpatialExperiment'
calculateConcordex(x, labels, ..., use.spatial = TRUE)

Arguments

x

A SpatialExperiment, SpatialFeatureExperiment, SingleCellExperiment, or SummarizedExperiment object containing a count matrix.

Otherwise, a numeric matrix-like object containing counts for observations (e.g. cells/spots) on the rows and features on the columns.

...

Other parameters passed to default method

labels

Observation labels used to compute the neighborhood consolidation matrix. Continuous or discrete labels are allowed, and typically, integer labels are assumed to be discrete.

Labels can be specified as follows:

  • A vector or matrix-like object with one entry per observation If a matrix, the observations should be on the rows and the label identifiers on the columns.

  • If x inherits from SummarizedExperiment-class, a string or character vector specifying the names of columns in colData(x) or the name of a dimensionality reduction result (see reducedDimNames)

n_neighbors

Number of neighbors to expect for each observation. Defaults to 30.

compute_similarity

Logical. Whether to return the label similarity matrix. Only useful if discrete labels are provided.

BLUSPARAM

A BlusterParam-class object specifying the clustering algorithm to use to identify spatial homogeneous regions. If this parameter is not specified, then regions are not returned. By default, this parameter is missing.

BNINDEX

A BiocNeighborIndex object containing the precomputed index information, see findKNN.

BNPARAM

A BiocNeighborParam object specifying the algorithm to use. This can be missing if BNINDEX is supplied, see findKNN.

BPPARAM

A BiocParallelParam object specifying whether and how computing the metric for numerous observations shall be parallelized (see bpparam).

assay.type

String or integer scalar indicating the assay of x containing the counts.

use.dimred

Integer or string specifying the reduced dimensions to use for construction of the k-nearest neighbor graph. Note that if this is not NULL, reduced dimensions can not be used as labels to compute the neighborhood consolidation matrix.

use.spatial

Logical, should the spatial coordinates be used to compute the k-nearest neighbor graph?

Value

A sparse matrix

Examples

example(read10xVisium, "SpatialExperiment")
library(bluster)

## Setting BLUSPARAM clusters the consolidation
## matrix into SHRs
cdx <- calculateConcordex(
  spe, "in_tissue",
  n_neighbors=10,
  BLUSPARAM=KmeansParam(3)
)

## SHRs are an attribute of the result
shr <- attr(cdx, "shr")

## The label similarity matrix can be computed
## with `compute_similarity=TRUE`
cdx <- calculateConcordex(
  spe, "in_tissue",
  n_neighbors=10,
  compute_similarity=TRUE,
  BLUSPARAM=KmeansParam(3)
)