Skip to contents

digest_protein() normalizes protein-like input, validates the amino-acid alphabet, applies a cleaver-compatible enzyme rule, and returns peptide coordinates in a tidy tibble. Entry point for all higher-level pepVet workflows: scoring, enzyme comparison, and batch evaluation.

Usage

digest_protein(
  sequence,
  enzyme = "trypsin",
  missed_cleavages = 1L,
  include_cleavage_efficiency = FALSE
)

Arguments

sequence

Protein input supplied as a single sequence, a named character vector of sequences, a Biostrings::AAString, a Biostrings::AAStringSet, or a path to a FASTA file. File extension is not used to detect FASTA input; any existing file that Biostrings::readAAStringSet() can parse as FASTA is accepted. NULL, length-zero, and wrong-type inputs raise pepvet_error_invalid_input; NA or an empty string raises pepvet_error_invalid_sequence. Malformed FASTA files raise a classed pepvet_error_invalid_input error. Multi-record inputs must have unique protein identifiers; duplicates raise pepvet_error_invalid_input.

enzyme

Cleavage rule name. Defaults to "trypsin". pepVet validates this against its hard-coded registry of cleaver-compatible enzyme names, including trypsin, lysc, glutamyl endopeptidase, asp-n endopeptidase, chymotrypsin-high, and thermolysin. Missing, empty, wrong-type, and unsupported values raise pepvet_error_invalid_enzyme.

missed_cleavages

Maximum number of missed cleavages to include. Must be a single non-negative integer. Defaults to 1L. Invalid values raise pepvet_error_invalid_missed_cleavages.

include_cleavage_efficiency

Logical flag indicating whether to append a cleavage_efficiency column to the peptide output. Defaults to FALSE. Trypsin-family digests receive sequence-local high/medium/low annotations; unsupported enzymes return NA in this optional column. The flag must be a single non-missing logical value; invalid values raise pepvet_error_invalid_include_cleavage_efficiency.

Value

A tibble with one row per peptide and the columns protein_id, peptide, start, end, length, and missed_cleavages. Each row represents one theoretical cleavage product for one protein under the selected enzyme rule and missed-cleavage allowance. When include_cleavage_efficiency = TRUE, the output also includes a cleavage_efficiency column. The cleavage_efficiency values are all NA for enzymes outside the trypsin family.

Details

FASTA record names are preserved as protein_id values when they are present, including irregular headers that do not use UniProt pipe formatting. Unnamed input sequences receive generated sequence_<n> IDs. Multi-record identifiers must remain unique after unnamed records receive generated IDs. Protein groups follow the supplied record order. Reordering records changes group order only; each record retains the same peptide values and coordinates. pepVet uses cleaver-compatible cleavage rules for the strict cut sites and expands missed cleavages itself so repeated peptides and overlapping ranges retain exact start and end coordinates. Peptides are returned whether or not they later count as valid in the pepVet scoring model. Validity is a separate decision controlled by score_peptides() through length_range.

When cleavage-efficiency annotations are requested, pepVet records the weakest annotated efficiency class across cleavage sites that delimit or fall within a peptide. These annotations reflect local P1-P1' sequence context only. They do not model extended subsite preferences, structural protection, or PTMs that alter cleavage behavior.

Limitations

Cleaver rules only, no structural accessibility, no PTM awareness.

See also

Examples

digest_protein("MKWVTFISLLFLFSSAYSR")
#> # A tibble: 3 × 6
#>   protein_id peptide             start   end length missed_cleavages
#>   <chr>      <chr>               <int> <int>  <int>            <int>
#> 1 sequence_1 MK                      1     2      2                0
#> 2 sequence_1 MKWVTFISLLFLFSSAYSR     1    19     19                1
#> 3 sequence_1 WVTFISLLFLFSSAYSR       3    19     17                0
digest_protein(Biostrings::AAString("MKWVTFISLLFLFSSAYSR"))
#> # A tibble: 3 × 6
#>   protein_id peptide             start   end length missed_cleavages
#>   <chr>      <chr>               <int> <int>  <int>            <int>
#> 1 sequence_1 MK                      1     2      2                0
#> 2 sequence_1 MKWVTFISLLFLFSSAYSR     1    19     19                1
#> 3 sequence_1 WVTFISLLFLFSSAYSR       3    19     17                0
digest_protein("AKRTPK", include_cleavage_efficiency = TRUE)
#> # A tibble: 5 × 7
#>   protein_id peptide start   end length missed_cleavages cleavage_efficiency
#>   <chr>      <chr>   <int> <int>  <int>            <int> <chr>              
#> 1 sequence_1 AK          1     2      2                0 medium             
#> 2 sequence_1 AKR         1     3      3                1 medium             
#> 3 sequence_1 R           3     3      1                0 medium             
#> 4 sequence_1 RTPK        3     6      4                1 medium             
#> 5 sequence_1 TPK         4     6      3                0 high