Keep only the parents with enough children
Source:R/tidyMS_data_setup.R
filter_proteins_by_peptide_count.RdKeeps the rows of the parent entries (e.g. proteins) with at least
threshold distinct child entries (e.g. peptides), counted by
nr_B_in_A(), and adds that count. By default it counts the second
hierarchy level within the first, independent of hierarchy_depth. The
package dataset data_ionstar calls it as (pdata, config) from its
filtered() method.
Usage
filter_proteins_by_peptide_count(
pdata,
config,
parent = config$hierarchy_keys()[1],
child = config$hierarchy_keys()[2],
threshold = config$min_peptides_protein
)See also
Other preprocessing:
INTERNAL_FUNCTIONS_BY_FAMILY,
nr_B_in_A()
Examples
istar <- prolfqua::sim_lfq_data_peptide_config()
#> `protein_Id`: columns `proteinID`, `idtype2` united with separator '~'.
#> creating sampleName from file_name column
#> setup_analysis: dropped 6 unconfigured columns: average_prot_abundance, sd, mean, N, avg_peptide_abd, Replicate.
#> setup_analysis: added 36 rows with NA response for feature and sample combinations absent from the input.
filtered <- prolfqua:::filter_proteins_by_peptide_count(
istar$data, istar$config, parent = "protein_Id", child = "peptide_Id", threshold = 2
)
stopifnot(all(filtered$data[[filtered$name]] >= 2))