#' returns the channel with more than one peak present.
#' It returns NA if there is only one peak present.
#'
#' @param flowfile flowframe after debris are removed.
#' @param ch channel to be checked for multiple peaks.
#' @param ph maximum peak height to be ignored. This allows
#' ignoring of tiny peaks that could
#' affect the gating process.
#'
#' @return name of channel with more than one peak
#'
#' @examples
#' flowfile_path <- system.file("extdata", "B4_18_1.fcs",
#' package = "cyanoFilter",
#' mustWork = TRUE)
#' flowfile <- flowCore::read.FCS(flowfile_path, alter.names = TRUE,
#' transformation = FALSE,
#' emptyValue = FALSE,
#' dataset = 1)
#' flowfile_nona <- cyanoFilter::noNA(x = flowfile)
#' flowfile_noneg <- cyanoFilter::noNeg(x = flowfile_nona)
#' flowfile_logtrans <- cyanoFilter::lnTrans(x = flowfile_noneg,
#' c('SSC.W', 'TIME'))
#' getChannel(flowfile_logtrans, 'RED.B.HLin', 0.05)
#'
#' @export getChannel
getChannel <- function(flowfile, ch, ph) {
ptt <- flowDensity::getPeaks(flowfile, ch, tinypeak.removal = ph)
if(length(ptt$Peaks) == 1) {
return('')
} else return(ch)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.