View source: R/extract_spatial_summary.R
extract_spatial_summary | R Documentation |
Summarise spatial data in mxFDA object
extract_spatial_summary(mxFDAobject, columns, grouping_columns = NULL)
mxFDAobject |
object of class |
columns |
character vector for column heading for cells to summarise |
grouping_columns |
character vector of other columns to use as grouping, such as region classification column |
Currently this function is experimental as it only handles data that has text in the columns. Eventually, will be able to handle any data inputs such as those from HALO where cells are designated as positive (1) or negative (0) for a cell phenotypes.
data frame with percent of total points per spatial sample columns
.
If multiple levels are present in columns
columns, multiple output columns will be provided.
Alex Soupir alex.soupir@moffitt.org
#load data
data(lung_df)
#create data frames for `mxFDA` object
clinical = lung_df %>%
dplyr::select(image_id, patient_id, patientImage_id, gender,
age, survival_days, survival_status, stage) %>%
dplyr::distinct()
#make small, just need to make sure it runs
spatial = lung_df %>%
dplyr::select(-image_id, -gender, -age, -survival_days, -survival_status, -stage) %>%
dplyr::filter(patientImage_id %in% clinical$patientImage_id[1:10])
#create `mxFDA` object
mxFDAobject = make_mxfda(metadata = clinical,
spatial = spatial,
subject_key = "patient_id",
sample_key = "patientImage_id")
#get markers
markers = colnames(mxFDAobject@Spatial) %>%
grep("pheno", ., value = TRUE)
#extract summary
df = extract_spatial_summary(mxFDAobject, markers)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.