Skip to contents

batch_compare_enzymes() scores every protein in sequences against each enzyme in enzymes and returns a tidy tibble with one row per protein-enzyme pair. The input proteome is parsed once; each enzyme then calls batch_evaluate() with cores workers that split proteins into equal chunks processed via fork copy-on-write (parallel::mclapply). This means cores workers are fully utilised regardless of how many enzymes are compared, and the speedup applies equally to single-enzyme calls.

Usage

batch_compare_enzymes(
  sequences,
  enzymes = c("trypsin", "lysc", "chymotrypsin-high", "asp-n endopeptidase",
    "arg-c proteinase"),
  cores = 1L,
  missed_cleavages = 1L,
  proteome = NULL,
  weights = NULL,
  ...
)

Arguments

sequences

Multi-protein input. Accepts the same forms as digest_protein(). Must resolve to at least one protein. If NULL or empty, raises an error.

enzymes

Character vector of unique enzyme names to compare. Each name must be one of pepVet's supported enzyme names. Defaults to a panel of five commonly compared enzymes: trypsin, lysc, chymotrypsin-high, asp-n endopeptidase, and arg-c proteinase.

cores

Number of parallel workers passed to batch_evaluate() for each enzyme. Proteins are split into cores equal chunks and processed with parallel::mclapply() on Unix or parallel::parLapply() on Windows. Enzymes are always processed sequentially.

missed_cleavages

Maximum missed cleavages passed to batch_evaluate() for every enzyme. Defaults to 1L.

proteome

Optional proteome digest tibble passed to batch_evaluate() for every enzyme. When NULL (default), no uniqueness scoring and the S_unique column is omitted.

weights

Optional scoring weight vector passed to batch_evaluate(). When NULL (default), uses pepVet's default scoring weights.

...

Additional scoring arguments passed to batch_evaluate(), such as gravy_range and length_range.

Value

A tibble of class pepvet_batch_comparison with one row per protein-enzyme pair. Columns: protein_id, enzyme (factor ordered by the input enzymes vector, so ggplot2 axis and facet order matches your specification), then all columns returned by batch_evaluate(): protein_length, n_peptides, n_valid_peptides, component scores, composite_score, verdict, median_peptide_length, and the four difficulty flags. Printing shows a per-enzyme summary table before the tibble rows.

Limitations

Enzymes run sequentially even when cores > 1; only proteins within each enzyme are parallelized. Windows socket workers serialize the input for each enzyme, so their memory and startup costs differ from Unix fork workers.

Examples

small <- system.file(
  "extdata", "small_proteome_50_proteins.fasta",
  package = "pepVet"
)
result <- batch_compare_enzymes(small, enzymes = c("trypsin", "lysc"))
#> Scoring 50 proteins against 2 enzymes.
#> Warning: Protein "sp|P08246|ELNE_HUMAN Neutrophil elastase OS=Homo sapiens OX=9606
#> GN=ELANE PE=1 SV=1" has no cleavage sites for "lysc". S_count and composite
#> score set to 0; verdict set to Poor.
result
#> pepVet batch enzyme comparison: 50 proteins x 2 enzymes
#> 
#> # A tibble: 2 × 6
#>   enzyme      n med_score pct_good pct_moderate pct_poor
#>   <chr>   <int>     <dbl>    <dbl>        <dbl>    <dbl>
#> 1 trypsin    50     0.718       80           18        2
#> 2 lysc       50     0.541       24           62       14
#> 
#> 100 rows total (50 proteins x 2 enzymes).
result[result$enzyme == "trypsin", c("protein_id", "composite_score")]
#> # A tibble: 50 × 2
#>    protein_id                                                    composite_score
#>    <chr>                                                                   <dbl>
#>  1 sp|O15162|PLS1_HUMAN Phospholipid scramblase 1 OS=Homo sapie…           0.624
#>  2 sp|O15393|TMPS2_HUMAN Transmembrane protease serine 2 OS=Hom…           0.683
#>  3 sp|O60502|OGA_HUMAN Protein O-GlcNAcase OS=Homo sapiens OX=9…           0.746
#>  4 sp|O75475|PSIP1_HUMAN PC4 and SFRS1-interacting protein OS=H…           0.736
#>  5 sp|O75970|MPDZ_HUMAN Multiple PDZ domain protein OS=Homo sap…           0.724
#>  6 sp|O95273|CCDB1_HUMAN Cyclin-D1-binding protein 1 OS=Homo sa…           0.563
#>  7 sp|O95905|ECD_HUMAN Protein ecdysoneless homolog OS=Homo sap…           0.709
#>  8 sp|P01889|HLAB_HUMAN HLA class I histocompatibility antigen,…           0.739
#>  9 sp|P01911|DRB1_HUMAN HLA class II histocompatibility antigen…           0.742
#> 10 sp|P04439|HLAA_HUMAN HLA class I histocompatibility antigen,…           0.744
#> # ℹ 40 more rows