% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/converters.R
\name{DIANNtoMSstatsPTMFormat}
\alias{DIANNtoMSstatsPTMFormat}
\title{Convert the output of DIA-NN PSM file into MSstatsPTM format}
\usage{
DIANNtoMSstatsPTMFormat(
  input,
  annotation,
  input_protein = NULL,
  annotation_protein = NULL,
  fasta_path = NULL,
  use_unmod_peptides = FALSE,
  protein_id_col = "Protein.Group",
  fasta_protein_name = "uniprot_ac",
  global_qvalue_cutoff = 0.01,
  qvalue_cutoff = 0.01,
  pg_qvalue_cutoff = 0.01,
  useUniquePeptide = TRUE,
  removeFewMeasurements = TRUE,
  removeOxidationMpeptides = TRUE,
  removeProtein_with1Feature = FALSE,
  MBR = TRUE,
  quantificationColumn = "FragmentQuantCorrected",
  use_log_file = TRUE,
  append = FALSE,
  verbose = TRUE,
  log_file_path = NULL
)
}
\arguments{
\item{input}{name of MSstats input report from Diann, which includes fragment-level data.
Output fragment data with --export-quant flag in DIA-NN 2.0}

\item{annotation}{name of 'annotation.txt' data which includes Condition, BioReplicate, Run.}

\item{input_protein}{same as \code{input} for global profiling run. Default is NULL.}

\item{annotation_protein}{same as \code{annotation} for global profiling run. Default is NULL.}

\item{fasta_path}{A string of path to a FASTA file, used to match PTM peptides.}

\item{use_unmod_peptides}{Boolean if the unmodified peptides in the input
file should be used to construct the unmodified protein output. Only used if
\code{input_protein} is not provided. Default is \code{FALSE}.}

\item{protein_id_col}{Use 'Protein.Groups'(default) column for protein name.}

\item{fasta_protein_name}{Name of column that matches with the protein names
in \code{protein_id_col}. The protein names in these two columns must match in
order to join the FASTA file with the DIA-NN output. Default is "uniprot_ac"
for uniprot ID. For uniprot mnemonic ID, use "entry_name"}

\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{useUniquePeptide}{should unique peptides be removed}

\item{removeFewMeasurements}{should proteins with few measurements be removed}

\item{removeOxidationMpeptides}{should peptides with oxidation be removed}

\item{removeProtein_with1Feature}{should proteins with a single feature be removed}

\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{use_log_file}{logical. If TRUE, information about data processing
will be saved to a file.}

\item{append}{logical. If TRUE, information about data processing will be added
to an existing log file.}

\item{verbose}{logical. If TRUE, information about data processing will be printed
to the console.}

\item{log_file_path}{character. Path to a file to which information about
data processing will be saved.
If not provided, such a file will be created automatically.
If \code{append = TRUE}, has to be a valid path to a file.}
}
\value{
\code{list} of one or two \code{data.frame} of class \code{MSstatsTMT}, named \code{PTM} and \code{PROTEIN}
}
\description{
Takes as input the \code{report.tsv} file from DIA-NN and converts it into
MSstatsPTM format. Requires PSM and an annotation file. Optionally an
additional \code{report.tsv} file for a corresponding global profiling run can
be included.
}
\examples{
# Example from PRIDE ID PXD053502
input = system.file("tinytest/raw_data/DIANN/report.tsv", 
                                        package = "MSstatsPTM")
input = data.table::fread(input)
annot = system.file("tinytest/raw_data/DIANN/annot.csv", 
                                        package = "MSstatsPTM")
annot = data.table::fread(annot)
fasta_path = system.file("extdata", "diann.fasta", 
                       package="MSstatsPTM")

msstatsptm_format = DIANNtoMSstatsPTMFormat(
    input, 
    annot, 
    protein_id_col = "Protein.Names", 
    fasta_path = fasta_path, 
    fasta_protein_name = "entry_name", 
    use_log_file = FALSE
)

head(msstatsptm_format$PTM)

# Example DIANN 2.0
input = system.file("tinytest/raw_data/DIANN/diann_2_ptm.parquet", 
                                        package = "MSstatsPTM")
input = arrow::read_parquet(input)
annot = system.file("tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv", 
                                        package = "MSstatsPTM")
annot = data.table::fread(annot)
fasta_path = system.file("extdata", "diann.fasta", 
                       package="MSstatsPTM")

msstatsptm_format = DIANNtoMSstatsPTMFormat(
    input, 
    annot, 
    protein_id_col = "Protein.Names", 
    fasta_path = fasta_path, 
    fasta_protein_name = "entry_name", 
    use_log_file = FALSE,
    quantificationColumn = "auto"
)

head(msstatsptm_format$PTM)

}
