Bivariate Nearest Neighbor G(r)

bi_NN_G(
  mif,
  mnames,
  r_range = 0:100,
  num_permutations = 50,
  edge_correction = "rs",
  keep_perm_dis = FALSE,
  workers = 1,
  overwrite = FALSE,
  xloc = NULL,
  yloc = NULL
)

Arguments

mif

object of class `mif` created by function `create_mif()`

mnames

character vector of column names within the spatial files, indicating whether a cell row is positive for a phenotype

r_range

numeric vector of radii around marker positive cells which to use for G(r)

num_permutations

integer number of permutations to use for estimating core specific complete spatial randomness (CSR)

edge_correction

character vector of edge correction methods to use: "rs", "km" or "han"

keep_perm_dis

boolean for whether to summarise permutations to a single value or maintain each permutations result

workers

integer number for the number of CPU cores to use in parallel to calculate all samples/markers

overwrite

boolean whether to overwrite previous run of NN G(r) or increment "RUN" and maintain previous measurements

xloc, yloc

the x and y location columns in the spatial files that indicate the center of the respective cells

Value

object of class `mif` containing a new slot under `derived` got nearest neighbor distances

Examples

x <- spatialTIME::create_mif(clinical_data = spatialTIME::example_clinical %>% 
  dplyr::mutate(deidentified_id = as.character(deidentified_id)),
  sample_data = spatialTIME::example_summary %>% 
  dplyr::mutate(deidentified_id = as.character(deidentified_id)),
  spatial_list = spatialTIME::example_spatial[1:2],
  patient_id = "deidentified_id", 
  sample_id = "deidentified_sample")
    
mnames_good <- c("CD3..Opal.570..Positive","CD8..Opal.520..Positive",
  "FOXP3..Opal.620..Positive","PDL1..Opal.540..Positive",
  "PD1..Opal.650..Positive","CD3..CD8.","CD3..FOXP3.")
if (FALSE) {
x2 = bi_NN_G(mif = x, mnames = mnames_good[1:2], 
      r_range = 0:100, num_permutations = 10, 
      edge_correction = "rs", keep_perm_dis = FALSE, 
      workers = 1, overwrite = TRUE)
}