Description Usage Arguments Details Value See Also Examples
View source: R/average_counts.R
This is a batch version of count_within(). Given the path to a directory
containing cell seg data files, for each given tissue category,
pair of
'from' phenotype and 'to' phenotype, and radius, it counts the number of
'from' cells
having a 'to' cell within radius microns.
1 2 3 4 5 6 7 8 |
base_path |
Path to a directory containing at least
one |
pairs |
A list of pairs of phenotypes. Each entry is a two-element vector. The result will contain values for each pair. |
radius |
The radius or radii to search within. |
category |
Optional tissue categories to restrict both |
phenotype_rules |
(Optional) A named list.
Item names are phenotype names and must match entries in |
verbose |
If TRUE, display progress. |
The category parameter may be a single category or a list of categories.
See the tutorial
Selecting cells within a cell segmentation table
for more on
the use of pairs and phenotype_rules.
A tibble containing these columns:
slide_idSlide ID from the data files, if available.
sourceBase file name of the source file with
_cell_seg_data.txt stripped off for brevity.
categoryTissue category, if provided as a parameter, or "all".
fromFrom phenotype.
toTo phenotype.
radius, from_count, to_count,
from_with, within_meanResults from count_within for this data file and tissue category.
Other distance functions:
compute_all_nearest_distance(),
count_touching_cells(),
count_within_many(),
count_within(),
distance_matrix(),
find_nearest_distance(),
spatial_distribution_report(),
subset_distance_matrix()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | base_path <- sample_cell_seg_folder()
# Count tumor cells near macrophages, and tumor cells near CD8 separately,
# in tumor and stroma tissue categories separately.
pairs <- list(c('CK+', 'CD68+'),
c('CK+', 'CD8+'))
radius <- c(10, 25)
category <- list('Tumor', 'Stroma')
count_within_batch(base_path, pairs, radius, category)
# Count tumor cells near any T cell in all tissue categories.
# Use `phenotype_rules` to define the T cell phenotype
pairs <- c('CK+', 'T cell')
rules <- list(
'T cell'=c('CD8+', 'FoxP3+'))
count_within_batch(base_path, pairs, radius, phenotype_rules=rules)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.