Skip to contents

Update transcript data.frame based on resegmentation action, calculate the new cell type and mean per cell spatial coordinates

Usage

update_transDF_ResegActions(
  transcript_df,
  reseg_full_converter,
  score_GeneMatrix,
  transGene_coln = "target",
  cellID_coln = "cell_ID",
  celltype_coln = "cell_type",
  spatLocs_colns = c("x", "y", "z"),
  return_perCellDF = TRUE
)

Arguments

transcript_df

the data.frame of transcript to be updated

reseg_full_converter

a named converter to update the cell ID in transcript_df, cell_ID in name would be converted to cell_ID in value; discard cell_ID with value = NA

score_GeneMatrix

a gene x cell-type score matrix

transGene_coln

the column name of target or gene name in transcript_df

cellID_coln

the column name of cell_ID in transcript_df

celltype_coln

the column name of cell type in transcript_df

spatLocs_colns

column names for 1st, 2nd and optional 3rd dimension of spatial coordinates in transcript_df

return_perCellDF

flag to return gene x cell count matrix and per cell DF with updated mean spatial coordinates and new cell type

Value

a list

updated_transDF

the updated transcript_df with updated_cellID and updated_celltype column based on reseg_full_converter

perCell_DT

a per cell data.table with mean spatial coordinates and new cell type when return_perCellDF = TRUE

perCell_expression

a gene x cell count sparse matrix for updated transcript data.frame when return_perCellDF = TRUE

Details

Update transcript data.frame based on resegmentation action and get new cell type; when return_perCellDF = TRUE, return gene x cell count matrix and per cell data.frame with mean per cell spatial coordinates and new cell type.