View source: R/select_celltypes.R
select_celltypes | R Documentation |
Select cell types to keep or exclude in the analysis. The output of this function also includes the original image size and cell count.
select_celltypes(
spe_object,
celltypes,
feature_colname = "Phenotype",
keep = TRUE
)
spe_object |
SpatialExperiment object in the form of the output of
|
celltypes |
String Vector of celltypes of keep or exclude. |
feature_colname |
String. The column that has the interested cell types. If the cells ids are used to select cells, use "Cell.ID" for this arg. |
keep |
Boolean. TRUE if vector of 'celltypes' are the cells that are going to be kept, FALSE if they are to be removed. |
A SpatialExperiment object is returned. The original image size and cell count can be accessed by 'attr(slim_spe, "original_cell_number")' and 'attr(slim_spe, "range_of_coords")', where 'slim_spe' is the output of this function.
data_subset <- select_celltypes(SPIAT::simulated_image,
celltypes = c("Tumour_marker","Immune_marker1","Immune_marker2",
"Immune_marker3","Immune_marker4"),
feature_colname = "Phenotype", keep=TRUE)
attr(data_subset, "original_cell_number") #cell number in the original image
attr(data_subset, "range_of_coords")
dim(data_subset)[2] # this is the new image cell number
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.