From f3252cf2bf24a2a14fdb2fe8ef2523ade8271ade Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Wed, 18 Feb 2026 14:48:23 -0500 Subject: [PATCH 1/5] initial fixes for the DIANN 2.0 PTM converter --- R/converters.R | 34 ++++++++++++++---- .../DIANN/annotation_diann_2.0_ptm.csv | 9 +++++ .../raw_data/DIANN/diann_2_ptm.parquet | Bin 0 -> 51941 bytes man/DIANNtoMSstatsPTMFormat.Rd | 34 +++++++++++++++--- 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 inst/tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv create mode 100644 inst/tinytest/raw_data/DIANN/diann_2_ptm.parquet diff --git a/R/converters.R b/R/converters.R index 108cc41..9e1796f 100644 --- a/R/converters.R +++ b/R/converters.R @@ -7,10 +7,8 @@ #' #' @importFrom data.table as.data.table #' @importFrom MSstatsConvert DIANNtoMSstatsFormat +#' @inheritParams MSstatsConvert::DIANNtoMSstatsFormat #' -#' @param input data.frame of `report.tsv` file produced by Philosopher -#' @param annotation annotation with Run, Fraction, TechRepMixture, Mixture, Channel, -#' BioReplicate, Condition columns or a path to file. Refer to the example 'annotation' for the meaning of each column. #' @param input_protein same as `input` for global profiling run. Default is NULL. #' @param annotation_protein same as `annotation` for global profiling run. Default is NULL. #' @param fasta_path A string of path to a FASTA file, used to match PTM peptides. @@ -31,7 +29,6 @@ #' @param removeFewMeasurements TRUE (default) will remove the features that have 1 or 2 measurements within each Run. #' @param removeOxidationMpeptides TRUE (default) will remove the peptides including oxidation (M) sequence. #' @param removeProtein_with1Feature TRUE will remove the proteins which have only 1 peptide and charge. Defaut is FALSE. -#' @param MBR If analaysis was done with match between runs or not. Default is TRUE. #' @param use_log_file logical. If TRUE, information about data processing will #' be saved to a file. #' @param append logical. If TRUE, information about data processing will be @@ -68,6 +65,28 @@ #' #' 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) +#' DIANNtoMSstatsPTMFormat = function(input, annotation, input_protein=NULL, @@ -84,6 +103,7 @@ DIANNtoMSstatsPTMFormat = function(input, removeOxidationMpeptides = TRUE, removeProtein_with1Feature = FALSE, MBR=TRUE, + quantificationColumn = "FragmentQuantCorrected", use_log_file = TRUE, append = FALSE, verbose = TRUE, @@ -133,7 +153,8 @@ DIANNtoMSstatsPTMFormat = function(input, append, verbose, log_file_path, - MBR) + MBR, + quantificationColumn = quantificationColumn) msstats_format = list(PTM=ptm_input, PROTEIN=NULL) @@ -154,7 +175,8 @@ DIANNtoMSstatsPTMFormat = function(input, append, verbose, log_file_path, - MBR) + MBR, + quantificationColumn = quantificationColumn) msstats_format = list(PTM=ptm_input, PROTEIN=protein_input) diff --git a/inst/tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv b/inst/tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv new file mode 100644 index 0000000..d876c3b --- /dev/null +++ b/inst/tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv @@ -0,0 +1,9 @@ +Run,BioReplicate,Condition +Run1,1,Control +Run2,2,Control +Run3,3,Control +Run4,4,Control +Run5,5,Treatment +Run6,6,Treatment +Run7,7,Treatment +Run8,8,Treatment diff --git a/inst/tinytest/raw_data/DIANN/diann_2_ptm.parquet b/inst/tinytest/raw_data/DIANN/diann_2_ptm.parquet new file mode 100644 index 0000000000000000000000000000000000000000..b3b64b0d0cc46a3f2c5682510fb4d0909c760b59 GIT binary patch literal 51941 zcmeHw33wDm*X~S6U`L=upF2N3~*+*8$EJ>5N%N#x%DzxTP%pT~r*(^cm^bxxhC z>Z(&^EEn(TXzR#221hzNII4Q7RIab7;71L=Ht^d4er@5`4t_hrZzuS5R5|u{bRF#I z0wp>+0=2t0&g!D>U^i*|y-C|$fMK25F_Cg)`(qCAm7_enX;eD+^@3k-`1OHb-)