View source: R/missingValuesImputation_ProteinLevel.R
wrapper.impute.slsa | R Documentation |
#' This method replaces each missing value by a given value #' #' @title Deterministic imputation #' #' @param qdata An expression set containing quantitative or missing values #' #' @param metadata xxx #' #' @param values A vector with as many elements as the number of colums #' of qdata #' #' @param na.type xxx #' #' @return An imputed dataset #' #' @author Thomas Burger, Samuel Wieczorek #' #' @examples #' utils::data(Exp1_R25_pept, package='DAPARdata') #' qdata <- Biobase::exprs(Exp1_R25_pept) #' meta <- #' values <- getQuantile4Imp(qdata)$shiftedImpVal #' obj.imp.mec <- impute.detQuant(qdata, values, na.type = 'missing POV') #' obj.imp.mec <- impute.detQuant(qdata, values, na.type = 'missing MEC') #' obj.imp.na <- impute.detQuant(qdata, values, na.type = 'missing') #' #' @export #' impute.detQuant <- function(qdata, metadata, values, na.type=NULL) availablePatterns <- unname(search.metacell.tags(pattern=na.type, level=obj@experimentData@other$typeOfData)) if (is.null(na.type)) stop(paste0("'na.type' is required. Available values are:.", paste0(metacell.def(), collapse=' ')) ) else if (!(na.type level=obj@experimentData@other$typeOfData))) stop(paste0("Available values for na.type are: ", paste0(availablePatterns, collapse=' ')) )
if(missing(metadata)) stop("'metadata' is missing.")
#browser() for(i in 1:ncol(qdata)) col <- qdata[,i] ind.na.type <- match.metacell(Biobase::fData(obj)[, obj@experimentData@other$names_metacell[i]], pattern = na.type, level = obj@experimentData@other$typeOfData)
col[which(is.na(col) & ind.na.type)] <- values[i] qdata[,i] <- col return(qdata)
wrapper.impute.slsa(obj = NULL, na.type = NULL)
obj |
An object of class |
na.type |
A string which indicates the type of missing values to impute. Available values are: 'NA' (for both POV and MEC), 'POV', 'MEC'. |
This method is a wrapper to the function impute.slsa
of the package
imp4p
adapted to an object of class MSnSet
.
The Biobase::exprs(obj)
matrix with imputed values instead of missing
values.
Samuel Wieczorek
utils::data(Exp1_R25_pept, package='DAPARdata') obj <- Exp1_R25_pept[1:100] obj.slsa.pov <- wrapper.impute.slsa(obj, na.type = 'missing POV')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.