Skip to contents

filter_pe filters a Qfeatures 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_pe(
  pe,
  thr = NULL,
  missnum = NULL,
  fraction = NULL,
  filter_formula = NULL,
  assay_name = "peptideRaw",
  return_keeprows = F
)

Arguments

pe

Qfeatures, Proteomics data (output from make_pe() or make_pe_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.

assay_name

Character(1), the name of which assay to perform filter.

return_keeprows

Logical(1), default FALSE, return the trimmed object. If TURE return the rows number that pass through filter.

Value

A filtered Qfeatures object, or a vector of keep rows if return_keeprows is TRUE

Examples

# Load example peptide data
data(Silicosis_peptide)
ecols <- grep("Intensity.", colnames(Silicosis_peptide), value = TRUE)

# Construct a QFeatures object, with a 'peptideRaw' assay
pe_peptides <- make_pe_parse(Silicosis_peptide, columns = ecols, remove_prefix = TRUE, log2transform = TRUE,mode = "delim")
filt_pe <- filter_pe(pe_peptides, thr = 1,fraction = 0.4, filter_formula = ~ Reverse != '+' & Potential.contaminant !="+" )
#> filter base on missing number is <= 1 in at least one condition.
#> filter base on missing number fraction < 0.4 in each row
#> filter base on giving formula