| Type: | Package |
| Title: | Minimal Protein Set Explaining Peptide Spectrum Matches |
| Version: | 0.5.0 |
| Description: | Determine the minimal set of proteins that explains the peptide spectrum matches (PSMs) of a mass spectrometry experiment, using a greedy parsimony algorithm. Annotate peptides with the proteins they match in 'FASTA' sequence databases, and create 'FASTA' databases with reversed decoy sequences and contaminant proteins. Compute and plot the coverage of protein sequences by the matched peptides. Estimate the false discovery rate (FDR) of target-decoy search results at the PSM, precursor, peptide and protein level, following Elias and Gygi (2007) <doi:10.1038/nmeth1019> and Käll et al. (2008) <doi:10.1021/pr700600n>. Compute variable precursor isolation windows for data-independent acquisition (DIA) from the distribution of precursor (MS1) masses. |
| License: | GPL-3 |
| Copyright: | See file COPYRIGHTS |
| Encoding: | UTF-8 |
| Language: | en-US |
| Imports: | AhoCorasickTrie, ggplot2, graphics, R6, stats, utils |
| Suggests: | altdoc, docopt, dplyr (≥ 1.1.0), knitr, rmarkdown, testthat (≥ 3.2.0), withr |
| URL: | https://prolfqua.github.io/prozor/, https://github.com/prolfqua/prozor |
| BugReports: | https://github.com/prolfqua/prozor/issues |
| Depends: | R (≥ 4.4.0) |
| VignetteBuilder: | knitr |
| LazyData: | true |
| LazyDataCompression: | xz |
| Config/roxygen2/version: | 8.1.1 |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-11-25 18:39:37 UTC; wolski |
| Author: | Witold Wolski |
| Maintainer: | Witold Wolski <wewolski@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-26 08:20:16 UTC |
prozor: Minimal Protein Set Explaining Peptide Spectrum Matches
Description
Determine the minimal set of proteins that explains the peptide spectrum matches (PSMs) of a mass spectrometry experiment, using a greedy parsimony algorithm. Annotate peptides with the proteins they match in 'FASTA' sequence databases, and create 'FASTA' databases with reversed decoy sequences and contaminant proteins. Compute and plot the coverage of protein sequences by the matched peptides. Estimate the false discovery rate (FDR) of target-decoy search results at the PSM, precursor, peptide and protein level, following Elias and Gygi (2007) doi:10.1038/nmeth1019 and Käll et al. (2008) doi:10.1021/pr700600n. Compute variable precursor isolation windows for data-independent acquisition (DIA) from the distribution of precursor (MS1) masses.
FASTA databases
read_fasta() and write_fasta() read and write protein sequences. create_fgcz_fasta_db() builds a database
from a directory of FASTA files with create_decoy_db(), which adds contaminants from load_contaminants() and
reversed decoys from reverse_seq(); make_fasta_summary() summarizes it. remove_signal_peptide() cuts signal
peptides off UniProt sequences. See vignette("CreatingDecoyDB", package = "prozor").
Peptide annotation and protein inference
annotate_peptides() finds the proteins that contain each peptide, with annotate_aho().
greedy_parsimony() finds the minimal set of proteins that explains the peptides, and greedy_to_table() turns
its result into a table. See vignette("PeptideAnnotationwithProzor", package = "prozor").
Sequence coverage
residue_coverage() and sequence_coverage() compute the peptide coverage of each residue and each protein from
the result of annotate_peptides(); plot_coverage() plots it for one protein. See
vignette("ProteinCoverage", package = "prozor").
Target-decoy FDR
TargetDecoyFDR estimates the false discovery rate and the q-values of target-decoy search results, finds the
score cut-off for a given FDR, and plots the score distributions and q-values. See
vignette("TargetDecoyFDR_Example", package = "prozor") and vignette("TargetDecoyComet", package = "prozor").
DIA windows
Cdsw computes precursor isolation windows with about equal numbers of precursors from the MS1 masses;
readjust_windows() moves their boundaries to regions with few precursors, and plot_windows() shows them. See
vignette("cdsw", package = "prozor").
Author(s)
Maintainer: Witold Wolski wewolski@gmail.com (ORCID)
Authors:
Witold Wolski wewolski@gmail.com (ORCID)
Other contributors:
Jonas Grossmann (ORCID) [contributor]
Functional Genomics Center Zurich (ROR) [funder]
University of Zurich (ROR) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/prolfqua/prozor/issues
Compute dynamic SWATH (DIA) windows
Description
An R6 class that splits the MS1 mass range into n_bins windows with about equal numbers of precursors. The window
boundaries (breaks) are computed once, when the object is created, with one of three methods:
-
"mixture"(default): the quantile breaks of the masses mixed with uniformly spread data, with the smallest share of uniform data that keeps all window widths within[min_window, max_window]; the quantile breaks themselves if they fit. The limits hold for the rounded and padded breaks. Stops if even windows of equal width violate the limits. -
"quantile": windows with equal numbers of masses, of any width. -
"constant": windows of equal width.
The breaks are rounded to digits decimals, and the outer breaks are rounded outward and padded by 1 / 10^digits,
so that the windows enclose all masses.
The object cannot be changed: its fields are read-only and its methods only read them, so their results do not
depend on the order in which they are called. To compare methods or settings, create one object for each.
clone() copies an object.
Value
Cdsw$new() returns a Cdsw R6 object; see Methods.
Active bindings
massesMS1 masses (read-only).
n_binsNumber of windows (read-only).
methodMethod that placed the breaks (read-only).
breaksWindow boundaries,
n_bins + 1values (read-only).
Methods
Public methods
Cdsw$new()
Compute the breaks of n_bins windows over the masses with method.
Usage
Cdsw$new(
masses,
n_bins = 25,
method = c("mixture", "quantile", "constant"),
max_window = 150,
min_window = 5,
digits = 2
)
Arguments
massesMS1 masses (m/z): a numeric vector of finite values.
n_binsNumber of windows.
methodHow to place the breaks:
"mixture"(default),"quantile"or"constant"; see Description.max_window, min_windowLargest and smallest window width in m/z; used by
method = "mixture"only.digitsNumber of decimal places of the breaks.
Returns
A new Cdsw object.
Cdsw$print()
Print the number of masses and windows, the method and the range of window widths.
Usage
Cdsw$print(...)
Arguments
...Not used.
Returns
The object, invisibly.
Cdsw$as_table()
The windows as a data frame.
Usage
Cdsw$as_table(overlap = 1)
Arguments
overlapOverlap of neighboring windows in m/z, at least 0: each window is widened by
overlap / 2on both sides.
Returns
A data frame with one row per window: start from, end to, center mid, width and the number of
precursors with from < m/z <= to (n_precursors).
Cdsw$error()
Deviation of the windows from equal numbers of precursors.
Usage
Cdsw$error()
Returns
A list with manhattan (Manhattan distance), euclidean (Euclidean distance), normalized_counts
(precursors per window) and equal_counts (the counts of windows with equal numbers of precursors), both
counts normalized to length 1.
Cdsw$optimize_windows()
Move window starts and ends to regions with few precursors, with readjust_windows().
Usage
Cdsw$optimize_windows(bin_width = 0.1, min_count = 15, overlap = 1)
Arguments
bin_widthWidth of the bins (m/z) into which the masses are binned.
min_countBins with fewer than
min_countprecursors count as empty.overlapOverlap of neighboring windows in m/z, as in
as_table().
Returns
A data frame with the columns of as_table().
Cdsw$plot()
Plot the precursors per window (from < m/z <= to); the dashed line marks equal counts.
Usage
Cdsw$plot()
Returns
A ggplot object.
Cdsw$plot_breaks()
Plot the breaks of this object against the constant and quantile breaks of the same masses.
Usage
Cdsw$plot_breaks()
Returns
A ggplot object.
Cdsw$plot_cycle()
Plot the DIA cycle, one window per step.
Usage
Cdsw$plot_cycle(overlap = 1)
Arguments
overlapOverlap of neighboring windows in m/z, as in
as_table().
Returns
A ggplot object.
Cdsw$clone()
The objects of this class are cloneable with this method.
Usage
Cdsw$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
Other DIA windows:
masses,
plot_windows(),
readjust_windows()
Examples
data(masses)
cdsw <- Cdsw$new(masses, max_window = 100)
cdsw
cdsw$plot_breaks()
cdsw$plot()
head(cdsw$as_table())
head(cdsw$optimize_windows())
cdsw$plot_cycle()
# one object per method
quantile_windows <- Cdsw$new(masses, method = "quantile")
c(mixture = cdsw$error()$manhattan, quantile = quantile_windows$error()$manhattan)
Target-decoy false discovery rate
Description
An R6 class that estimates the false discovery rate (FDR) of target-decoy search results. When the object is created, the hits are sorted from best to worst score and two FDR estimates are computed at each score:
-
fdr_concatenated: the FDR of a concatenated target-decoy search, estimated as 2 * decoys / all hits (Elias and Gygi 2007). -
fdr_simple: the FDR estimated as decoys / targets (Käll et al. 2008).
Both estimates are fractions in [0, 1]: values above 1, e.g. where the best hits are decoys, are set to 1.
The q-value of a hit is the lowest FDR at which it is accepted: the smallest estimate at its own or any worse score. The estimate at a score counts all hits with that score or a better one, so tied hits share their estimates and q-values, whatever the input order; within a tie, decoys are listed before targets.
The decoys are given as logical flags. For protein IDs whose decoys start with REV_, pass
decoy_hit = grepl("^REV_", id), and id = id to keep the IDs in table.
The object cannot be changed: its fields are read-only and its methods only read them. clone() copies an object.
See vignette("TargetDecoyFDR_Example", package = "prozor").
Value
TargetDecoyFDR$new() returns a TargetDecoyFDR R6 object; see Methods.
Active bindings
larger_betterTRUEif a larger score is better (read-only).nNumber of hits (read-only).
tableThe hits from best to worst score, as a data frame (read-only) with the columns:
-
order: the position of the hit in the input. -
id: the ID of the hit; only whenidwas given. -
score,decoy_hit: the sorted input. -
fdr_concatenated,fdr_simple: the FDR estimates at the score, as fractions in [0, 1]. -
q_value_fdr_concatenated,q_value_fdr_simple: the q-values of both estimates, as fractions in [0, 1].
-
Methods
Public methods
TargetDecoyFDR$new()
Sort the hits from best to worst score and compute both FDR estimates and their q-values.
Usage
TargetDecoyFDR$new(score, decoy_hit, larger_better = TRUE, id = NULL)
Arguments
scoreSearch engine scores, at least one, without
NA.decoy_hitLogical,
TRUEfor decoy hits, one per score, withoutNA.larger_betterTRUEif a larger score is better,FALSEif a smaller score is better.idIDs of the hits, e.g. protein IDs, one per score;
NULL(default) for none.
Returns
A new TargetDecoyFDR object.
TargetDecoyFDR$print()
Print the numbers of hits and decoys, larger_better, and the scores at fdr_simple q-values of 0.01 and 0.05
(none if no score reaches them).
Usage
TargetDecoyFDR$print(...)
Arguments
...Not used.
Returns
The object, invisibly.
TargetDecoyFDR$score_at()
Find the score cut-off for a given FDR.
Usage
TargetDecoyFDR$score_at(
q_value = 0.01,
method = c("fdr_simple", "fdr_concatenated")
)
Arguments
q_valueThe FDR as a fraction, like the q-values in
table:0.01for 1 %.methodThe FDR estimate to use:
"fdr_simple"(default) or"fdr_concatenated".
Returns
The least strict score whose q-value is at most q_value. An error if no score reaches it.
TargetDecoyFDR$plot()
Plot the score distributions and q-values: two panels on a shared score axis, the histogram of target and decoy scores, and the q-values of both FDR estimates in percent. When smaller scores are better and all scores are positive, the score axis is logarithmic. Every hit is drawn: one million hits take about 2 s to render as PDF and 20 s as PNG.
Usage
TargetDecoyFDR$plot(bins = 100)
Arguments
binsNumber of histogram bins.
Returns
A ggplot object.
TargetDecoyFDR$clone()
The objects of this class are cloneable with this method.
Usage
TargetDecoyFDR$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Elias JE, Gygi SP (2007). Target-decoy search strategy for increased confidence in large-scale protein identifications by mass spectrometry. Nature Methods, 4(3), 207-214. doi:10.1038/nmeth1019
Käll L, Storey JD, MacCoss MJ, Noble WS (2008). Assigning significance to peptides identified by tandem mass spectrometry using decoy databases. Journal of Proteome Research, 7(1), 29-34. doi:10.1021/pr700600n
See Also
Other FDR:
bcd,
fdr_sample
Examples
data(fdr_sample)
# smaller scores are better; decoy IDs start with REV_
fdr <- TargetDecoyFDR$new(
fdr_sample$score,
decoy_hit = grepl("^REV_", fdr_sample$protein_id),
larger_better = FALSE,
id = fdr_sample$protein_id
)
fdr
head(fdr$table)
fdr$score_at(q_value = 0.01)
fdr$score_at(q_value = 0.01, method = "fdr_concatenated")
fdr$plot()
# larger scores are better
fdr2 <- TargetDecoyFDR$new(
fdr_sample$neg_log10_score,
decoy_hit = grepl("^REV_", fdr_sample$protein_id)
)
fdr2$score_at(q_value = 0.01)
fdr2$plot()
Find peptides in protein sequences with the Aho-Corasick algorithm
Description
Searches all peptides at once with AhoCorasickTrie::AhoCorasickSearch(). Peptides that occur in no protein
are dropped.
Usage
annotate_aho(peptides, fasta, peptide = "peptide_seq")
Arguments
peptides |
Peptide sequences: upper-case letters only, without whitespace or modifications.
|
fasta |
A list of protein sequences with unique names, as returned by |
peptide |
Name of the result column that holds the peptide sequences. |
Details
The protein sequences are searched in upper case, with each character other than a letter, such as the stop
codon * of a translated database or a blank, replaced by X. The offsets are those of the sequences in fasta.
Value
A data frame with one row per occurrence and the columns protein_id, peptide (named by the
argument), offset (1-based start of the peptide) and protein_sequence (the sequence as searched); with 0
rows if no peptide occurs.
See Also
Other protein inference:
annotate_peptides(),
greedy_parsimony(),
greedy_to_table(),
pepprot,
protpepmetashort
Examples
file <- system.file("extdata/IDResults.txt.gz", package = "prozor")
peptides <- unique(utils::read.delim(file)$peptideSeq)
fasta_file <- system.file("p1000_db1_example/Annotation_canSeq.fasta.gz", package = "prozor")
fasta <- read_fasta(fasta_file)
hits <- annotate_aho(peptides[1:20], fasta)
dim(hits)
Annotate peptides with the proteins that contain them
Description
Finds every occurrence of each peptide in fasta with annotate_aho() and flags whether it is preceded by a
tryptic cleavage site. Peptides that occur in no protein are dropped.
Usage
annotate_peptides(
peptides,
fasta,
peptide = "peptide_seq",
prefix = "(([RK])|(^)|(^M))",
suffix = ""
)
Arguments
peptides |
A character vector of peptide sequences, or a data frame (or tibble) with the column named by
|
fasta |
A list of protein sequences with unique names, as returned by |
peptide |
Name of the column with the peptide sequences. |
prefix |
Regular expression the residues before a match must end with. |
suffix |
Regular expression the residues after a match must start with. |
Details
Each occurrence of a peptide in a protein is one row. matched is TRUE when the residues before that
occurrence match prefix and the residues after it match suffix. With the defaults, matched means: preceded
by K or R or the protein N-terminus (or by the Met at position 1). The end of the peptide is not checked, neither
its last residue nor a following proline; pass a suffix to check the residues after it.
Whitespace around the peptide sequences, such as the "\r" of a file with Windows line endings, is removed
before the search, and the result holds the trimmed sequences.
Value
A data frame with one row per row of peptides and protein occurrence: the columns of peptides,
protein_id, offset (1-based start of the peptide), protein_sequence (as searched, see annotate_aho()),
matched and peptide_length. With 0 rows and a warning if no peptide occurs in fasta.
See Also
Other protein inference:
annotate_aho(),
greedy_parsimony(),
greedy_to_table(),
pepprot,
protpepmetashort
Examples
file <- system.file("extdata/IDResults.txt.gz", package = "prozor")
peptides <- unique(utils::read.delim(file)$peptideSeq)
fasta_file <- system.file("p1000_db1_example/Annotation_canSeq.fasta.gz", package = "prozor")
fasta <- read_fasta(fasta_file)
annot <- annotate_peptides(peptides[1:20], fasta)
head(annot[, c("protein_id", "peptide_seq", "offset", "peptide_length", "matched")])
COMET search results
Description
Peptide-spectrum matches as produced by the COMET search engine, with its column names.
Usage
bcd
Format
A data frame with 4,557 rows and 18 columns:
-
scan: scan number. -
num: rank of the match for the scan. -
charge: precursor charge. -
exp_neutral_mass,calc_neutral_mass: experimental and calculated neutral mass. -
e.value: E-value (smaller is better). -
xcorr: cross-correlation score. -
delta_cn: difference to the next best xcorr, normalized. -
sp_score: preliminary score (Sp). -
ions_matched,ions_total: matched and theoretical fragment ions. -
plain_peptide: peptide sequence. -
modified_peptide: peptide with flanking residues and modification masses. -
prev_aa,next_aa: residues before and after the peptide. -
protein: comma-separated protein IDs; decoys start withREV_. -
protein_count: number of proteins. -
modifications: modifications as position, residue and mass.
Source
COMET search (low-resolution HCD settings) of the FGCZ quality-control run
FUSION_1.20180713_005_autoQC4L against human UniProt sequences with reversed decoys.
See Also
Other FDR:
TargetDecoyFDR,
fdr_sample
Create a database with contaminants and decoys
Description
Reads one or more FASTA files, adds contaminants and reversed decoy sequences, and puts first a dummy
entry CRAPCRAPCRAP whose header records the source of the database. Of entries with the same name, only
the first is kept. See vignette("CreatingDecoyDB", package = "prozor").
Usage
create_decoy_db(
files,
contaminants = load_contaminants(),
rev_lab = "REV_",
header = "zz|sourceOf|database"
)
Arguments
files |
Paths to one or more FASTA files. |
contaminants |
A list of contaminant sequences, e.g. from |
rev_lab |
Prefix of the reversed decoy sequences, or |
header |
Header of the dummy entry that records the source of the database, with or without the leading |
Value
A list of SeqFastaAA objects with unique names: the dummy entry, the targets, the contaminants and,
unless rev_lab is NULL, the reversed decoys of the targets and contaminants.
See Also
Other FASTA databases:
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
file <- system.file("extdata/fgcz_contaminants2022_20220405.fasta.gz", package = "prozor")
targets <- read_fasta(file)
cont <- load_contaminants("fgcz2022")
# the file, read twice, holds the same entries as `cont`: each is kept once
db <- create_decoy_db(c(file, file), contaminants = cont)
stopifnot(length(db) == 1 + 2 * length(targets), identical(names(targets), names(cont)))
db <- create_decoy_db(file, rev_lab = NULL, contaminants = NULL)
stopifnot(length(db) == 1 + length(targets))
Create an FGCZ FASTA database from a directory of FASTA files
Description
Reads all FASTA files in database_dir (*.fasta, *.fa or *.faa, optionally gzipped), adds
contaminants and decoys with create_decoy_db(), which drops duplicated entries, and writes the result to
output_dir as <name>[_d]_<date>.fasta, where _d marks a database with decoys. The first line of
annotation.txt in database_dir becomes the header of the dummy source entry.
Usage
create_fgcz_fasta_db(
database_dir,
output_dir,
contaminants = load_contaminants(),
rev_lab = "REV_",
make_summary = TRUE
)
Arguments
database_dir |
Directory with the FASTA files and |
output_dir |
Existing directory the FASTA file is written to; must not be |
contaminants |
Contaminant sequences to add, e.g. from |
rev_lab |
Prefix of the reversed decoy sequences, or |
make_summary |
If |
Details
The whole database, decoys included, is held in memory. Peak memory grows linearly with the database, by about 4 KB per written sequence or 6 to 7 times the size of the written file: 250,000 target proteins (500,000 sequences with decoys, a 320 MB file) take 2.2 GB.
Value
A list with the elements fasta (the sequences written), file_path, summary (text with the argument
values, the file name and the number of sequences), call and db_name.
See Also
Other FASTA databases:
create_decoy_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
res <- create_fgcz_fasta_db(
system.file("p1000_db1_example", package = "prozor"),
output_dir = tempdir(),
make_summary = FALSE
)
basename(res$file_path)
unlink(res$file_path)
Search engine scores with protein IDs
Description
Target and decoy hits with two scores, the input of TargetDecoyFDR.
Usage
fdr_sample
Format
A data frame with 40,000 rows and 3 columns:
-
protein_id: protein ID (factor); decoys start withREV_. -
score: score where smaller is better. -
neg_log10_score:-log10(score), a score where larger is better.
See Also
Other FDR:
TargetDecoyFDR,
bcd
Find a minimal protein set with a greedy algorithm
Description
Repeatedly assigns all unexplained peptides of the protein that explains the most of them. Proteins that
explain exactly the same unexplained peptides are reported together, separated by ;. The groups are formed
on the peptides that remain in each round: proteins B (peptides p1, p5, p6) and C (p2, p5, p6) form the group
"B;C" for p5 and p6 after protein A has taken p1 and p2.
Usage
greedy_parsimony(annotation, peptide = "peptide_seq")
Arguments
annotation |
A data frame (or tibble) with one row per peptide-protein match, e.g. from
|
peptide |
Name of the column with the peptide IDs. For precursors, add a column such as
|
Details
Proteins are ranked by the number of distinct peptides they explain; a peptide-protein pair that occurs in
several rows counts once. Of the proteins that tie, the one first in the order of the IDs is taken first. The
IDs of a character column are in C-locale order, as by sort(method = "radix"), whatever the locale: upper case
before lower case; those of a factor column in the level order.
Value
A named character vector with one element per distinct peptide ID, named by the peptide ID: the protein,
or ;-separated protein group, it is assigned to. The elements are in the order in which the groups are chosen,
and the peptides of a group, like the proteins of a group, in the order of the IDs.
See Also
Other protein inference:
annotate_aho(),
annotate_peptides(),
greedy_to_table(),
pepprot,
protpepmetashort
Examples
data(protpepmetashort)
groups <- greedy_parsimony(protpepmetashort, peptide = "peptide_mod_seq")
# every modified peptide is assigned to exactly one protein group
stopifnot(setequal(names(groups), protpepmetashort$peptide_mod_seq))
head(groups)
Convert a greedy_parsimony() result to a table
Description
Convert a greedy_parsimony() result to a table
Usage
greedy_to_table(groups)
Arguments
groups |
A result of |
Value
A data frame with the columns peptide, precursor_charge (integer) and protein_group, and the
precursor IDs as row names.
See Also
Other protein inference:
annotate_aho(),
annotate_peptides(),
greedy_parsimony(),
pepprot,
protpepmetashort
Examples
data(protpepmetashort)
protpepmetashort$precursor <- paste(
protpepmetashort$peptide_mod_seq,
protpepmetashort$precursor_charge,
sep = "."
)
head(greedy_to_table(greedy_parsimony(protpepmetashort, peptide = "precursor")))
Load a bundled set of contaminant sequences
Description
The sets:
-
"fgcz2024"(default): the FGCZ default, the sets"special2024"and"universal2024"together; used bycreate_decoy_db(),create_fgcz_fasta_db()andinst/script/fgcz_create_fasta.R. -
"fgcz2019","fgcz2021","fgcz2022": FGCZ contaminant lists of 2019, 2021 and 2022. -
"universal2024": universal contaminants from https://github.com/HaoGroup-ProtContLib/Protein-Contaminant-Libraries-for-DDA-and-DIA-Proteomics, described by Frankenfield et al. (2022). Seesystem.file("COPYRIGHTS", package = "prozor"). -
"special2024": FGCZ special proteins of 2024.
Usage
load_contaminants(
set = c("fgcz2024", "fgcz2019", "fgcz2021", "fgcz2022", "universal2024", "special2024"),
no_human = FALSE
)
Arguments
set |
Name of the contaminant set: |
no_human |
If |
Value
A named list of SeqFastaAA objects.
References
Frankenfield AM, Ni J, Ahmed M, Hao L (2022). Protein Contaminants Matter: Building Universal Protein Contaminant Libraries for DDA and DIA Proteomics. Journal of Proteome Research, 21(9), 2104-2113. doi:10.1021/acs.jproteome.2c00145
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
length(load_contaminants())
cont <- load_contaminants("fgcz2022")
length(cont)
length(load_contaminants("fgcz2022", no_human = TRUE))
Make an ID for a protein chain
Description
Make an ID for a protein chain
Usage
make_chain_id(sequence, id, start)
Arguments
sequence |
The protein sequence, as one string; not used. |
id |
The ID of the protein, e.g. |
start |
Start position of the chain. |
Value
id followed by s and start, e.g. "sp|P30443|1A01_HUMANs24".
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
make_chain_id("ABCDE", "sp|P30443|1A01_HUMAN", 24)
Make a UniProt-style ID for a protein chain
Description
Make a UniProt-style ID for a protein chain
Usage
make_chain_id_uniprot(sequence, id, start)
Arguments
sequence |
The protein sequence, as one string; the chain ends at its last residue. |
id |
The UniProt ID of the protein, e.g. |
start |
Start position of the chain. |
Value
The first two fields of id, followed by the range of the chain as UniProt writes it: start, - and the
length of sequence (the end of the chain), e.g. "sp|P30443|21-148".
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
make_chain_id_uniprot(strrep("A", 148), "sp|P30443|1A01_HUMAN", 21)
Summarize a FASTA database
Description
Counts the sequences and amino acids and summarizes the sequence lengths.
Usage
make_fasta_summary(fasta)
Arguments
fasta |
A list of sequences, as returned by |
Value
A list with the elements n_sequences, length_summary and aa_freq (counts per amino acid).
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
read_fasta(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
file <- system.file("extdata/fgcz_contaminants2022_20220405.fasta.gz", package = "prozor")
fasta <- read_fasta(file)
make_fasta_summary(fasta)
MS1 precursor masses
Description
Precursor masses, the input of Cdsw for computing DIA windows.
Usage
masses
Format
A numeric vector of 146,009 precursor m/z values.
See Also
Other DIA windows:
Cdsw,
plot_windows(),
readjust_windows()
Precursors of identified peptides
Description
Sequence, charge and m/z of identified precursors, without proteins; protpepmetashort holds the proteins of some of them.
Usage
pepprot
Format
A data frame with 4,938 rows and 4 columns:
-
peptide_seq: peptide sequence (factor). -
peptide_mod_seq: modified peptide sequence (factor). -
precursor_charge: precursor charge (integer). -
precursor_mz: precursor m/z.
See Also
Other protein inference:
annotate_aho(),
annotate_peptides(),
greedy_parsimony(),
greedy_to_table(),
protpepmetashort
Plot the peptide coverage of a protein sequence
Description
Writes the protein sequence in rows of width residues. Each residue is a tile colored by the number of
peptides that cover it; uncovered residues are gray.
Usage
plot_coverage(residues, protein_id, width = 50)
Arguments
residues |
A result of |
protein_id |
The protein to plot: one protein ID, a value of |
width |
Residues per row: a positive whole number. |
Value
A ggplot object; the y axis labels the position of the first residue of each row.
See Also
Other sequence coverage:
residue_coverage(),
sequence_coverage()
Examples
file <- system.file("extdata/IDResults.txt.gz", package = "prozor")
peptides <- unique(utils::read.delim(file)$peptideSeq)
fasta_file <- system.file("p1000_db1_example/Annotation_canSeq.fasta.gz", package = "prozor")
annot <- annotate_peptides(peptides, read_fasta(fasta_file))
coverage <- sequence_coverage(annot)
best <- coverage$protein_id[which.max(coverage$coverage)]
plot_coverage(residue_coverage(annot), best)
Plot precursor masses with DIA window boundaries
Description
Plot precursor masses with DIA window boundaries
Usage
plot_windows(windows, masses, bin_width = 0.1)
Arguments
windows |
A data frame or list with the columns |
masses |
Precursor masses (m/z): a numeric vector of finite values. |
bin_width |
Width of the histogram bins (m/z). |
Value
A ggplot object.
See Also
Other DIA windows:
Cdsw,
masses,
readjust_windows()
Examples
data(masses)
cdsw <- Cdsw$new(masses, max_window = 100)
windows <- cdsw$optimize_windows(min_count = 10)
plot_windows(windows, masses)
# zoom into one window
start <- windows$from[5]
plot_windows(windows, masses) + ggplot2::coord_cartesian(xlim = c(start - 3, start + 3))
Peptide-protein assignments
Description
Peptide-protein pairs for 241 mouse proteins and 9 FGCZ contaminants; small, so the examples stay fast.
Usage
protpepmetashort
Format
A data frame with 423 rows and 7 columns:
-
peptide_seq: peptide sequence (factor). -
protein_length: length of the protein sequence. -
protein_id: UniProt protein ID (factor), e.g.sp|Q62009|POSTN_MOUSE. -
peptide_mod_seq: modified peptide sequence (factor). -
precursor_charge: precursor charge (integer). -
precursor_mz: precursor m/z. -
peptide_length: length of the peptide sequence.
Source
Precursors of pepprot, annotated with annotate_peptides() against mouse UniProt sequences and FGCZ
contaminants.
See Also
Other protein inference:
annotate_aho(),
annotate_peptides(),
greedy_parsimony(),
greedy_to_table(),
pepprot
Read a FASTA file of protein sequences
Description
Reads amino-acid sequences, each sequence as one string. Lines starting with ; and lines before the first
header are skipped; an entry without sequence lines gets the empty string.
Usage
read_fasta(file)
Arguments
file |
Path to a FASTA file, optionally gzip-compressed. |
Value
A named list with one SeqFastaAA object per sequence: the sequence as a string, with the attributes
name (the first word of the header, up to the first whitespace, without >; also the list name) and Annot
(the header line).
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
remove_signal_peptide(),
reverse_seq(),
write_fasta()
Examples
file <- system.file("extdata/fgcz_contaminants2021_20210929.fasta.gz", package = "prozor")
fasta <- read_fasta(file)
length(fasta)
attributes(fasta[[1]])
Move DIA window boundaries to regions with few precursors
Description
Moves each window start down, and each window end up, to the mid of the nearest empty bin. A boundary already on
such a mid stays, so readjust_windows() returns its own result unchanged.
Usage
readjust_windows(windows, masses, bin_width = 0.1, min_count = 15)
Arguments
windows |
A data frame or list with the columns |
masses |
Precursor masses (m/z): a numeric vector of finite values. |
bin_width |
Width of the bins (m/z) into which the masses are binned. |
min_count |
Bins with fewer than |
Value
A data frame with one row per window and the columns from, to, mid, width and n_precursors
(precursors with from < m/z <= to).
See Also
Other DIA windows:
Cdsw,
masses,
plot_windows()
Examples
data(masses)
cdsw <- Cdsw$new(masses, max_window = 100)
windows <- cdsw$as_table()
head(readjust_windows(windows, masses, min_count = 10))
Remove signal peptides from protein sequences
Description
Remove signal peptides from protein sequences
Usage
remove_signal_peptide(fasta, signal, id_fun = make_chain_id)
Arguments
fasta |
A list of UniProt protein sequences, as returned by |
signal |
A data frame with one row per entry of |
id_fun |
Function that makes the ID of the remaining chain from the protein sequence, its ID and the start of
the chain, e.g. |
Value
fasta with the signal peptides removed. A shortened sequence gets the ID made by id_fun as its list
name, its name and the first word of its header; the rest of the header is kept.
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
reverse_seq(),
write_fasta()
Examples
file <- system.file("extdata/fgcz_contaminants2021_20210929.fasta.gz", package = "prozor")
fasta <- read_fasta(file)[2:3]
names(fasta)
signal <- data.frame(
Entry = c("Y-FGCZCont00001", "Y-FGCZCont00002"),
Signal.peptide = c("SIGNAL 1 20", "")
)
res <- remove_signal_peptide(fasta, signal)
nchar(fasta[[1]])
nchar(res[[1]])
Peptide coverage of each residue
Description
Counts, for every residue of the proteins in annotation, how many distinct peptide sequences cover it.
Repeated rows of the same peptide, such as several charge states from annotate_peptides(), count once. A
peptide that occurs twice in a protein covers both places, and where its occurrences overlap it counts once.
Usage
residue_coverage(annotation, peptide = "peptide_seq")
Arguments
annotation |
A data frame with the columns |
peptide |
Name of the column with the peptide sequences. |
Value
A data frame with one row per residue of each protein in annotation, ordered by protein_id and
position: protein_id, position, residue and n_peptides, the number of peptides covering it; 0 rows
if annotation has none.
See Also
Other sequence coverage:
plot_coverage(),
sequence_coverage()
Examples
file <- system.file("extdata/IDResults.txt.gz", package = "prozor")
peptides <- unique(utils::read.delim(file)$peptideSeq)
fasta_file <- system.file("p1000_db1_example/Annotation_canSeq.fasta.gz", package = "prozor")
annot <- annotate_peptides(peptides, read_fasta(fasta_file))
residues <- residue_coverage(annot)
head(residues)
Reverse protein sequences to create decoys
Description
Reverse protein sequences to create decoys
Usage
reverse_seq(fasta, rev_lab = "REV_")
Arguments
fasta |
A list of |
rev_lab |
Prefix added to the names and headers of the reversed sequences. |
Value
A list of reversed SeqFastaAA objects, named with the prefixed protein names.
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
write_fasta()
Examples
file <- system.file("extdata/fgcz_contaminants2021_20210929.fasta.gz", package = "prozor")
fasta <- read_fasta(file)
decoys <- reverse_seq(fasta)
names(decoys)[1:3]
# an entry as read_fasta() returns it
tag <- structure(
"DYKDDDDK",
name = "Flag|FLAG|p2079",
Annot = ">Flag|FLAG|p2079",
class = "SeqFastaAA"
)
reverse_seq(list(tag), rev_lab = "DECOY_")
Sequence coverage of each protein
Description
Summarizes residue_coverage() per protein: how many distinct peptides match it and which fraction of its
residues they cover.
Usage
sequence_coverage(annotation, peptide = "peptide_seq")
Arguments
annotation |
A data frame with the columns |
peptide |
Name of the column with the peptide sequences. |
Value
A data frame with one row per protein, ordered by protein_id: protein_id, protein_length,
n_peptides (distinct peptides), n_covered (residues covered by at least one peptide) and coverage
(n_covered / protein_length); 0 rows if annotation has none.
See Also
Other sequence coverage:
plot_coverage(),
residue_coverage()
Examples
file <- system.file("extdata/IDResults.txt.gz", package = "prozor")
peptides <- unique(utils::read.delim(file)$peptideSeq)
fasta_file <- system.file("p1000_db1_example/Annotation_canSeq.fasta.gz", package = "prozor")
annot <- annotate_peptides(peptides, read_fasta(fasta_file))
coverage <- sequence_coverage(annot)
head(coverage[order(coverage$coverage, decreasing = TRUE), ])
Write protein sequences to a FASTA file
Description
Writes each sequence with its Annot header and 60 residues per line. A header without the leading > gets one.
Usage
write_fasta(fasta, file)
Arguments
fasta |
A list of |
file |
Path of the FASTA file to write. |
Value
file, invisibly.
See Also
Other FASTA databases:
create_decoy_db(),
create_fgcz_fasta_db(),
load_contaminants(),
make_chain_id(),
make_chain_id_uniprot(),
make_fasta_summary(),
read_fasta(),
remove_signal_peptide(),
reverse_seq()
Examples
file <- system.file("extdata/fgcz_contaminants2021_20210929.fasta.gz", package = "prozor")
fasta <- read_fasta(file)
decoy_db <- c(fasta, reverse_seq(fasta))
out <- tempfile(fileext = ".fasta")
write_fasta(decoy_db, out)
length(read_fasta(out))
unlink(out)