Post-process a normalized assayData in an ExpressionSet object
Source:R/curatedBreastData_process.R
processExpressionSet.RdThis function Post-processes a normalized assayData in an ExpressionSet object. Is is assumed the assay data is already baseline normalized (for example, for microarray data, this could mean quantile normalized and then logged.)
Usage
processExpressionSet(
exprSet,
outputFileDirectory = "./",
numTopVarGenes,
minVarPercentile,
maxVarPercentile = 1,
minVar
)Arguments
- exprSet
expressionSet S4 object with expression (assay) data, featureData and phenoData.
- outputFileDirectory
Output file directory for messages that print status of post-processing the ExpressionSet.
- numTopVarGenes
A numeric value indicating the number of genes (features) to select; the function will only take this number of genes that have the highest variance across all genes.
- minVarPercentile
Minimum variance percentile. Must be provided in conjunction with maxVarPercentile to use percentiles to threshold genes.
- maxVarPercentile
Maximum variance percentile. Defaul is 1, i.e. 1%. Must be provided in conjunction with minVarPercentile to use percentiles to threshold genes.
- minVar
If maxVar is provided, as opposed to minVarPercentile and maxVarPercentile, genes are removed that are below a certain variance magnitude. This is helpful before running certain algorithms, such as the popular Combat batch normalization technique, that can throw errors if genes with extremely low variances are in the data matrix. May be used in conjunction with maxVar or in isolation.
Value
A post-processed S4 expressionSet. Tests are run to confirm the final S4 object is a valid ExpressionObject before it is returned.
Details
This function performs several post-processing tasks: filtering out genes and samples with high NA rates, imputing missing values, collapsing duplicated features/genes to make a unique feature list, removing any samples for which there is already a sample with the sample patient ID (duplicated samples), and filtering genes by variance. This function is a wrapper for the functions: filterAndImputeSamples(), collapseDupProbes(), removeDuplicatedPatients(), and filterGenesByVariance(). It is is run after initial dataset normalization, such as quantile normalization on microarray datasets.
Examples
#load up our datasets
curatedBreastDataExprSetList <- getCuratedBreastDataExprSetList(test=TRUE)
#just perform on one dataset as an example, GSE1379.
#take only genes that fall in
#the variance percentiles between .75 and 1
#(i.e. top 75th percentile genes by variance.)
post_procExprSet <- processExpressionSet(exprSet=
curatedBreastDataExprSetList[[1]],
outputFileDirectory = tempdir(),
minVarPercentile=.75, maxVarPercentile = 1)
#>
#> Note: this function assumes your missing values
#> are proper NAs, not "null",etc.
#> It's best to impute NA values before running this function
#> otherwise it may set averages to NA if there is 1 NA present.
#> This function just removes any genes whose key is NA.
#>
#> You may get a notification here because key (usually gene) names are
#> duplicated so it can't use them as row names.
#> That's OK, because we are immediately collapsing them into one feature.
#>
#> Starting with 30patients.
#> found no multiple samples from the same patient(s)