Generate mesh data structure from coordinates, for input to DMT analysis
Source:R/utils_initdata.R
init_data.RdCreates a mesh from point coordinates using Delauney triangulation. Stores the points, triangles, and edges for the mesh, as well as a mapping from each triangle to its associated vertices. A gene-by-cell matrix can also be included, as well as additional metadata for each point.
Usage
init_data(X, Y, counts, meta_data = NULL, meta_vars_include = c())Value
A list containing the mesh data structures:
ptsis a V-by-M data table with columnsXandYcontaining the coordinates of cells and additional metadata.trisis a F-by-4 data table containing the X,Y coordinates of each triangle's centroid in the first two columns, and area and largest height of each triangle in the last two columns.edgesis a E-by-14 data table with columnsfrom_pt,to_pt,from_tri,to_tri,x0_pt,x1_pt,y0_pt,y1_pt,x0_tri,x1_tri,y0_tri,y1_tri,length_pt,length_tri. If only one triangle uses an edge, then thefrom_tri,x0_tri, andy0_trifields will contain NaN values.tri_to_ptis a F-by-V sparse matrix with value 1 at (i,j) if triangle i uses point j as a vertex.countsis a G x V gene-by-cell matrix of transcript counts.
Note that all indices stored in these data structures are 1-indexed.