Skip to contents

Compute observation statistic for permutation framework

Usage

compute_observation(
  data,
  cluster_info,
  correlation_method = "pearson",
  all_genes = all_genes,
  bin_type,
  bin_param,
  w_x,
  w_y
)

Arguments

data

A list of matrices containing the coordinates of transcripts.

cluster_info

A dataframe/matrix containing the centroid coordinates and cluster label for each cell.The column names should include "x" (x coordinate), "y" (y coordinate), and "cluster" (cluster label).

correlation_method

A parameter pass to cor, indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated.

all_genes

A vector of strings giving the name of the genes you want to test correlation for.

bin_type

A string indicating which bin shape is to be used for vectorization. One of "square" (default), "rectangle", or "hexagon".

bin_param

A numeric vector indicating the size of the bin. If the bin_type is "square" or "rectangle", this will be a vector of length two giving the numbers of rectangular quadrats in the x and y directions. If the bin_type is "hexagonal", this will be a number giving the side length of hexagons. Positive numbers only.

w_x

a numeric vector of length two specifying the x coordinate limits of enclosing box.

w_y

a numeric vector of length two specifying the y coordinate limits of enclosing box.

Value

A named list with the following components

obs.stat

A matrix contains the observation statistic for every gene and every cluster. Each row refers to a gene, and each column refers to a cluster

gene_mt

contains the transcript count in each grid. Each row refers to a grid, and each column refers to a gene.