Skip to main content

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 load_contaminants(), or NULL for none.
rev_lab Prefix of the reversed decoy sequences, or NULL for no decoys.
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

library("prozor")

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))