% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/MSstatsConvert_core_functions.R
\name{MSstatsClean}
\alias{MSstatsClean}
\alias{MSstatsClean,MSstatsDIAUmpireFiles-method}
\alias{MSstatsClean,MSstatsMaxQuantFiles-method}
\alias{MSstatsClean,MSstatsOpenMSFiles-method}
\alias{MSstatsClean,MSstatsOpenSWATHFiles-method}
\alias{MSstatsClean,MSstatsProgenesisFiles-method}
\alias{MSstatsClean,MSstatsProteomeDiscovererFiles-method}
\alias{MSstatsClean,MSstatsSkylineFiles-method}
\alias{MSstatsClean,MSstatsSpectroMineFiles-method}
\alias{MSstatsClean,MSstatsSpectronautFiles-method}
\alias{MSstatsClean,MSstatsPhilosopherFiles-method}
\alias{MSstatsClean,MSstatsDIANNFiles-method}
\alias{MSstatsClean,MSstatsMetamorpheusFiles-method}
\alias{MSstatsClean,MSstatsProteinProspectorFiles-method}
\title{Clean files generated by a signal processing tools.}
\usage{
MSstatsClean(msstats_object, ...)

\S4method{MSstatsClean}{MSstatsDIAUmpireFiles}(msstats_object, use_frag, use_pept)

\S4method{MSstatsClean}{MSstatsMaxQuantFiles}(
  msstats_object,
  protein_id_col,
  remove_by_site = FALSE,
  channel_columns = "Reporterintensitycorrected"
)

\S4method{MSstatsClean}{MSstatsOpenMSFiles}(msstats_object)

\S4method{MSstatsClean}{MSstatsOpenSWATHFiles}(msstats_object)

\S4method{MSstatsClean}{MSstatsProgenesisFiles}(msstats_object, runs, fix_colnames = TRUE)

\S4method{MSstatsClean}{MSstatsProteomeDiscovererFiles}(
  msstats_object,
  quantification_column,
  protein_id_column,
  sequence_column,
  remove_shared,
  remove_protein_groups = TRUE,
  intensity_columns_regexp = "Abundance"
)

\S4method{MSstatsClean}{MSstatsSkylineFiles}(msstats_object)

\S4method{MSstatsClean}{MSstatsSpectroMineFiles}(msstats_object)

\S4method{MSstatsClean}{MSstatsSpectronautFiles}(
  msstats_object,
  intensity,
  calculateAnomalyScores,
  anomalyModelFeatures,
  peptideSequenceColumn = "EG.ModifiedSequence",
  heavyLabels = NULL
)

\S4method{MSstatsClean}{MSstatsPhilosopherFiles}(
  msstats_object,
  protein_id_col,
  peptide_id_col,
  channels,
  remove_shared_peptides
)

\S4method{MSstatsClean}{MSstatsDIANNFiles}(
  msstats_object,
  MBR = TRUE,
  quantificationColumn = "FragmentQuantCorrected",
  global_qvalue_cutoff = 0.01,
  qvalue_cutoff = 0.01,
  pg_qvalue_cutoff = 0.01,
  calculateAnomalyScores = FALSE,
  anomalyModelFeatures = c(),
  labeledAminoAcids = NULL
)

\S4method{MSstatsClean}{MSstatsMetamorpheusFiles}(msstats_object, MBR = TRUE, qvalue_cutoff = 0.05)

\S4method{MSstatsClean}{MSstatsProteinProspectorFiles}(msstats_object)
}
\arguments{
\item{msstats_object}{object that inherits from \code{MSstatsInputFiles} class.}

\item{...}{additional parameter to specific cleaning functions.}

\item{use_frag}{TRUE will use the selected fragment for each peptide.
'Selected_fragments' column is required.}

\item{use_pept}{TRUE will use the selected fragment for each protein
'Selected_peptides' column is required.}

\item{protein_id_col}{character, name of a column with names of proteins.}

\item{remove_by_site}{logical, if TRUE, proteins only identified by site will
be removed.}

\item{channel_columns}{character, regular expression that identifies channel columns
in TMT data.}

\item{runs}{chr, vector of Run labels.}

\item{fix_colnames}{lgl, if TRUE, one of the rows will be used as colnames.}

\item{quantification_column}{chr, name of a column used for quantification.}

\item{protein_id_column}{chr, name of a column with protein IDs.}

\item{sequence_column}{chr, name of a column with peptide sequences.}

\item{remove_shared}{lgl, if TRUE, shared peptides will be removed.}

\item{remove_protein_groups}{if TRUE, proteins with numProteins > 1 will be removed.}

\item{intensity_columns_regexp}{regular expressions that defines intensity columns.
Defaults to "Abundance", which means that columns that contain the word "Abundance"
will be treated as corresponding to intensities for different channels.}

\item{intensity}{Intensity column to use. Accepts legacy enum values
\code{'PeakArea'} (default, uses F.PeakArea), \code{'NormalizedPeakArea'}
(uses F.NormalizedPeakArea).  Can also be any raw
Spectronaut column name passed as a string (e.g.
\code{"FG.MS1Quantity"}); the column name is standardized internally.
For protein turnover workflows the recommended default is
\code{"FG.MS1Quantity"}.}

\item{calculateAnomalyScores}{Default is FALSE. If TRUE, will run anomaly detection model and calculate anomaly scores for each feature. Used downstream to weigh measurements in differential analysis.}

\item{anomalyModelFeatures}{character vector of quality metric column names to be used as features in the anomaly detection model. List must not be empty if calculateAnomalyScores=TRUE.}

\item{peptideSequenceColumn}{Name of the Spectronaut column that contains the
peptide sequence.  Defaults to \code{"EG.ModifiedSequence"}. The value is
standardized internally (dots and spaces removed) before column lookup.}

\item{heavyLabels}{Character list identifying the heavy isotope labels as it
appears inside square brackets in the peptide sequence column, e.g.
\code{c("Lys6")} matches peptides containing \code{[Lys6]}.
\code{c("Lys6", "Arg10")} matches peptides containing either \code{[Lys6]} or \code{[Arg10]}.
Supports any novel label name reported by Spectronaut (e.g. \code{"Leu6"},
\code{"Phe10"}).  When provided, peptides are
classified as heavy (\code{IsotopeLabelType = "H"}), light
(\code{IsotopeLabelType = "L"}), or unlabeled
(\code{IsotopeLabelType = NA}) based on its labeled sequence.  When
\code{NULL} (default) all peptides receive \code{IsotopeLabelType = "L"}.
Useful for protein turnover experiments.}

\item{peptide_id_col}{character name of a column that identifies peptides}

\item{channels}{character vector of channel labels}

\item{remove_shared_peptides}{logical, if TRUE, shared peptides will be
removed based on the IsUnique column from Philosopher output}

\item{MBR}{True if analysis was done with match between runs}

\item{quantificationColumn}{Use 'FragmentQuantCorrected'(default) column for quantified intensities for DIANN 1.8.x.
Use 'FragmentQuantRaw' for quantified intensities for DIANN 1.9.x.
Use 'auto' for quantified intensities for DIANN 2.x where each fragment intensity is a separate column, e.g. Fr0Quantity.}

\item{global_qvalue_cutoff}{The qvalue cutoff for the Q.Value column, i.e.
the run-specific precursor q-value. Default is 0.01.}

\item{qvalue_cutoff}{If MBR is false, the qvalue cutoff for the Global.Q.Value
column, i.e. global precursor q-value.  If MBR is true, the qvalue cutoff for the
Lib.Q.Value column, i.e. the q-value for the library created after the first MBR pass.
Default is 0.01.}

\item{pg_qvalue_cutoff}{If MBR is false, the qvalue cutoff for the Global.PG.Q.Value
column, i.e. the global q-value for the protein group.  If MBR is true, the
qvalue cutoff for the Lib.PG.Q.Value column, i.e. the protein group q-value for
the library created after the first MBR pass. Default is 0.01.}

\item{labeledAminoAcids}{Character vector of single-letter amino acid codes
that carry the SILAC label in protein turnover experiments, e.g.
\code{c("K")} or \code{c("K", "R")}.  Supplying this vector opts in to
protein-turnover mode; the exact amino acids determine behaviour only in the
\code{ModifiedSequence}-parsing path described below.

\strong{Channel-based path} (DIA-NN 2.x exports that include a
\code{Channel} column): when \code{labeledAminoAcids} is non-\code{NULL}
\emph{and} the input contains a \code{Channel} column, \code{Channel} values
are mapped directly to \code{IsotopeLabelType} (\code{"H"} → \code{"H"},
\code{"L"} → \code{"L"}, anything else → \code{NA}).  The amino acid codes
in \code{labeledAminoAcids} are \strong{not} used to validate or filter
\code{ModifiedSequence} in this path.

\strong{ModifiedSequence-parsing path} (DIA-NN 1.x exports without a
\code{Channel} column): when \code{labeledAminoAcids} is non-\code{NULL}
and no \code{Channel} column is present, each \code{ModifiedSequence} is
inspected for SILAC suffixes of the form \code{(SILAC-<AA>-H)} or
\code{(SILAC-<AA>-L)}, where \code{<AA>} is one of the supplied amino acid
codes.  Matching sequences are classified as \code{"H"} or \code{"L"};
sequences carrying neither suffix receive \code{IsotopeLabelType = NA}.
The SILAC suffix is then stripped from \code{PeptideSequence}.

When \code{NULL} (default), protein-turnover mode is disabled and all
peptides receive \code{IsotopeLabelType = "Light"}.}
}
\value{
data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table

data.table
}
\description{
Clean files generated by a signal processing tools.

Clean DIAUmpire files

Clean MaxQuant files

Clean OpenMS files

Clean OpenSWATH files

Clean Progenesis files

Clean ProteomeDiscoverer files

Clean Skyline files

Clean SpectroMine files

Clean Spectronaut files

Clean Philosopher files

Clean DIA-NN files

Clean Metamorpheus files

Clean Protein Prospector files
}
\examples{
evidence_path = system.file("tinytest/raw_data/MaxQuant/mq_ev.csv", 
                            package = "MSstatsConvert")
pg_path = system.file("tinytest/raw_data/MaxQuant/mq_pg.csv", 
                      package = "MSstatsConvert")
evidence = read.csv(evidence_path)
pg = read.csv(pg_path)
imported = MSstatsImport(list(evidence = evidence, protein_groups = pg),
                         "MSstats", "MaxQuant")
cleaned_data = MSstatsClean(imported, protein_id_col = "Proteins")
head(cleaned_data)

}
