% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/convertAnnotation.R
\name{convertAnnotation}
\alias{convertAnnotation}
\alias{.convertAnnotation}
\title{Convert sequences from one annotation style to another}
\usage{
convertAnnotation(
  x,
  convertToStyle = c("deltaMass", "unimodId", "name"),
  massTolerance = 0.01,
  verbose = TRUE
)
}
\arguments{
\item{x}{Character vector with peptide sequences in ProForma format}

\item{convertToStyle}{Character string specifying target format. Options:
"deltaMass", "unimodId", "name"}

\item{massTolerance}{Numeric mass tolerance in Daltons for matching
modifications (default: 0.01). Used when converting from deltaMass.}

\item{verbose}{`logical(1)`. If `FALSE`, warnings about unrecognised
modifications are silenced (default: `TRUE`).}
}
\value{
Character vector with the sequences in the target annotation format
}
\description{
Converts modifications between different annotation formats for multiple
sequences at once. See the details and examples sections for more
information.  The annotation styles are inferred from the `modifications`
dataframe (see `?modifications`).
}
\details{
The function handles three main conversion scenarios:

\itemize{
  \item Name to deltaMass: \code{"M[Oxidation]PEPTIDE"} -> \code{"M[+15.994915]PEPTIDE"}
  \item Name to unimodId: \code{"M[Oxidation]PEPTIDE"} -> \code{"M[UNIMOD:35]PEPTIDE"}
  \item deltaMass to name: \code{"M[+15.995]PEPTIDE"} -> \code{"M[Oxidation]PEPTIDE"}
  \item deltaMass to unimodId: \code{"M[+15.995]PEPTIDE"} -> \code{"M[UNIMOD:35]PEPTIDE"}
  \item unimodId to name: \code{"M[UNIMOD:35]PEPTIDE"} -> \code{"M[Oxidation]PEPTIDE"}
  \item unimodId to deltaMass: \code{"M[UNIMOD:35]PEPTIDE"} -> \code{"M[+15.994915]PEPTIDE"}
}
}
\examples{
# Convert sequence from name to delta mass
convertAnnotation("M[Oxidation]PEPTIDE", convertToStyle = "deltaMass")
# Result: "M[+15.994915]PEPTIDE"

# Name to Unimod ID
convertAnnotation("M[Oxidation]PEPTIDE", convertToStyle = "unimodId")
# Result: "M[UNIMOD:35]PEPTIDE"

# Delta mass to name
convertAnnotation("M[+15.995]PEPTIDE", convertToStyle = "name")
# Result: "M[Oxidation]PEPTIDE"

# Multiple modifications
convertAnnotation("M[Oxidation]EVNES[Phospho]PEK", convertToStyle = "deltaMass")
# Result: "M[+15.994915]EVNES[+79.966331]PEK"

# Convert multiple sequences from name to delta mass
sequences <- c("M[Oxidation]PEPTIDE", "EVNES[Phospho]PEK", "PEPTIDE")
convertAnnotation(sequences, convertToStyle = "deltaMass")
# Result: c("M[+15.994915]PEPTIDE", "EVNES[+79.966331]PEK", "PEPTIDE")

# Convert from delta mass to name
sequences <- c("M[+15.995]PEPTIDE", "S[+79.966]EQUENCE")
convertAnnotation(sequences, convertToStyle = "name")
# Result: c("M[Oxidation]PEPTIDE", "S[Phospho]EQUENCE")

# Convert to Unimod IDs
sequences <- c("M[Oxidation]PEPTIDE", "C[Carbamidomethyl]PEPTIDE")
convertAnnotation(sequences, convertToStyle = "unimodId")
# Result: c("M[UNIMOD:35]PEPTIDE", "C[UNIMOD:4]PEPTIDE")

}
\author{
Guillaume Deflandre <guillaume.deflandre@uclouvain.be>
}
