Description Usage Arguments Details See Also Examples
View source: R/spatial_distribution_report.R
Creates an HTML report visualizing the location and nearest-neighbor relations for cells of pairs of phenotypes in a single field.
1 2 3 |
cell_seg_path |
Path to a cell seg data file. |
pairs |
A list of pairs of phenotypes. Each entry is a two-element vector. The report will contain one section for each pair showing the nearest neighbor relations between the two phenotypes. |
colors |
A named list of phenotype colors to use when drawing the output. |
phenotype_rules |
(Optional) A named list.
Item names are phenotype names and must match entries in |
output_path |
Optional, path to the output HTML file. If omitted,
output will be written to the directory containing |
pixels_per_micron |
Conversion factor to microns (default 2 pixels/micron, the resolution of 20x MSI fields taken on Vectra Polaris and Vectra 3.). Set to NA to skip conversion. |
A cell seg data file for the field is required. If a tissue segmentation or composite image of the field is available, it will be used as a background.
The report is saved to the same directory as the input file.
See the tutorial
Selecting cells within a cell segmentation table
for more on
the use of pairs
and phenotype_rules
.
Other distance functions: compute_all_nearest_distance
,
count_touching_cells
,
count_within_batch
,
count_within
,
distance_matrix
,
find_nearest_distance
,
subset_distance_matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
# This example creates a report in the current user's
# home or Document directory.
cell_seg_path <- sample_cell_seg_path()
pairs <- list(
c("CK+", "CD8+"),
c("CK+", "CD68+"))
colors <- c('CK+'="cyan", "CD68+"="magenta", "CD8+"="yellow")
out_path <- path.expand('~/spatial_distribution_report.html')
spatial_distribution_report(cell_seg_path, pairs, colors,
output_path=out_path)
# This example extends the previous example to restrict tumor cells to
# only PDL1+ cells.
# Note that spatial_distribution_report uses read_cell_seg_table
# so units are removed from the expression column names.
pairs <- list(
c("CK+ PDL1+", "CD8+"),
c("CK+ PDL1+", "CD68+"))
colors <- c("CK+ PDL1+"="cyan", "CD68+"="magenta", "CD8+"="yellow")
phenotype_rules <- list(
"CK+ PDL1+"=list("CK+", ~`Entire Cell PDL1 (Opal 520) Mean`>3))
spatial_distribution_report(cell_seg_path, pairs, colors, phenotype_rules,
output_path=out_path)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.