Filter SummarizedExperiment on missing values or formula
filter_se.Rd
filter_se
filters a SummarizedExperiment object based on missing values in assay
and provides formula.
The dataset is filtered for proteins that have a maximum of
'thr' missing values in at least one condition; or a maximum of 'missnum' in all samples;
or a filter_formula
Usage
filter_se(
se,
thr = NULL,
missnum = NULL,
fraction = NULL,
filter_formula = NULL,
rowsum_threshold = NULL,
return_keeprows = FALSE
)
Arguments
- se
SummarizedExperiment, Proteomics data (output from
make_se()
ormake_se_parse()
).- thr
Integer(1), Sets the threshold for the allowed max number of missing values in at least one condition. At least in one condition, missing values number < or = 'thr'.
- missnum
Integer(1), Sets the threshold for the allowed max number among all samples, missing values number < or = 'missnum' in each row.
- fraction
A numeric from 0 to 1, threshold of missing occupancy of each row
- filter_formula
Formula or character(1). A filter expression, written as a formula.
- rowsum_threshold
A numeric, row sum of intensity(abundance) must larger than it.
- return_keeprows
Logical(1), default FALSE, return the trimmed object. If TURE return the rows number that pass through filter.
Examples
# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")
# Make SummarizedExperiment
ecols <- grep("LFQ.", colnames(data_unique))
se <- make_se_parse(data_unique, ecols, mode = "delim", sep = "_")
# Filter
stringent_filter <- filter_se(se, thr = 0, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
#> filter base on missing number is <= 0 in at least one condition.
#> filter base on giving formula
less_stringent_filter <- filter_se(se, thr = 1, missnum = 2, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
#> filter base on missing number <= 2
#> filter base on missing number is <= 1 in at least one condition.
#> filter base on giving formula
keep_rows <- filter_se(se, thr = 0, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+", return_keeprows = TRUE)
#> filter base on missing number is <= 0 in at least one condition.
#> filter base on giving formula