Skip to contents

This function will build gene vectors based on the transcript coordinates of every gene

Usage

.get_gene_vectors_tr(
  trans_lst,
  test_genes,
  bin_type,
  bin_param,
  bin_length,
  range_list
)

Arguments

trans_lst

If specified, it is a list of named dataframes. Each dataframe refers to one sample and shows the transcript detection coordinates for each gene. Optional parameter.

test_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.

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.

bin_length

A positive integer giving the length of total bins

range_list

A named list of spatial ranges for each sample. Each element should be a list with two components: w_x and w_y, which are numeric vectors of length 2 specifying the x- and y-axis ranges (e.g., from cell or transcript coordinates). The range is calculated with 5 within the window.

Value

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