plot_nearest_neighbor {IrisSpatialFeatures} | R Documentation

## Plot average nearest neighbor barplots for two cell types. This measurement is not symmetric, so if 'from' and 'to' are switched it will result in different results. For the 'to' parameter this function allows a cell-type without '+' or '-' in the end. Indicating that the distances from the first cell-type should be calculated against both '+/-' and a paired t-test should be calculated. For example we want to calculate the average distance between SOX10 PDL1+ melanoma cells against both CD8 PD1+ and CD8 PD1- cells, the 'CD8 PD1' would be speficified as 'to' parameter, 2 distances would be calculated for each sample and a two-sided paired t-test calculated to test for significant differences.

### Description

Plot average nearest neighbor barplots for two cell types. This measurement is not symmetric, so if 'from' and 'to' are switched it will result in different results. For the 'to' parameter this function allows a cell-type without '+' or '-' in the end. Indicating that the distances from the first cell-type should be calculated against both '+/-' and a paired t-test should be calculated. For example we want to calculate the average distance between SOX10 PDL1+ melanoma cells against both CD8 PD1+ and CD8 PD1- cells, the 'CD8 PD1' would be speficified as 'to' parameter, 2 distances would be calculated for each sample and a two-sided paired t-test calculated to test for significant differences.

### Usage

    plot_nearest_neighbor(x, ...)

    ## S4 method for signature 'ImageSet'
    plot_nearest_neighbor(x, from, to, ttest = TRUE,
      transposed = FALSE, remove_NAs = FALSE, use_pixel = FALSE)

### Arguments

`x` | IrisSpatialFeatures ImageSet object.
`...` | Additional arguments.
`from` | Cell-type from which the nearest neighbor is calculated.
`to` | Cell-type to which the nearest neighbor is calculated.
`ttest` | Flag indicating whether a paired t-test should be calculated. (default: TRUE)
`transposed` | Switches 'from' and 'to' cell-type. This way the (default: FALSE)
`remove_NAs` | dont plot samples with less than min cells
`use_pixel` | show the distances in pixels or micrometers (default: FALSE)

### Value

plot average nearest neighbor barplots for two cell types

### Examples

    #loading pre-read dataset
    dataset <- IrisSpatialFeatures_data
    dataset <- extract_nearest_neighbor(dataset)
    p <- plot_nearest_neighbor(dataset,'CD8+ PD1+','SOX10+ PDL1')

[Package IrisSpatialFeatures version 1.3.0 Index]