R/filterData.R

Defines functions filterData

Documented in filterData

#' Filter datasets according to no. features present in features with at least a certain depth.
#' 
#' Filter the data based on the number of present features after filtering samples by depth of coverage.
#' There are many ways to filter the object, this is just one way.
#' 
#' @param obj A MRexperiment object or count matrix.
#' @param present Features with at least 'present' postive samples.
#' @param depth Sampls with at least this much depth of coverage
#' @return A MRexperiment object.
#' @export
#' @examples
#' 
#' data(mouseData)
#' filterData(mouseData)
#' 
filterData <- function(obj,present=1,depth=1000){
    mat = returnAppropriateObj(obj,norm=FALSE,log=FALSE)>0
	cols = which(colSums(MRcounts(obj))>=depth)
	rows = which(rowSums(mat[,cols])>=present)
	return(obj[rows,cols])
}

Try the metagenomeSeq package in your browser

Any scripts or data that you put into this service are public.

metagenomeSeq documentation built on Nov. 8, 2020, 5:34 p.m.