prozor 0.5.0
prozor 0.4.0 was not released to CRAN; this section lists all changes since CRAN 0.3.1.
Breaking changes
- All exported functions and their arguments use snake_case. The old names are gone, without aliases:
| Old | New |
|---|---|
annotateAHO(), annotatePeptides() |
annotate_aho(), annotate_peptides() |
computeFDR(), computeFDRwithID(), predictScoreFDR(), plotFDR() |
TargetDecoyFDR$new(), $score_at(), $plot() (see below) |
createDecoyDB(), reverseSeq() |
create_decoy_db(), reverse_seq() |
readPeptideFasta(), writeFasta() |
read_fasta(), write_fasta() |
loadContaminantsFasta2019(), loadContaminantsFasta2021(), loadContaminantsFGCZ2022(), load_universal_contaminants_2024(), load_special_prot_2024() |
load_contaminants("fgcz2019"), "fgcz2021", "fgcz2022", "universal2024", "special2024" |
greedyRes2Matrix(res) |
greedy_to_table(groups) |
removeSignalPeptide(), makeID(), makeIDUnip() |
remove_signal_peptide(), make_chain_id(), make_chain_id_uniprot() |
readjustWindows() |
readjust_windows() |
Cdsw methods asTable(), showCycle(), optimizeWindows() |
as_table(), plot_cycle(), optimize_windows() |
Cdsw methods constant_breaks(), quantile_breaks(), sampling_breaks() |
Cdsw$new(method = "constant"), "quantile", "mixture" |
Cdsw$error() elements score1, score2, counts, optimumN |
manhattan, euclidean, normalized_counts, equal_counts |
arguments useContaminants, revLab, noHuman, databasedirectory, outputdir, resDB, qValue, idfun, ID |
contaminants, rev_lab, no_human, database_dir, output_dir, fasta, q_value, id_fun, id |
arguments pepinfo of annotatePeptides(), pepseq of annotateAHO() |
peptides |
arguments dbs, annot of createDecoyDB(), db of removeSignalPeptide() |
files, header, fasta |
arguments wind, ms1data, maxbin of readjustWindows() and Cdsw$optimizeWindows() |
windows, masses, min_count |
column counts of Cdsw$asTable(), Cdsw$optimizeWindows() and readjustWindows() |
n_precursors |
Cdsw arguments and field nbins, maxwindow, minwindow |
n_bins, max_window, min_window |
argument sp of makeID(), makeIDUnip() |
start |
data set fdrSample, its column score2 |
fdr_sample, column neg_log10_score |
column m of the data sets pepprot and protpepmetashort |
precursor_mz |
- Renamed since 0.4.0 (GitHub only), without aliases:
read_peptide_fasta()→read_fasta()annotate_peptides(pepinfo),annotate_aho(pepseq)→annotate_peptides(peptides),annotate_aho(peptides)create_decoy_db(dbs, annot)→create_decoy_db(files, header)make_fasta_summary(db),remove_signal_peptide(db), elementdbofcreate_fgcz_fasta_db()→fastamake_fasta_summary()element and summary labelnr_sequences,nr sequences→n_sequencesreadjust_windows(wind, ms1data),plot_windows(windows, ms1data)→readjust_windows(windows, masses),plot_windows(windows, masses)maxbinofreadjust_windows()andCdsw$optimize_windows()→min_count- column
countsofCdsw$as_table(),Cdsw$optimize_windows()andreadjust_windows()→n_precursors Cdsw$new(nbins, maxwindow, minwindow), fieldnbins→n_bins,max_window,min_window, fieldn_binsCdsw$new(method = "sampling")→method = "mixture"Cdsw$show_cycle()→Cdsw$plot_cycle()Cdsw$error()elementsscore1,score2,counts,optimum_n→manhattan,euclidean,normalized_counts,equal_countsgreedy_to_table(res), columnprotein→greedy_to_table(groups), columnprotein_groupTargetDecoyFDR:simple_fdr→fdr_simple(method value, columnsfdr_simpleandq_value_fdr_simple)make_chain_id(sp),make_chain_id_uniprot(sp)→start- column
mofpepprotandprotpepmetashort→precursor_mz - column
score2offdr_sample→neg_log10_score
- Result columns and list elements are snake_case too:
annotate_aho(),annotate_peptides():protein_id,offset,protein_sequence,peptide_length, andpeptide_seqfor vector input (wasproteinID,Offset,proteinSequence,lengthPeptide,peptideSeq)greedy_to_table():peptide,precursor_charge,protein_group(wasPeptide,precursorCharge,Protein);precursor_chargeis an integer instead of a charactermake_fasta_summary():n_sequences,length_summary,aa_freq;create_fgcz_fasta_db():fasta,file_path,summary,call,db_name
- The data sets
fdr_sample,protpepmetashortandpepprothave snake_case columns (protein_id,peptide_seq,peptide_mod_seq,precursor_charge,precursor_mz,protein_length,peptide_length,neg_log10_score);bcdkeeps COMET’s column names. - Default column names follow the results:
annotate_peptides(peptide = "peptide_seq"), andgreedy_parsimony(peptide = "peptide_seq")reads the proteins fromprotein_id(wasannotatePeptides(peptide = "peptideSeq")andprepareMatrix(proteinID = "proteinID", peptideID = "strippedSequence")). - The R6 class
TargetDecoyFDRreplacescomputeFDR(),computeFDRwithID(),predictScoreFDR()andplotFDR(), without aliases (see?TargetDecoyFDR):computeFDR(score, decoy_hit)→fdr <- TargetDecoyFDR$new(score, decoy_hit); the data framefdr$tableholds the hits in score order with both FDR estimates and their q-values (was a list of vectors).FPR,SimpleFDR,qValue_FPR,qValue_SimpleFDR→fdr_concatenated,fdr_simple,q_value_fdr_concatenated,q_value_fdr_simple; 2 * decoys / all hits estimates the FDR of a concatenated search, not a false positive rate.predictScoreFDR(fdr, qValue = 1)→fdr$score_at(q_value = 0.01):q_valueis a fraction, not a percentage.method = "SimpleFDR"(default) and"FPR"→"fdr_simple"and"fdr_concatenated".plotFDR(fdr)→fdr$plot().computeFDRwithID(score, ID)→TargetDecoyFDR$new(score, decoy_hit = grepl("^REV_", ID), id = ID); only IDs starting withREV_count as decoys (decoy = "REV_"matched anywhere in the ID).
TargetDecoyFDRcomputes the FDR per score, counting all tied hits: they share one FDR and q-value, whatever the input order, andscore_at()no longer returns a cut-off whose FDR exceedsq_value(1.07 % at 0.01 onbcdwith rounded scores).TargetDecoyFDR$score_at()stops when no score reaches the requested FDR;predictScoreFDR()returnedInfwith a warning.greedy_parsimony(annotation, peptide = "peptide_seq")replacesgreedy()andprepareMatrix()(prepare_matrix()on GitHub), without aliases. It takes the peptide-protein matches as a data frame, e.g. fromannotate_peptides(), instead of a peptide-by-protein matrix (see?greedy_parsimony).- For precursors, add a column such as
paste(peptide_seq, precursor_charge, sep = ".")and pass its name aspeptide. - The weightings of
prepareMatrix()are gone: they no longer change the result, since proteins are ranked by their number of peptides.
- For precursors, add a column such as
greedy_parsimony()returns a named character vector instead of a named list of single strings; dropunlist()on its result.greedy_parsimony()ranks proteins by the number of peptides they explain, as documented.greedy()ranked them by the sum of their matrix entries, so withprepareMatrix(weighting = "inverse")a protein with fewer but less shared peptides could win the shared ones.greedy_parsimony()no longer prints its run time.annotate_aho()andannotate_peptides()return a data frame with 0 rows and the result columns when no peptide occurs infasta, instead ofNULL;annotate_peptides()still warns.residue_coverage()andsequence_coverage()return 0 rows for such a result.annotate_aho()andannotate_peptides()stop for peptides with characters other than upper-case letters (AhoCorasickTrie 0.1.3 crashed R on them) and for duplicated protein names infasta(they multiplied the result rows).annotate_aho()stops for peptides with whitespace around them and shows the peptide escaped, e.g."PEPTIDEK\r"; it used to remove the whitespace.annotate_peptides()still removes it.annotate_peptides()stops, naming the columns, whenpeptideshas a column named like a result column (protein_id,offset,protein_sequence,matched,peptide_length).- Such columns, e.g. of search engine output, gave
protein_id.xandprotein_id.yinstead ofprotein_id, or were overwritten.
- Such columns, e.g. of search engine output, gave
annotate_peptides()setsmatchedfor each occurrence of a peptide in a protein; a second, non-tryptic occurrence was flagged as tryptic.make_fasta_summary(fasta)always returns the list; the argumentsas_stringandoldare gone. The summary ofcreate_fgcz_fasta_db(make_summary = TRUE)lists the sequence lengths and amino-acid counts one per line.create_fgcz_fasta_db(database_dir, output_dir, ...)requiresoutput_dir, now its second argument; it used to write next todatabase_dirby default.inst/script/fgcz_create_fasta.Rstill does when-ois not given.create_decoy_db()andcreate_fgcz_fasta_db()add the contaminant sets"special2024"and"universal2024"by default, likeinst/script/fgcz_create_fasta.R(was"fgcz2021"in CRAN 0.3.1,"fgcz2022"in 0.4.0).write_fasta(fasta, file)takes one list of sequences, data first, and returnsfileinvisibly (waswriteFasta(file, ...)); combine several lists withc().Cdswis an R6 class whose window breaks are computed once, byCdsw$new()(see?Cdsw). It was a reference class whose*_breaks()methods overwrote the breaks, so the results of the other methods depended on which of them ran last.constant_breaks(),quantile_breaks(),sampling_breaks()→Cdsw$new(masses, method = "constant"),"quantile","mixture"(the default); create one object per method.Cdsw(masses)started with"constant".copy()→clone(). The fieldsmasses,n_bins,methodandbreaksare read-only.
Cdsw$new(method = "mixture")is deterministic and fast (see?Cdsw). It added random masses until the windows fitted, so the breaks changed from call to call, and it could take minutes or never return.- The breaks differ from those of earlier versions; the counts per window are as even as before.
readjust_windows(),plot_windows()andCdsw$optimize_windows()take the bin width of the masses in m/z,bin_width = 0.1, instead ofdigits = 1;digitsofCdsw$new()sets only the decimal places of the breaks.- Replace
digits = dwithbin_width = 10^-d.
- Replace
readjust_windows()returns a data frame instead of a list, likeCdsw$as_table()andCdsw$optimize_windows().Cdsw$optimize_windows()widens the windows byoverlap = 1m/z by default, asas_table()andplot_cycle()do (was 0).- Precursors per window are counted as the masses
mwithfrom < m <= to, the intervals ofhist().Cdsw$as_table()left out masses on a window boundary, andreadjust_windows()andCdsw$optimize_windows()counted them in both windows. Counts change only for masses exactly on a boundary. - Plots use ggplot2:
TargetDecoyFDR$plot(),Cdsw$plot()andCdsw$plot_cycle()return ggplot objects and draw nothing themselves.- The
plotargument ofreadjust_windows(),Cdsw$optimize_windows()and the oldsampling_breaks()is gone; useplot_windows()andCdsw$plot_breaks().
- The
read_fasta()andwrite_fasta()use base R instead of seqinr. The entries are stillSeqFastaAAobjects with the attributesnameandAnnot, so seqinr’sgetAnnot(),getName()andgetLength()work on them.library(prozor)no longer loads seqinr; load it to get seqinr’ssummary()of an entry.
- prozor requires R 4.4.0 or later (was R 3.1.0).
New features
load_contaminants(set, no_human)loads any of the bundled contaminant sets.load_contaminants()loads the new set"fgcz2024"by default:"special2024"and"universal2024"together, the default contaminants ofcreate_decoy_db(),create_fgcz_fasta_db()andfgcz_create_fasta.R --contamin=special.plot_windows()shows the precursor masses with the DIA window boundaries.Cdsw$plot_breaks()compares the breaks of the object with the constant and quantile breaks of the same masses.residue_coverage(),sequence_coverage()andplot_coverage()compute and plot the peptide coverage of protein sequences from the result ofannotate_peptides(); the new vignette “Protein Sequence Coverage” shows them.citation("prozor")cites the package with its CRAN DOI.
Minor improvements and fixes
greedy_parsimony()assigns every peptide that matches a protein again: only proteins that explain exactly the same peptides are reported together ("A;B"). Since 2023 (GitHub only), unrelated tied proteins were merged into one group and their other peptides were left without a protein.greedy_parsimony()is 250 to 400 times faster on thousands of peptides, e.g. 0.05 s instead of 21 s for 12,000 peptides.greedy_parsimony()no longer scans all proteins in every round: 2.2 s instead of 36 s for 400,000 peptides that match many proteins.greedy_parsimony()breaks ties between character IDs in C-locale order (upper case first) in every locale; it followed the session’s collation, so a tie between proteins"a"and"B"depended on the locale.greedy_parsimony()ignores unused factor levels of the ID columns, so it works on subsets of the bundled data sets;prepareMatrix()failed on them or gave rows or columns without entries.annotate_peptides()andgreedy_parsimony()accept tibbles;annotatePeptides()andprepareMatrix()crashed R or failed on them.greedy_to_table()takes the charge after the last dot, so modified peptides such as"AC[+57.0]K.2"work; they failed with “length of ‘dimnames’ [2] not equal to array extent”.greedy_to_table()stops, naming the IDs, when a peptide ID does not end in a dot and a charge, e.g. for agreedy_parsimony()result on plain peptide sequences; it used to return a wrongprecursor_charge.TargetDecoyFDR$new()checks its input: it stops for ascorethat is not numeric, adecoy_hitthat is not logical,NAin either, adecoy_hitoridof another length thanscore, and alarger_betterother thanTRUEorFALSE.- Character scores were sorted as text, and one
NAdecoy flag made all q-valuesNA.
- Character scores were sorted as text, and one
TargetDecoyFDR$new()stops for zero hits;$plot()failed on them with “arguments imply differing number of rows: 0, 1”.TargetDecoyFDRcaps both FDR estimates and their q-values at 1; when the best hit was a decoy,fdr_simplewasInfand q-values exceeded 1.TargetDecoyFDR$plot()uses a logarithmic score axis only when all scores are positive; scores of 0 (e.g. PEP or rounded E-values) vanished from the plot with a warning.annotate_peptides()removes whitespace around the peptides, e.g. the"\r"of a file with Windows line endings, before it searches them; such peptides were dropped from the result without a warning.annotate_aho()andannotate_peptides()search proteins with lower-case residues or characters other than letters, such as the stop codon*of translated databases, with unchanged offsets; one such protein stopped the search with “character ’*’ is not in the trie’s alphabet”.annotate_aho()andannotate_peptides()give the offsets in the sequences offastaalso for a sequence that starts with blanks; they removed such blanks and gave offsets shifted by their number. Blanks are searched asX, like*.annotate_peptides()stops whenpeptideslacks the column named bypeptide, andannotate_aho()whenfastahas no names; they failed with “replacement has 0 rows, data has 1” and “arguments imply differing number of rows: 0, 1”.annotate_aho()is about 6 times faster on the bundled example.annotate_aho()andannotate_peptides()no longer print dplyr’s “Joining withby = join_by(proteinID)” message, nor dplyr’sfuns()deprecation warning.readjust_windows()andplot_windows()stop formasseswithNAor non-numeric values, asCdsw$new()does, and forwindowswithout the columnfromorto.plot_coverage()stops unlesswidthis a positive whole number.residue_coverage()andsequence_coverage()take 0.5 s and 0.2 s instead of 15 s for 190,000 peptides, and 0.6 and 0.3 GB of memory instead of 6 GB.Cdsw$new(method = "mixture")stops when even equal-width windows violatemin_windowormax_window;sampling_breaks()warned and then never returned.Cdsw$new(method = "mixture")keeps the rounded and padded breaks withinmin_windowandmax_window; the last window was up to2 / 10^digitswider thanmax_window.Cdsw$new()stops for an infiniten_bins,max_window,min_windowordigits,readjust_windows()andCdsw$optimize_windows()for amin_countthat is not a non-negative number, andCdsw$as_table(),$optimize_windows()and$plot_cycle()for such anoverlap;digits = InfgaveNaNbreaks, andmin_count = "a"compared the counts as text.- Constant breaks enclose the masses for any
digits, andreadjust_windows()andCdsw$optimize_windows()work for any bin width.constant_breaks(digits = 3)followed by$plot()or$error(), andreadjust_windows(digits = 2), failed with “some ‘x’ not counted” for about 38 % of data sets.- With the default
digitsthe breaks are unchanged; other values give slightly different breaks.
- With the default
readjust_windows()andCdsw$optimize_windows()also move a window start down to the first empty bin and a window end up to the last one; such boundaries stayed in place when that bin was the nearest.readjust_windows()andCdsw$optimize_windows()return the windows unchanged when no bin is empty, e.g. withmin_count = 0; they failed with “argument is of length zero”.readjust_windows()leaves a boundary that is already on the mid of an empty bin in place, so it returns its own result unchanged; it moved such a boundary to the next empty bin, and a second pass widened the windows by up to 0.7 m/z.- The breaks of
Cdsware unnamed for all methods, soCdsw$as_table()has row numbers instead of the quantile names0%,4%, … write_fasta()keeps a>inside a header (ADP>ATPused to becomeADPATP).write_fasta()stops, naming the first such entry, unless every entry has oneAnnotstring, before it creates the file; it failed with “values must be length 1” and left an empty or partial file.write_fasta(),make_fasta_summary()andreverse_seq()are faster and give the same output;create_fgcz_fasta_db()takes 4.7 s instead of 30 s for 82,000 proteins.read_fasta()gives an entry without sequence lines the empty string; it returned the next header pasted to this one, e.g.">b>a", whichwrite_fasta()then wrote as an extra header line.make_fasta_summary()counts an empty sequence as length 0 (was 1).read_fasta()ends an entry’s name at the first whitespace, so a tab-separated header>sp|P1|A_HUMAN<TAB>...givessp|P1|A_HUMAN; only a space ended it.reverse_seq()takes the decoy names from the decoy headers in the same way.read_fasta()andcreate_fgcz_fasta_db()read a FASTA file orannotation.txtwithout a final newline without the warning “incomplete final line found”.remove_signal_peptide()reads UniProt’s current signal peptide formatSIGNAL 1..20, and works on a database with a single entry.remove_signal_peptide()stops when a name offastahas no|and so no UniProt accession, orsignal$EntryisNA; such entries skipped the check thatsignallists the entries in the order offasta.remove_signal_peptide()gives a shortened sequence its new ID as list name too, soannotate_aho()and the written FASTA file report the same ID, and keeps the description in its header.remove_signal_peptide()stops, naming the missing columns, whensignallacksEntryorSignal.peptide; with UniProt’sSignal peptide(asread.delim(check.names = FALSE)names it) it returnedfastaunchanged, and withoutEntryit skipped the order check.remove_signal_peptide()takes linear time: 0.5 s instead of 5 s for 82,000 entries.load_contaminants("special2024")works: the bundledfgcz_special_prot_20241112.fasta.gzis a plain gzipped FASTA file again instead of a gzipped tar archive (#7).load_contaminants(no_human = TRUE)also drops entries whose header saysHomo sapiens; it kept 7 human keratins of the"fgcz2019","fgcz2021"and"fgcz2022"sets.create_fgcz_fasta_db()reads only FASTA files (*.fasta,*.faor*.faa, optionally gzipped) andannotation.txt, and stops whendatabase_dirholds no FASTA file or isoutput_dir.- It read every file with
fastain its name, so a*.fa.gzdatabase was skipped, and a second run read the written database as targets (REV_REV_decoys).
- It read every file with
create_fgcz_fasta_db()stops before it reads any file whenoutput_dirdoes not exist; it failed with “cannot open file” after building the whole database.create_decoy_db()keeps only the first entry of each name, ascreate_fgcz_fasta_db()did; duplicated names madeannotate_aho()refuse the result.- The summary of
create_fgcz_fasta_db()and the parameter log offgcz_create_fasta.Rrecord the argument values, e.g.contaminants : 505 sequences, instead of the call, and no longer link to the FGCZ intranet. - The dummy entry
CRAPCRAPCRAPthatcreate_decoy_db()puts first has the attributes it gets when the written file is read back:Annotstarts with>andnameis the first word of the header. The written files are unchanged. inst/script/fgcz_create_fasta.R --contamintakes every set ofload_contaminants()besidesspecial,noneand a FASTA file, and stops early, naming the sets, for an unknown value. The parameter log of anodecoyrun saysrevLab: NULLinstead ofREV_.inst/script/fgcz_create_fasta.Rwrites its parameter log next to the FASTA file in the output directory, named like it, e.g.p1000_db1_example_d_20261125.txt; it wrote<db_name>.txtinto the working directory.- The FGCZ shell wrappers (
inst/script/*.sh) and the notes ininst/creatingDBs/are no longer part of the package;inst/script/fgcz_create_fasta.Rstays. - The example database
inst/p1000_db1_exampleis described as human in itsannotation.txt; it said mouse. - Errors raised by exported functions show their call; errors from internal checks and R6 methods show none, so
residue_coverage()no longer reports.check_annotation(). - Error messages name the argument and the offending value, and put column names in backticks.
library(prozor)no longer prints the package version.library(prozor)no longer loads ggplot2, only the first plot does: 0.002 s instead of 0.33 s.- Removed the undocumented debug data set
mm.
Documentation
- Help pages use markdown, link related functions in families, and describe the actual return values, e.g. the columns of
TargetDecoyFDR$table. The data sets are listed with the functions of their family, e.g.fdr_sampleandbcdwithTargetDecoyFDR. ?prozorgives an overview of the functions and vignettes by topic.?TargetDecoyFDRcites Elias and Gygi (2007) and Käll et al. (2008), with DOIs.?load_contaminantscites the source of the"universal2024"set, andinst/COPYRIGHTSlists its origin.- The
Cdswhelp page documents each method with its usage and arguments; it documented method arguments without a usage section (r-devel NOTE). ?annotate_peptidessays whatmatchedchecks: by default, that the peptide is 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.?create_fgcz_fasta_dbgives the memory a build needs, and?greedy_parsimonysays that protein groups are formed on the peptides left in each round.pepprotis titled “Precursors of identified peptides”, as it holds no proteins.- New or runnable examples for
create_fgcz_fasta_db(),greedy_to_table(),remove_signal_peptide()andwrite_fasta(); removed debugging code from examples and vignettes. - The vignettes use the new names, snake_case code and ggplot2; “Peptide Annotation and Protein Inference” builds again. “Creating Target Decoy Databases” finds the FASTA files as
create_fgcz_fasta_db()does, writes totempdir()and ends with the one-callcreate_fgcz_fasta_db(). - “Peptide Annotation and Protein Inference” shows proteotypic peptides in red in the peptide protein match plots.
- The README has an R example and a citation section.
Dependencies
Compared with CRAN 0.3.1:
- Removed from Imports: Matrix, methods, purrr, readr, rlang, seqinr and stringr.
- Moved to Suggests: docopt, used only by
inst/script/fgcz_create_fasta.R, and dplyr, used only by the vignettes and tests. - Added to Imports: ggplot2 and R6; the base packages graphics, stats and utils are now declared too.
- Added to Suggests: altdoc, testthat and withr.
- protViz, imported by the GitHub versions from 2023 on, is no longer needed; no CRAN release depended on it.
prozor 0.3.1
CRAN release after 0.2.11 (0.2.15 was prepared for Bioconductor and not released to CRAN). Changes since 0.2.15:
- Removed
loadContaminantsFasta()andloadContaminantsNoHumanFasta(), the FGCZ contaminants of 2015.createDecoyDB()addsloadContaminantsFasta2021()by default, ascreate_fgcz_fasta_db()did already. - The example FASTA files moved from
inst/extdatatoinst/p1000_db1_example; several bundled files were removed and the data files made smaller to reduce the package size. - Removed the internal helpers that copied FASTA files to an FGCZ server and registered them in B-Fabric; ssh and reticulate are no longer suggested.
- prozor requires R 3.1.0 or later (was R 4.1.0).
- The maintainer address is wewolski@gmail.com.
prozor 0.2.15
Prepare submission to Bioconductor
- address warnings and notes from BiocCheck tool.