filtering: Filtering of the features (or samples) with a high proportion...

filteringR Documentation

Filtering of the features (or samples) with a high proportion of NAs or a low variance

Description

Filtering of the features (or samples) with a high proportion of NAs or a low variance

Usage

filtering(
  x,
  class.c = "",
  max_na_prop.n = 0.2,
  min_variance.n = .Machine$double.eps,
  dims.vc = c("features", "samples"),
  report.c = c("none", "interactive", "myfile.txt")[2]
)

## S4 method for signature 'MultiAssayExperiment'
filtering(
  x,
  class.c = "",
  max_na_prop.n = 0.2,
  min_variance.n = .Machine$double.eps,
  dims.vc = c("features", "samples"),
  report.c = c("none", "interactive", "myfile.txt")[2]
)

## S4 method for signature 'SummarizedExperiment'
filtering(
  x,
  class.c = "",
  max_na_prop.n = 0.2,
  min_variance.n = .Machine$double.eps,
  dims.vc = c("features", "samples"),
  report.c = c("none", "interactive", "myfile.txt")[2]
)

## S4 method for signature 'MultiDataSet'
filtering(
  x,
  class.c = "",
  max_na_prop.n = 0.2,
  min_variance.n = .Machine$double.eps,
  dims.vc = c("features", "samples"),
  report.c = c("none", "interactive", "myfile.txt")[2]
)

## S4 method for signature 'ExpressionSet'
filtering(
  x,
  class.c = "",
  max_na_prop.n = 0.2,
  min_variance.n = .Machine$double.eps,
  dims.vc = c("features", "samples"),
  report.c = c("none", "interactive", "myfile.txt")[2]
)

Arguments

x

An S4 object of class SummarizedExperiment or MultiAssayExperiment

class.c

character(1): name of the column of the sample metadata giving the classification groups: the filtering will be applied on each class (default: "" meaning that there are no specific classes to consider)

max_na_prop.n

numeric(1): maximum proportion of NAs for a feature (or sample) to be kept [default: 0.2] (in case 'class.c' is provided, the maximum proportion of NAs for a feature must be achieved in at least one sample class)

min_variance.n

numeric(1): minimum variance for a feature (or sample) to be kept [default: .Machine$double.eps] (in case 'class.c' is provided, the minimum variance for a feature must be achieved in all sample classes)

dims.vc

Vector of one or two characters: dimension(s) to which the filtering should be applied; either 'features', 'samples', or c('features', 'samples')

report.c

character(1): File name with '.txt' extension for the printed results (call to sink()'); if 'interactive' (default), messages will be printed on the screen; if 'none', no verbose will be generated

Value

SummarizedExperiment or MultiAssayExperiment including the filtered data and metadata

Examples

sacurine.se <- reading(system.file("extdata/W4M00001_Sacurine-statistics", package = "phenomis"))
assay.mn <- assay(sacurine.se)
ropls::view(assay.mn)
filtering(sacurine.se)
assay.mn[assay.mn < 1e5] <- NA
ropls::view(assay.mn)
assay(sacurine.se) <- assay.mn
filtering(sacurine.se)
filtering(sacurine.se, class.c = "gender")
filtering(sacurine.se, class.c = "sampleType")
# MultiDataSet
prometis.mset <- reading(system.file("extdata/prometis", package="phenomis"))
filtering(prometis.mset)
for (set.c in names(prometis.mset)) {
eset <- prometis.mset[[set.c]]
exprs.mn <- Biobase::exprs(eset)
exprs.mn[exprs.mn < quantile(c(exprs.mn), 0.2)] <- NA
Biobase::exprs(eset) <- exprs.mn
prometis.mset <- MultiDataSet::add_eset(prometis.mset, eset, dataset.type = set.c,
                                        GRanges = NA, overwrite = TRUE, warnings = FALSE)
}
filtering(prometis.mset)

SciDoPhenIA/phenomis documentation built on June 9, 2022, 11:54 p.m.