#' query_multiple
#'
#' Function which takes a named list of multiple cell types, where every item is
#' a named vector with values "high"/"low" and the names correspond to the
#' markers or channels (e.g. as generated by parse_markertable).
#'
#' @param fsom FlowSOM object
#' @param ff FlowFrame used as reference for channel and marker names
#' @param cell_types Description of the cell types. Named list, with one named
#' vector per cell type containing "high"/"low" values
#' @param pdf_name Path to a pdf file to save figures
#'
#' @return A label for every FlowSOM cluster (Unknown or one of the celltype
#' names of the list, if selected by QueryStarPlot)
#' @export
#'
#' @examples
#'
#'
query_multiple <- function(fsom,
ff,
cell_types,
pdf_name,
...){
if (class(fsom) == "list" & !is.null(fsom$FlowSOM)) {
fsom <- fsom$FlowSOM
}
if (class(fsom) != "FlowSOM") {
stop("fsom should be a FlowSOM object.")
}
labels <- rep("Unknown", fsom$map$nNodes)
pdf(pdf_name,
useDingbats = FALSE)
for(cell_type in names(cell_types)){
query <- cell_types[[cell_type]]
names(query) <- get_channels(ff, names(query))
query_res <- QueryStarPlot(fsom,
query = query,
main = cell_type,
equalNodeSize = TRUE)
labels[query_res$selected] <- cell_type
}
dev.off()
return(labels)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.