Skip to contents

Based on the radius with the lowest TopKAT p-value, compute a connections matrix that shows how many edges are between cells of each type at the simplicial complex constructed based on this radius.

Usage

generate_connectivity(images.df, threshold, type.column, unique.types)

Arguments

images.df

A data.frame containing the image information. See details.

threshold

Radius to generate connectivity for

type.column

The name of the column in images.df that contains the cell types

unique.types

Vector of unique cell types in the type.column

Value

Returns a connectivity matrix of dimension \(n\times n\) where \(n\) is the number of cell types, i.e. the length of unique.types

Details

images.df should contain a PID column indicating which sample each image corresponds to. It should also contain columns x and y indicating the location of each cell. Each row in images.df corresponds to a cell within each image. See the package vignettes for an example of the structure.

This function may take several minutes to run and does require a substantial amount of memory. If the memory limit is reached, consider running mem.maxVSize(vsize = x) and specify x to a large value.

Examples

require(magrittr)
#> Loading required package: magrittr
conmat <- generate_connectivity(data1.df %>% dplyr::filter(PID == 1), threshold = 10,
                                type.column = "type", unique.types = unique(data1.df$type))