R/is_polypeptide.R

Defines functions is_peptide

Documented in is_peptide

#' Determine if the AA sequence is a peptide
#' @inheritParams default_params_doc
#' @author Richèl J.C. Bilderbeek
#' @export
is_peptide <- function(protein_sequence) {
  if (!is.character(protein_sequence)) return(FALSE)
  if (length(protein_sequence) != 1) return(FALSE)
  if (nchar(protein_sequence) == 0) return(FALSE)

  all(strsplit(x = protein_sequence, split = "")[[1]]
    %in% Peptides::aaList()
  )
}
richelbilderbeek/bbbq documentation built on July 27, 2023, 2:15 a.m.