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 4 5 6 7 | spatial_distribution_report(
cell_seg_path,
pairs,
colors,
phenotype_rules = NULL,
output_path = NULL
)
|
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 |
A cell seg data file and component data file for the field are 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_many()
,
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 32 33 34 35 | ## Not run:
# This example creates a report in the current user's
# home or Document directory. It requires the phenoptrExamples
# package, which includes extended sample data.
library(phenoptrExamples)
cell_seg_path = system.file("extdata", "samples",
"Set4_1-6plex_[16142,55840]_cell_seg_data.txt",
package = "phenoptrExamples")
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.