wrapper.impute.slsa: Imputation of peptides having no values in a biological...

View source: R/missingValuesImputation_ProteinLevel.R

wrapper.impute.slsaR Documentation

Imputation of peptides having no values in a biological condition.

Description

#' 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)

Usage

wrapper.impute.slsa(obj = NULL, na.type = NULL)

Arguments

obj

An object of class MSnSet.

na.type

A string which indicates the type of missing values to impute. Available values are: 'NA' (for both POV and MEC), 'POV', 'MEC'.

Details

This method is a wrapper to the function impute.slsa of the package imp4p adapted to an object of class MSnSet.

Value

The Biobase::exprs(obj) matrix with imputed values instead of missing values.

Author(s)

Samuel Wieczorek

Examples

utils::data(Exp1_R25_pept, package='DAPARdata')
obj <- Exp1_R25_pept[1:100]
obj.slsa.pov <- wrapper.impute.slsa(obj, na.type = 'missing POV')


samWieczorek/DAPAR documentation built on May 6, 2022, 5:30 p.m.