Skip to contents

This function will build gene vectors with count matrix and cell locations

Usage

get_gene_vectors_cm(
  cluster_info,
  cm_lst,
  bin_type,
  bin_param,
  all_genes,
  w_x,
  w_y
)

Arguments

cluster_info

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

cm_lst

A list of named matrices containing the count matrix for each sample The name must match the sample column in cluster_info. If this input is provided, the cluster_info must be specified and contain an additional column "cell_id" to link cell location and count matrix. Default is NULL.

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.

all_genes

A vector of strings giving the name of the genes you want to test. This will be used as column names for one of the result matrix gene_mt.

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 matrix contains the transcript count in each grid. Each row refers to a grid, and each column refers to a gene.