Skip to main content

Preprocess an apb-export .h5ad file, filter by q-values and nr_peptides

Description

Reads the wide AnnData written by apb-export’s prolfqua target, drops every observation whose q-value exceeds the threshold of a layer the file carries, and sums the precursors of each peptide, counting them in nr_children. A file of peptides (MaxQuant) has no precursors to sum. The analysis configuration (hierarchy, response, q-value and children columns) comes from the file; samples and factors from annotation. Protein annotation, with protein_length and nr_tryptic_peptides when the file was exported with a FASTA, comes from the file’s var; the number of peptides per protein is counted after the q-value filter.

Usage

preprocess_APB(
  quant_data,
  fasta_file,
  annotation,
  pattern_contaminants = "^zz|^CON|Cont_",
  pattern_decoys = "^REV_|^rev",
  q_values = list(pg_qValue = 0.01, pg_qValue_experiment = 0.01),
  hierarchy_depth = 1,
  nr_peptides = 1
)

Arguments

quant_data path to the .h5ad file
fasta_file unused; the file carries its protein annotation
annotation annotation list from read_annotation
pattern_contaminants regex pattern for contaminants
pattern_decoys regex pattern for decoys
q_values named list of thresholds, one per q-value layer; an observation is kept when its value is below the threshold. A threshold for a layer the file does not carry is not applied.
hierarchy_depth hierarchy depth for aggregation
nr_peptides minimum number of peptides per protein

Value

list with lfqdata and protein annotation

Examples

library("prolfquapp")

x <- get_APB_files("data_dir/")
annotation <- readr::read_csv("data_dir/dataset.csv") |>
  prolfquapp::read_annotation(QC = TRUE)
xd <- preprocess_APB(x$data, x$fasta, annotation)
xd$lfqdata$hierarchy_counts()