supporting function for runPreprocess, fastReseg_internalRef and fastReseg_flag_all_errors to get unique IDs for cells and transcripts, and convert pixel coordinates to um; when drop_original = FALSE, the function will also return original per FOV based cell ID and coordinates under columns CellId, pixel_x, pixel_y, idx_z`.
Usage
prepare_perFOV_transDF(
each_transDF,
fov_centerLocs,
prefix_vals = NULL,
pixel_size = 0.18,
zstep_size = 0.8,
transID_coln = NULL,
transGene_coln = "target",
cellID_coln = "CellId",
spatLocs_colns = c("x", "y", "z"),
invert_y = TRUE,
extracellular_cellID = NULL,
drop_original = FALSE
)Arguments
- each_transDF
data.frame for raw transcript
- fov_centerLocs
a named vector of fov 2D coordinates
- prefix_vals
a named vector of values to be used as prefix in
UMI_transIDandUMI_cellID; whenprefix_vals!= NULL, unique transcript_id would be generated fromprefix_valsandtransID_colnineach_transDF- pixel_size
the micrometer size of image pixel listed in 1st and 2nd dimension of
spatLocs_colnsofeach_transDF- zstep_size
the micrometer size of z-step for the optional 3rd dimension of
spatLocs_colnsofeach_transDF- transID_coln
the column name of transcript_ID in
transcript_df, default = NULL to use row index of transcript ineach_transDF; whenprefix_vals!= NULL, unique transcript_id would be generated fromprefix_valsandtransID_colnineach_transDF- transGene_coln
the column name of target or gene name in
each_transDF- cellID_coln
the column name of cell_ID in
each_transDF; whenprefix_colns!= NULL, unique cell_ID would be generated fromprefix_valsandcellID_colnin eachtranscript_df- spatLocs_colns
column names for 1st, 2nd and optional 3rd dimension of spatial coordinates in
each_transDF- invert_y
flag to invert y axis of local coordinates during stitching (default = TRUE)
- extracellular_cellID
a vector of cell_ID for extracellular transcripts which would be removed from the resegmention pipeline (default = NULL)
- drop_original
flag to drop original per FOV based cell ID and coordinates under columns
CellId,pixel_x,pixel_y,idx_z(default = FALSE)
Value
a list contains transcript_df for downstream process and extracellular transcript data.frame '
- intraC
a data.frame for intracellular transcript,
UMI_transIDandUMI_cellIDas column names for unique transcript_id and cell_id,targetas column name for target gene name- extraC
a data.frame for extracellular transcript, same structure as the
intraCdata.frame in returned list