View source: R/write.sumtables.R
write.sumtables | R Documentation |
This function summarises generated results and exports them as a .csv file. It can include the calculation of median fluorescence intensity (or equivalent), proportion (%) or cell counts for clusters/subsets of interest. Makes use of the packages 'data.table' and 'tidyr' to handle the data.
make.sumtables(dat, sample.col, pop.col, measure.col, annot.col, group.col, do.proportions, cell.counts, do.mfi.per.sample, do.mfi.per.marker, perc.pos.markers, perc.pos.cutoff, mfi.type, path)
dat |
NO DEFAULT. A data.table containing cells (rows) vs features/markers (columns). One column must represent sample names, and another must represent populations/clusters. |
sample.col |
NO DEFAULT. Character. Name of the sample column (e.g. "Sample"). |
pop.col |
NO DEFAULT. Character. Name of the population/cluster column (e.g. "Population", "Cluster"). |
measure.col |
NO DEFAULT. A character or numeric vector indicating the columns to be measured (e.g. cellular columns – c("CD45", "CD3e") etc). |
annot.col |
DEFAULT = NULL. A character or numeric vector indicating the columns to be included as annotation columns (e.g. cellular columns – c("Batch", "Group") etc). If groups are present, this column must be present here also. |
group.col |
DEFAULT = NULL. Character. Which column represent groups (e.g. "Group"). This is for dividing data within the function. If you wish for groups to be included in the annotations, you will need to also include it in the annot.col argument. |
do.proportions |
DEFAULT = TRUE. Do you wish to create cell proportion and/or cell count results? |
cell.counts |
DEFAULT = NULL. If you wish to generate cell.count results, a vector of cell counts (e.g. c(1000, 1500, 2439,)) representing the cell counts in each of the samples. Must be entered in the order the that unique sample names appear in the dataset. |
do.mfi.per.sample |
DEFAULT = TRUE. Do you wish to generate MFI data (markers vs clusters) for each sample? |
do.mfi.per.marker |
DEFAULT = FALSE. Do you wish to generate MFI data (sample vs clusters) for each marker? |
perc.pos.markers |
DEFAULT = NULL. A vector of column names of calculating percent positive summary stats. |
perc.pos.cutoff |
DEFAULT = NULL. A vector of 'positive' cut-off values for the markers defined in perc.pos.markers. Must be in same order. |
mfi.type |
DEFAULT = "median". Can be "median" or "mean". Defines the type of function for calculating MFI data. |
path |
DEFAULT = getwd(). Defines the directory for write CSV files. |
Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au Felix Marsh-Wakefield, felix.marsh-wakefield@sydney.edu.au
https://sydneycytometry.org.au/spectre.
# Calculate and export results from demonstration data
Spectre::write.sumtables(dat = Spectre::demo.clustered,
sample.col = "Sample",
pop.col = "FlowSOM_metacluster",
measure.col = c(2,5:6,8:9,11:13,16:19,21:30,32),
annot.col = c(33:34,36:37),
group.col = "Group",
cell.counts = c(rep(2.0e+07, 6), rep(1.8e+07, 6)),
do.mfi.per.marker = TRUE,
perc.pos.markers = c("BV711.SCA.1","APC.BrdU"),
perc.pos.cutoff = c(580, 450)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.