% 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}
\alias{MSstatsClean,MSstatsMZMineFiles-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)

\S4method{MSstatsClean}{MSstatsMZMineFiles}(msstats_object, mzmine_annotations, sirius_annotations = NULL)
}
\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
scanned for isotope-labeled amino acids, which appear in parentheses
immediately after the labeled residue,
in the form \code{(<label>-<aminoAcid>-H)} for
the heavy label or \code{(<label>-<aminoAcid>-L)} for the light label.
For example, \code{K(label-K-H)} marks a heavy-labeled lysine (\code{K}).
Here \code{<aminoAcid>} is one of the single-letter codes in
\code{labeledAminoAcids}, and \code{<label>} is the label name (e.g.
\code{SILAC} or \code{label}). Sequences with no such parenthetical
tags are assigned \code{IsotopeLabelType = NA}. Once classified, the
parenthetical annotation is stripped out of \code{PeptideSequence},
leaving the plain amino acid sequence.

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

\item{mzmine_annotations}{\code{data.frame} of MZMine spectral-library
annotations with columns \code{id}, \code{compound_name}, \code{score}. Required;
passing \code{NULL} raises an error. The highest-scoring \code{compound_name}
per feature (MSI Level 2 putative identification via MS/MS spectral
matching) is used as \code{ProteinName}.}

\item{sirius_annotations}{Optional \code{data.frame} of SIRIUS
\code{structure_identifications.tsv} output, or \code{NULL}. Only the
\code{mappingFeatureId} and \code{name} columns are read; score columns
(\code{ConfidenceScoreExact}, \code{ConfidenceScoreApproximate},
\code{SiriusScore}) are ignored in this release. When supplied, the
SIRIUS \code{name} (MSI Level 3, in-silico structure prediction) fills
\code{ProteinName} for features that received no MZMine compound name.
The schema is validated against SIRIUS 6 output; users on other
versions can rename columns to match. Pass \code{NULL} to disable.}
}
\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

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

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

}
