1919# ' function \code{\link[MSstatsPTM]{dataSummarizationPTM}} or
2020# ' \code{\link[MSstatsPTM]{dataSummarizationPTM_TMT}} depending on acquisition
2121# ' type.
22- # ' @param data.type Type of data. Must be one of `LF` or `TMT`. Will be deprecated
23- # ' in favor of ptm_label_type and protein_label_type.
2422# ' @param contrast.matrix comparison between conditions of interests. Default
2523# ' models full pairwise comparison between all conditions
24+ # ' @param ptm_label_type Type of quantification used in the PTM dataset.
25+ # ' Must be either `"LF"` (label-free) or `"TMT"` (Tandem Mass Tag isobaric labeling).
26+ # ' Choose `"LF"` for label-free quantification or `"TMT"` for TMT-labeled experiments.
27+ # ' Default is `"LF"`.
28+ # ' @param protein_label_type Type of quantification used in the protein dataset.
29+ # ' Must be either `"LF"` (label-free) or `"TMT"` (Tandem Mass Tag isobaric labeling).
30+ # ' Choose `"LF"` for label-free quantification or `"TMT"` for TMT-labeled experiments.
31+ # ' Default is `"LF"`.
2632# ' @param moderated For TMT experiments only. TRUE will moderate t statistic;
2733# ' FALSE (default) uses ordinary t statistic. Default is FALSE.
2834# ' @param adj.method For TMT experiments only. Adjusted method for multiple
4248# ' If not provided, such a file will be created automatically.
4349# ' If `append = TRUE`, has to be a valid path to a file.
4450# ' @param base start of the file name.
45- # ' @param ptm_label_type Indicator of labeling type for PTM dataset. Must be one
46- # ' of `LF` or `TMT`
47- # ' @param protein_label_type Indicator of labeling type for PROTEIN dataset.
48- # ' Must be one of `LF` or `TMT`
4951# ' @return list of modeling results. Includes PTM, PROTEIN, and ADJUSTED
5052# ' data.tables with their corresponding model results.
5153# '
5658# ' protein_label_type="LF",
5759# ' verbose = FALSE)
5860groupComparisonPTM = function (data ,
59- data.type = NULL ,
6061 contrast.matrix = " pairwise" ,
62+ ptm_label_type = c(" LF" , " TMT" ),
63+ protein_label_type = c(" LF" , " TMT" ),
6164 moderated = FALSE ,
6265 adj.method = " BH" ,
6366 log_base = 2 ,
@@ -66,37 +69,11 @@ groupComparisonPTM = function(data,
6669 append = FALSE ,
6770 verbose = TRUE ,
6871 log_file_path = NULL ,
69- base = " MSstatsPTM_log_" ,
70- ptm_label_type = " LF" ,
71- protein_label_type = " LF" ) {
72-
73- # # Start log
74- # if (is.null(log_file_path) & use_log_file == TRUE){
75- # time_now = Sys.time()
76- # path = paste0(base, gsub("[ :\\-]", "_", time_now),
77- # ".log")
78- # file.create(path)
79- # } else {path = log_file_path}
80- #
81- # if (data.type == 'TMT'){
82- # pkg = "MSstatsTMT"
83- # option_log = "MSstatsTMTLog"
84- # } else {
85- # pkg = "MSstats"
86- # option_log = "MSstatsLog"
87- # }
88- #
89- # MSstatsLogsSettings(use_log_file, append,
90- # verbose, log_file_path = path,
91- # pkg_name = pkg)
92-
93- # getOption(option_log)("INFO", "Starting parameter and data checks..")
94- if (! is.null(data.type ) && (data.type == " TMT" || data.type == " LF" )) {
95- ptm_label_type = data.type
96- protein_label_type = data.type
97- }
72+ base = " MSstatsPTM_log_" ) {
9873
9974 Label = Site = NULL
75+ ptm_label_type = match.arg(ptm_label_type )
76+ protein_label_type = match.arg(protein_label_type )
10077
10178 data.ptm = data [[" PTM" ]]
10279 data.protein = data [[" PROTEIN" ]]
@@ -111,7 +88,6 @@ groupComparisonPTM = function(data,
11188
11289 # # Create pairwise matrix for label free
11390 if (contrast.matrix [1 ] == " pairwise" ){
114- # getOption(option_log)("INFO", "Building pairwise matrix.")
11591 if (" GROUP" %in% colnames(data.ptm $ ProteinLevelData )) {
11692 labels <- unique(data.ptm $ ProteinLevelData $ GROUP )
11793 } else if (" Condition" %in% colnames(data.ptm $ ProteinLevelData )) {
@@ -125,7 +101,6 @@ groupComparisonPTM = function(data,
125101 # # PTM Modeling
126102 message(" Starting PTM modeling..." )
127103 if (ptm_label_type == " TMT" ){
128- # getOption(option_log)("INFO", "Starting TMT PTM Model")
129104 ptm_model_full = groupComparisonTMT(data.ptm ,
130105 contrast.matrix = contrast.matrix ,
131106 moderated = moderated ,
@@ -139,7 +114,6 @@ groupComparisonPTM = function(data,
139114 ptm_model_site_sep = ptm_model_full $ ComparisonResult
140115 ptm_model_details = ptm_model_full $ FittedModel
141116 } else if (ptm_label_type == " LF" ) {
142- # getOption(option_log)("INFO", "Starting non-TMT PTM Model")
143117 ptm_model_full = groupComparison(contrast.matrix ,
144118 data.ptm , save_fitted_models , log_base )# ,
145119 # use_log_file, append, verbose,
@@ -156,7 +130,6 @@ groupComparisonPTM = function(data,
156130 # # Protein Modeling
157131 message(" Starting Protein modeling..." )
158132 if (protein_label_type == " TMT" ){
159- # getOption(option_log)("INFO", "Starting TMT Protein Model")
160133 protein_model_full = groupComparisonTMT(data.protein ,
161134 contrast.matrix = contrast.matrix ,
162135 moderated = moderated ,
@@ -169,7 +142,6 @@ groupComparisonPTM = function(data,
169142 protein_model = protein_model_full $ ComparisonResult
170143 protein_model_details = protein_model_full $ FittedModel
171144 } else if (protein_label_type == " LF" ) {
172- # getOption(option_log)("INFO", "Starting non-TMT Protein Model")
173145 protein_model_full = groupComparison(contrast.matrix ,
174146 data.protein , save_fitted_models ,
175147 log_base , use_log_file )# ,
@@ -183,20 +155,16 @@ groupComparisonPTM = function(data,
183155 protein_model = as.data.table(protein_model )
184156
185157 message(" Starting adjustment..." )
186- # getOption(option_log)("INFO", "Starting Protein Adjustment")
187158 ptm_model_site_sep = copy(ptm_model )
188159
189160 # # extract global protein name
190161 ptm_model_site_sep = .extractProtein(ptm_model_site_sep , protein_model )
191- # getOption(option_log)("INFO", "Rcpp function extracted protein info")
192162
193163 # # adjustProteinLevel function can only compare one label at a time
194164 comparisons = unique(ptm_model_site_sep [, Label ])
195165
196166 adjusted_model_list = list ()
197167 for (i in seq_len(length(comparisons ))) {
198- # getOption(option_log)("INFO", paste0("Adjusting for Comparison - ",
199- # as.character(i)))
200168 temp_adjusted_model = .applyPtmAdjustment(comparisons [[i ]],
201169 ptm_model_site_sep ,
202170 protein_model )
@@ -235,19 +203,12 @@ groupComparisonPTM = function(data,
235203 use.names = TRUE )
236204 adjusted_models = adjusted_models [! is.na(adjusted_models $ Protein )]
237205
238- # getOption(option_log)("INFO", "Adjustment complete, returning models.")
239206 models = list (' PTM.Model' = ptm_model ,
240207 ' PROTEIN.Model' = protein_model ,
241208 ' ADJUSTED.Model' = adjusted_models ,
242209 ' Model.Details' = list (' PTM' = ptm_model_details ,
243210 ' PROTEIN' = protein_model_details ))
244211 }
245-
246- if (! is.null(data.type ) && (data.type == " TMT" || data.type == " LF" )) {
247- warning(" DEPRECATION NOTICE: The `data.type` argument is being deprecated.
248- Please use `ptm_label_type` and `protein_label_type` instead ahead
249- of Release 3.22" )
250- }
251212
252213 return (models )
253214
0 commit comments