diff --git a/DESCRIPTION b/DESCRIPTION index 70171d0..b1b8d96 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,5 +42,5 @@ biocViews: ImmunoOncology, MassSpectrometry, Proteomics, Software, ShinyApps, BugReports: https://github.com/Vitek-Lab/MSstatsShiny/issues Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.3 Config/testthat/edition: 3 +Config/roxygen2/version: 8.0.0 diff --git a/NAMESPACE b/NAMESPACE index 63cc7e1..51808ba 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -218,9 +218,6 @@ importFrom(tools,file_ext) importFrom(utils,capture.output) importFrom(utils,head) importFrom(utils,packageVersion) -importFrom(utils,read.csv) -importFrom(utils,read.delim) -importFrom(utils,read.table) importFrom(utils,txtProgressBar) importFrom(utils,write.csv) importFrom(utils,write.table) diff --git a/R/MSstatsShiny.R b/R/MSstatsShiny.R index 5cef4ae..e4ef1eb 100644 --- a/R/MSstatsShiny.R +++ b/R/MSstatsShiny.R @@ -39,7 +39,7 @@ #' @importFrom MSstatsPTM dataProcessPlotsPTM groupComparisonPlotsPTM MaxQtoMSstatsPTMFormat PDtoMSstatsPTMFormat FragPipetoMSstatsPTMFormat SkylinetoMSstatsPTMFormat MetamorpheusToMSstatsPTMFormat SpectronauttoMSstatsPTMFormat #' @importFrom MSstatsBioNet exportNetworkToHTML deleteEdgeFromNetwork #' @importFrom MSstatsResponse futureExperimentSimulation run_tpr_simulation plot_tpr_power_curve calculateTurnoverRatios -#' @importFrom utils capture.output head packageVersion read.csv read.delim write.csv +#' @importFrom utils capture.output head packageVersion write.csv #' @importFrom stats aggregate #' @importFrom methods is #' @importFrom readxl read_excel diff --git a/R/module-loadpage-server.R b/R/module-loadpage-server.R index 1bca0ba..35f45f8 100644 --- a/R/module-loadpage-server.R +++ b/R/module-loadpage-server.R @@ -187,7 +187,7 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa ui_elements <- tagList(ui_elements, create_spectronaut_standard_ui(session$ns)) } - tagList(ui_elements, create_separator_buttons(session$ns, "sep_specdata")) + ui_elements }) output$spectronaut_turnover_ui <- renderUI({ @@ -305,7 +305,6 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa # enable("proceed1") # }) - # can remove separator is.null check because shiny by default assigns the first value as the default value for radiobutton observe({ disable("proceed1") if(((input$BIO == "Protein") || (input$BIO == "Peptide"))) { @@ -316,12 +315,11 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa enable("proceed1") } } else if (input$filetype == "msstats") { - if(!is.null(input$msstatsdata) && !is.null(input$sep_msstatsdata)) { + if(!is.null(input$msstatsdata)) { enable("proceed1") } } else if (input$filetype == "sky") { - print(input$sep_skylinedata) - if(!is.null(input$skylinedata) && !is.null(input$sep_skylinedata)) { # && !is.null(input$annot) + if(!is.null(input$skylinedata)) { enable("proceed1") } } else if (input$filetype == "maxq") { @@ -329,17 +327,17 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa enable("proceed1") } } else if (input$filetype == "prog" || input$filetype == "PD" || input$filetype == "open" || input$filetype == "phil" || input$filetype == "meta") { - if(!is.null(input$data) && !is.null(input$sep_data)) { # && !is.null(input$annot) + if(!is.null(input$data)) { enable("proceed1") } } else if (input$filetype == "openms") { - if(!is.null(input$data) && !is.null(input$sep_data)) { + if(!is.null(input$data)) { enable("proceed1") } } else if (input$filetype == "spec") { spec_regular_file_ok <- !isTRUE(input$big_file_spec) && !is.null(input$specdata) spec_big_file_ok <- isTRUE(input$big_file_spec) && length(local_big_file_path()) > 0 - if((spec_regular_file_ok || spec_big_file_ok) && !is.null(input$sep_specdata)) { + if(spec_regular_file_ok || spec_big_file_ok) { enable("proceed1") } } else if (input$filetype == "ump") { @@ -347,7 +345,7 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa enable("proceed1") } } else if (input$filetype == "diann") { - if(!is.null(input$dianndata) && !is.null(input$sep_dianndata)) { # && !is.null(input$annot) + if(!is.null(input$dianndata)) { enable("proceed1") } } @@ -362,21 +360,21 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa enable("proceed1") } } else if (input$filetype == "PD") { - if(!is.null(input$data) && !is.null(input$sep_data)) { # && !is.null(input$annot) + if(!is.null(input$data)) { enable("proceed1") } } else if (input$filetype == "openms") { - if(!is.null(input$data) && !is.null(input$sep_data)) { + if(!is.null(input$data)) { enable("proceed1") } } else if (input$filetype == "spmin" || input$filetype == "phil") { - if(!is.null(input$data) && !is.null(input$sep_data)) { # && !is.null(input$annot) + if(!is.null(input$data)) { enable("proceed1") } } } } - + } else if ((input$BIO == "PTM")) { if (input$DDA_DIA == "LType" || input$DDA_DIA == "TMT") { @@ -384,7 +382,7 @@ loadpageServer <- function(id, parent_session, is_web_server = FALSE, app_templa if (input$filetype == "sample") { enable("proceed1") } else if (input$filetype == "msstats") { - if(!is.null(input$msstatsptmdata) && !is.null(input$sep_msstatsptmdata)) { + if(!is.null(input$msstatsptmdata)) { enable("proceed1") } } else if (input$filetype == "sky" || input$filetype == "maxq" || input$filetype == "spec" || input$filetype == "PD" || input$filetype == "meta") { diff --git a/R/module-loadpage-ui.R b/R/module-loadpage-ui.R index 5e4b476..2de45d0 100644 --- a/R/module-loadpage-ui.R +++ b/R/module-loadpage-ui.R @@ -215,8 +215,7 @@ create_standard_uploads <- function(ns) { condition = "(input['loadpage-filetype'] =='10col' || input['loadpage-filetype'] =='prog' || input['loadpage-filetype'] =='PD' || input['loadpage-filetype'] =='open'|| input['loadpage-filetype'] =='openms' || input['loadpage-filetype'] =='spmin' || input['loadpage-filetype'] == 'phil' || input['loadpage-filetype'] == 'meta') && input['loadpage-BIO'] != 'PTM'", h4("4. Upload quantification dataset"), - fileInput(ns('data'), "", multiple = FALSE, accept = NULL), - create_separator_buttons(ns, "sep_data") + fileInput(ns('data'), "", multiple = FALSE, accept = NULL) ) } @@ -240,8 +239,7 @@ create_msstats_uploads <- function(ns) { conditionalPanel( condition = "input['loadpage-filetype'] == 'msstats' && (input['loadpage-BIO'] != 'PTM' && (input['loadpage-BIO'] != 'PTM' && input['loadpage-DDA_DIA'] != 'TMT'))", h4("4. Upload data in MSstats Format"), - fileInput(ns('msstatsdata'), "", multiple = FALSE, accept = NULL), - create_separator_buttons(ns, "sep_msstatsdata") + fileInput(ns('msstatsdata'), "", multiple = FALSE, accept = NULL) ), # PTM MSstats format @@ -249,8 +247,7 @@ create_msstats_uploads <- function(ns) { condition = "input['loadpage-filetype'] == 'msstats' && (input['loadpage-BIO'] == 'PTM' || (input['loadpage-BIO'] == 'PTM' && input['loadpage-DDA_DIA'] == 'TMT'))", h4("4. Upload PTM data in MSstats Format"), fileInput(ns('msstatsptmdata'), "", multiple = FALSE, accept = NULL), - create_separator_buttons(ns, "sep_msstatsptmdata"), - + h4("5. (Optional) Upload unmodified data in MSstats Format"), fileInput(ns('unmod'), "", multiple = FALSE, accept = NULL), tags$br() @@ -264,8 +261,7 @@ create_skyline_uploads <- function(ns) { conditionalPanel( condition = "input['loadpage-filetype'] == 'sky' && input['loadpage-BIO'] != 'PTM'", h4("4. Upload MSstats report from Skyline"), - fileInput(ns('skylinedata'), "", multiple = FALSE, accept = NULL), - create_separator_buttons(ns, "sep_skylinedata") + fileInput(ns('skylinedata'), "", multiple = FALSE, accept = NULL) ) } @@ -275,8 +271,7 @@ create_diann_uploads <- function(ns) { conditionalPanel( condition = "input['loadpage-filetype'] == 'diann' && input['loadpage-BIO'] != 'PTM'", h4("4. Upload MSstats report from DIANN"), - fileInput(ns('dianndata'), "", multiple = FALSE, accept = NULL), - create_separator_buttons(ns, "sep_dianndata") + fileInput(ns('dianndata'), "", multiple = FALSE, accept = NULL) ) } @@ -664,19 +659,3 @@ create_quality_filtering_options <- function(ns) { ) ) } - - -#' Create column separator radio buttons -#' -#' @param ns Namespace function -#' @param input_id ID for the radio button input -#' @noRd -create_separator_buttons <- function(ns, input_id) { - radioButtons(ns(input_id), - label = h5("Column separator in uploaded file", class = "icon-wrapper", - icon("question-circle", lib = "font-awesome"), - div("Choose how columns are separated in the uploaded file", class = "icon-tooltip")), - c(Comma=",", Semicolon=";", Tab="\t", Pipe="|"), - inline = TRUE - ) -} \ No newline at end of file diff --git a/R/module-visualize-network-server.R b/R/module-visualize-network-server.R index 9ce7d5f..ee20e67 100644 --- a/R/module-visualize-network-server.R +++ b/R/module-visualize-network-server.R @@ -111,7 +111,7 @@ loadCsvData <- function(input, dataComparison) { } req(input$dataUpload) tryCatch({ - read.csv(input$dataUpload$datapath) + data.table::fread(input$dataUpload$datapath) }, error = function(e) { showNotification(paste("Error reading file:", e$message), type = "error") return(NULL) @@ -535,7 +535,7 @@ visualizeNetworkServer <- function(id, parent_session, dataComparison) { codes <- paste(codes, "library(MSstatsBioNet)\nlibrary(dplyr)\n\n", sep = "") codes <- paste(codes, "# Read data\n", sep = "") - codes <- paste(codes, "df <- read.csv(\"path/to/your/data.csv\")\n\n", sep = "") + codes <- paste(codes, "df <- data.table::fread(\"path/to/your/data.csv\")\n\n", sep = "") # Add label filtering if not default if (params$selectedLabel != "" && !is.null(params$selectedLabel)) { diff --git a/R/plotting_funtions.R b/R/plotting_funtions.R index 89d2aea..a202b47 100644 --- a/R/plotting_funtions.R +++ b/R/plotting_funtions.R @@ -82,7 +82,7 @@ #' @importFrom grDevices dev.off pdf #' @importFrom graphics image mtext par plot.new #' @importFrom stats dist hclust qt -#' @importFrom utils read.table write.table +#' @importFrom utils write.table #' #' @examples #' data("dia_skyline_model") @@ -136,7 +136,7 @@ groupComparisonPlots2 = function(data=data, } finalfile = lastfilename - processout = as.matrix(read.table(finalfile, header=TRUE, sep="\t")) + processout = as.matrix(data.table::fread(finalfile)) } processout = rbind(processout, as.matrix(c(" ", " ", "MSstats - groupComparisonPlots function", " "), ncol=1)) diff --git a/R/utils.R b/R/utils.R index e3af653..728079b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -89,7 +89,7 @@ getEvidence <- function(input) { if(is.null(input$evidence)) { return(NULL) } - evidence = try(read.table(evidence$datapath, sep="\t", header=TRUE), silent=TRUE) + evidence = try(data.table::fread(evidence$datapath), silent=TRUE) if (is(evidence,"try-error")) { evidence = "File load error. Please ensure file is in csv format." } @@ -103,7 +103,7 @@ getEvidence2 <- function(input) { if(is.null(input$evidence2)) { return(NULL) } - evidence2 = try(read.delim(evidence2$datapath), silent=TRUE) + evidence2 = try(data.table::fread(evidence2$datapath), silent=TRUE) if (is(evidence2,"try-error")) { evidence2 = "File load error. Please ensure file is in csv format." } @@ -117,8 +117,7 @@ getGlobal <- function(input) { if(is.null(input$unmod)) { return(NULL) } - unmod = try(read.csv(unmod$datapath, sep=",", header=TRUE, - stringsAsFactors=FALSE), silent=TRUE) + unmod = try(data.table::fread(unmod$datapath), silent=TRUE) if (is(unmod,"try-error")) { unmod = "File load error. Please ensure file is in csv format." } @@ -133,7 +132,7 @@ getProteinGroups <- function(input) { if(is.null(input$pGroup)) { return(NULL) } - pGroup = try(read.table(pGroup$datapath, sep="\t", header=TRUE), silent=TRUE) + pGroup = try(data.table::fread(pGroup$datapath), silent=TRUE) if (is(pGroup,"try-error")) { pGroup = "File load error. Please ensure file is in csv format." } @@ -147,7 +146,7 @@ getProteinGroups2 <- function(input) { if(is.null(input$pGroup2)) { return(NULL) } - pGroup2 = try(read.delim(pGroup2$datapath), silent=TRUE) + pGroup2 = try(data.table::fread(pGroup2$datapath), silent=TRUE) if (is(pGroup2,"try-error")) { pGroup2 = "File load error. Please ensure file is in csv format." } @@ -160,8 +159,7 @@ getFragSummary <- function(input) { if(is.null(input$fragSummary)) { return(NULL) } - fragSummary = try(read.table(fragSummary$datapath, sep="\t", header=TRUE), - silent=TRUE) + fragSummary = try(data.table::fread(fragSummary$datapath), silent=TRUE) if (is(fragSummary,"try-error")) { fragSummary = "File load error. Please ensure file is in excel format." } @@ -174,8 +172,7 @@ getPeptideSummary <- function(input) { if(is.null(input$peptideSummary)) { return(NULL) } - peptideSummary = try(read.table(peptideSummary$datapath, sep="\t", - header=TRUE), silent=TRUE) + peptideSummary = try(data.table::fread(peptideSummary$datapath), silent=TRUE) if (is(peptideSummary,"try-error")) { peptideSummary = "File load error. Please ensure file is in csv format." } @@ -188,8 +185,7 @@ getProtSummary <- function(input) { if(is.null(input$protSummary)) { return(NULL) } - protSummary = try(read.table(protSummary$datapath, sep="\t", header=TRUE), - silent=TRUE) + protSummary = try(data.table::fread(protSummary$datapath), silent=TRUE) if (is(protSummary,"try-error")) { protSummary = "File load error. Please ensure file is in csv format." } @@ -202,7 +198,7 @@ getMaxqPtmSites <- function(input) { if(is.null(input$maxq_ptm_sites)) { return(NULL) } - maxq_ptm_sites = try(read.delim(maxq_ptm_sites$datapath), silent=TRUE) + maxq_ptm_sites = try(data.table::fread(maxq_ptm_sites$datapath), silent=TRUE) if (is(maxq_ptm_sites,"try-error")) { maxq_ptm_sites = "File load error. Please ensure file is in csv format." } @@ -216,7 +212,7 @@ getAnnot3 <- function(input) { if(is.null(input$annot3)) { return(NULL) } - annot3 = try(read.delim(annot3$datapath, sep=","), silent=TRUE) + annot3 = try(data.table::fread(annot3$datapath), silent=TRUE) if (is(annot3,"try-error")) { annot3 = "File load error. Please ensure file is in csv format." } @@ -230,7 +226,7 @@ getAnnot2 <- function(input) { if(is.null(input$annot2)) { return(NULL) } - annot2=try(read.csv(annot1$datapath, header = TRUE), silent=TRUE) + annot2=try(data.table::fread(annot1$datapath), silent=TRUE) if (is(annot2,"try-error")) { annot2 = "File load error. Please ensure file is in csv format." @@ -251,7 +247,7 @@ getAnnot <- function(input) { return(annotation.pd) } print("before reading annot file") - annot_file = try(read.csv(annot$datapath), silent=TRUE) + annot_file = try(data.table::fread(annot$datapath), silent=TRUE) print("after reading annot file") if(is(annot_file,"try-error")) { annot_file = "File load error. Please ensure file is in csv format." @@ -264,7 +260,7 @@ getAnnot1 <- function(input) { if(is.null(input$annot1)) { return(NULL) } - annot1=try(read.csv(annot1$datapath, header = TRUE), silent=TRUE) + annot1=try(data.table::fread(annot1$datapath), silent=TRUE) if (is(annot1,"try-error")) { annot1 = "File load error. Please ensure file is in csv format." @@ -310,9 +306,8 @@ getData <- function(input) { mydata = MSstats::DDARawData } else if(input$BIO != "PTM" && input$DDA_DIA =='LType' && input$LabelFreeType == "DIA"){ - mydata = read.csv(system.file("extdata/dataset.csv", - package = "MSstatsShiny"), - header = TRUE, sep = ";") + mydata = data.table::fread(system.file("extdata/dataset.csv", + package = "MSstatsShiny")) } else if(input$BIO != "PTM" && input$DDA_DIA == "TMT"){ mydata = PDtoMSstatsTMTFormat(input = MSstatsTMT::raw.pd, @@ -331,9 +326,9 @@ getData <- function(input) { } else if (input$BIO == 'PTM' || (input$BIO == 'PTM' && input$DDA_DIA == 'TMT')){ if (input$filetype == 'maxq') { - mydata = read.csv(input$ptm_input$datapath,sep="\t") # it needs default tab sep file + mydata = data.table::fread(input$ptm_input$datapath) print(input$globaldata$datapath) - mydata_protein = try(read.csv(input$ptm_protein_input$datapath,sep="\t"),silent=TRUE) + mydata_protein = try(data.table::fread(input$ptm_protein_input$datapath),silent=TRUE) if (typeof(mydata_protein)=="character"){ mydata_protein=NULL use_unmod_peptides=TRUE @@ -341,8 +336,8 @@ getData <- function(input) { use_unmod_peptides=FALSE } - pg_maxq_ptm = try(read.csv(input$ptm_pgroup$datapath, sep="\t"),silent=TRUE) - annotation = try(read.csv(input$ptm_annot$datapath),silent=TRUE) + pg_maxq_ptm = try(data.table::fread(input$ptm_pgroup$datapath),silent=TRUE) + annotation = try(data.table::fread(input$ptm_annot$datapath),silent=TRUE) if (input$BIO == "PTM" && input$DDA_DIA == "TMT"){ label = "TMT" } else { @@ -362,10 +357,10 @@ getData <- function(input) { } else if(input$filetype=='phil'){ - mydata = read.csv(input$ptmdata$datapath) - mydata_protein = try(read.csv(input$globaldata$datapath),silent=TRUE) - annotation = read.csv(input$annotation$datapath) - annotation_protein = try(read.csv(input$globalannotation$datapath),silent=TRUE) + mydata = data.table::fread(input$ptmdata$datapath) + mydata_protein = try(data.table::fread(input$globaldata$datapath),silent=TRUE) + annotation = data.table::fread(input$annotation$datapath) + annotation_protein = try(data.table::fread(input$globalannotation$datapath),silent=TRUE) mydata = FragPipetoMSstatsPTMFormat(mydata, annotation, @@ -382,11 +377,11 @@ getData <- function(input) { mydata$PROTEIN[mydata$PROTEIN$Condition == "NORM", "Condition"] = "Norm" } else if (input$filetype=='PD'){ - mydata = read.csv(input$ptm_input$datapath, sep = "\t") + mydata = data.table::fread(input$ptm_input$datapath) mydata_protein = try( - read.csv(input$ptm_protein_input$datapath, sep = "\t"), + data.table::fread(input$ptm_protein_input$datapath), silent=TRUE) - annotation = read.csv(input$ptm_annot$datapath) + annotation = data.table::fread(input$ptm_annot$datapath) if (typeof(mydata_protein)=="character"){ mydata_protein=NULL @@ -411,9 +406,9 @@ getData <- function(input) { use_unmod_peptides=use_unmod_peptides, which_proteinid = "Master.Protein.Accessions") } else if (input$filetype=='spec'){ - mydata = read.csv(input$ptm_input$datapath) - mydata_protein = try(read.csv(input$ptm_protein_input$datapath),silent=TRUE) - annotation = read.csv(input$ptm_annot$datapath) + mydata = data.table::fread(input$ptm_input$datapath) + mydata_protein = try(data.table::fread(input$ptm_protein_input$datapath),silent=TRUE) + annotation = data.table::fread(input$ptm_annot$datapath) if (typeof(mydata_protein)=="character"){ mydata_protein=NULL @@ -434,7 +429,7 @@ getData <- function(input) { } else if (input$filetype=='sky') { mydata = read_excel(input$ptm_input$datapath) mydata_protein = try(read_excel(input$ptm_protein_input$datapath),silent=TRUE) - annotation = try(read.csv(input$ptm_annot$datapath),silent=TRUE) + annotation = try(data.table::fread(input$ptm_annot$datapath),silent=TRUE) if (typeof(mydata_protein)=="character"){ mydata_protein=NULL @@ -515,21 +510,19 @@ getData <- function(input) { ) if (is.null(mydata)) return(NULL) } else { - data = read.csv(input$msstatsptmdata$datapath, header = TRUE,sep = input$sep_msstatsptmdata, - stringsAsFactors=FALSE) + data = data.table::fread(input$msstatsptmdata$datapath) mydata = list("PTM" = data, "PROTEIN" = unmod) } } else if (input$filetype == "msstats"){ - mydata = read.csv(input$msstatsdata$datapath, header = TRUE,sep = input$sep_msstatsdata, - stringsAsFactors=FALSE) + mydata = data.table::fread(input$msstatsdata$datapath) } else { if(input$filetype=='spec' || input$filetype=='spmin'){ infile = input$data1 } else if(input$filetype=='phil' & input$BIO != "PTM"){ - mydata = read.csv(input$data$datapath, sep=input$sep_data) + mydata = data.table::fread(input$data$datapath) } else{ @@ -556,17 +549,11 @@ getData <- function(input) { # } if(input$filetype == '10col') { - mydata = read.csv(infile$datapath, header = TRUE, sep = input$sep_data) + mydata = data.table::fread(infile$datapath) } else if(input$filetype == 'sky') { cat(file=stderr(), "Reached here in skyline\n") - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep=input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(input$skylinedata$datapath, header = TRUE, sep = input$sep_skylinedata, - stringsAsFactors=FALSE) - # } + data = data.table::fread(input$skylinedata$datapath) mydata = SkylinetoMSstatsFormat(data, annotation = getAnnot(input), filter_with_Qvalue = input$q_val, @@ -597,14 +584,7 @@ getData <- function(input) { else if(input$filetype == 'prog') { cat(file=stderr(), "Reached in prog\n") - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep=input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data, - stringsAsFactors=FALSE) - # } + data = data.table::fread(infile$datapath) mydata = ProgenesistoMSstatsFormat(data, annotation = getAnnot(input), removeProtein_with1Peptide = TRUE, @@ -615,13 +595,7 @@ getData <- function(input) { if(input$DDA_DIA=="TMT"){ - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep=input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data, - stringsAsFactors=FALSE) - # } + data = data.table::fread(infile$datapath) mydata = PDtoMSstatsTMTFormat(input = data, annotation = getAnnot(input), which.proteinid = input$which.proteinid, ## same as default @@ -629,13 +603,7 @@ getData <- function(input) { ) } else{ - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep=input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data, - stringsAsFactors=FALSE) - # } + data = data.table::fread(infile$datapath) print(data) mydata = PDtoMSstatsFormat(data, annotation = getAnnot(input), removeProtein_with1Peptide = input$remove, @@ -707,12 +675,7 @@ getData <- function(input) { } } else { - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep="\t", - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(input$specdata$datapath, sep=input$sep_specdata, check.names = FALSE) - # } + data = data.table::fread(input$specdata$datapath) # Base arguments for the Spectronaut converter converter_args = list( input = data, @@ -737,7 +700,7 @@ getData <- function(input) { if (isTRUE(input$calculate_anomaly_scores) && !is.null(input$run_order_file)) { # Add anomaly score parameters only if the checkbox is checked converter_args$calculateAnomalyScores = TRUE - converter_args$runOrder = read.csv(input$run_order_file$datapath) + converter_args$runOrder = data.table::fread(input$run_order_file$datapath) converter_args$anomalyModelFeatures = c("FG.ShapeQualityScore (MS2)", "FG.ShapeQualityScore (MS1)", "EGDeltaRT") converter_args$anomalyModelFeatureTemporal = c("mean_decrease", "mean_decrease", "dispersion_increase") converter_args$n_trees = 100 @@ -751,7 +714,7 @@ getData <- function(input) { if (getFileExtension(input$dianndata$name) %in% c("parquet", "pq")) { data = read_parquet(input$dianndata$datapath) } else { - data = read.csv(input$dianndata$datapath, sep=input$sep_dianndata) + data = data.table::fread(input$dianndata$datapath) } qvalue_cutoff = 0.01 @@ -797,12 +760,7 @@ getData <- function(input) { } else if(input$filetype == 'open') { - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep = input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data) - # } + data = data.table::fread(infile$datapath) mydata =OpenSWATHtoMSstatsFormat(data, annotation = getAnnot(input), filter_with_mscore = TRUE, ## same as default @@ -814,22 +772,12 @@ getData <- function(input) { else if(input$filetype == 'openms') { if(input$DDA_DIA=="TMT"){ - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep = input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data) - # } + data = data.table::fread(infile$datapath) mydata = OpenMStoMSstatsTMTFormat(data, use_log_file = FALSE) } else{ - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep = input$sep, - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, header = TRUE, sep = input$sep_data) - # } + data = data.table::fread(infile$datapath) unique(data[, c('Run', 'BioReplicate', 'Condition')]) mydata =OpenMStoMSstatsFormat(data, removeProtein_with1Feature=TRUE, @@ -847,12 +795,7 @@ getData <- function(input) { use_log_file = FALSE) } else if(input$filetype == 'spmin') { - # if (input$subset){ - # data = read.csv.sql(infile$datapath, sep = "\t", - # sql = "select * from file order by random() limit 100000") - # } else { - data = read.csv(infile$datapath, sep=input$sep_data) - # } + data = data.table::fread(infile$datapath) mydata = SpectroMinetoMSstatsTMTFormat(data, getAnnot(input), use_log_file = FALSE) } @@ -903,7 +846,7 @@ library(MSstatsPTM)\n", sep = "") codes = paste(codes, "data = DDARawData\n", sep = "") } else if(input$BIO != "PTM" && input$DDA_DIA =='LType' && input$LabelFreeType == "DIA"){ - codes = paste(codes, "data = read.csv(\"dataset.csv\", header = TRUE, sep = \";\")\n", sep = "") + codes = paste(codes, "data = data.table::fread(\"dataset.csv\")\n", sep = "") } else if(input$BIO != "PTM" && input$DDA_DIA == "TMT"){ codes = paste(codes, "data = PDtoMSstatsTMTFormat(input = MSstatsTMT::raw.pd, @@ -920,20 +863,20 @@ library(MSstatsPTM)\n", sep = "") } else if (input$filetype == "msstats") { if (input$BIO == "PTM") { - codes = paste(codes, "\nptm_data = read.csv(\"Enter PTM data file path here\", sep =",input$sep_msstatsptmdata,")\nglobal_data = read.csv(\'Enter unmod data file path here\')\ndata = list(PTM = ptm_data, PROTEIN = unmod)\n") + codes = paste(codes, "\nptm_data = data.table::fread(\"Enter PTM data file path here\")\nglobal_data = data.table::fread(\"Enter unmod data file path here\")\ndata = list(PTM = ptm_data, PROTEIN = global_data)\n") } else { - codes = paste(codes, "data = read.csv(\"Enter MSstats formatted data file path here\", sep=",input$sep_msstatsdata,")\n") + codes = paste(codes, "data = data.table::fread(\"Enter MSstats formatted data file path here\")\n") } } else { if(input$filetype == '10col') { - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,")\n", sep = "") + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\n", sep = "") } else if(input$filetype == 'sky') { cat(file=stderr(), "Reached here in skyline\n") - codes = paste(codes, "data = read.csv(\"insert your MSstats report from Skyline filepath\", header = TRUE, sep = ",input$sep_skylinedata,", stringsAsFactors=F)\n", sep = "") + codes = paste(codes, "data = data.table::fread(\"insert your MSstats report from Skyline filepath\")\n", sep = "") - codes = paste(codes, "annot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "annot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") @@ -948,7 +891,7 @@ library(MSstatsPTM)\n", sep = "") } else if(input$filetype == 'maxq') { cat(file=stderr(), "Reached in maxq\n") - codes = paste(codes, "an_maxq = read.csv(\"insert your annotation filepath\")\n ev_maxq = read.table(\"insert your evidence.txt filepath\",sep=\"\t\", header=TRUE)\n pg_maxq = read.table(\"insert your proteinGroups.txt filepath\",sep=\"\t\", header=TRUE)\n" + codes = paste(codes, "an_maxq = data.table::fread(\"insert your annotation filepath\")\n ev_maxq = data.table::fread(\"insert your evidence.txt filepath\")\n pg_maxq = data.table::fread(\"insert your proteinGroups.txt filepath\")\n" , sep = "") if(input$DDA_DIA=="TMT"){ @@ -957,7 +900,7 @@ library(MSstatsPTM)\n", sep = "") proteinGroups=\'", input$which.proteinid,"\',\n\t\t\t\t ", "use_log_file = FALSE)\n", sep = "") } else if (input$BIO=="PTM"){ - codes = paste(codes, "sites.data = read.csv(\"insert your PTM site data filepath\")\n data = MaxQtoMSstatsPTMFormat(sites.data, an_maxq, ev_maxq, pg_maxq, an_maxq)\n", + codes = paste(codes, "sites.data = data.table::fread(\"insert your PTM site data filepath\")\n data = MaxQtoMSstatsPTMFormat(sites.data, an_maxq, ev_maxq, pg_maxq, an_maxq)\n", sep="") } else { codes = paste(codes, "data = MaxQtoMSstatsFormat(evidence=ev_maxq, @@ -972,8 +915,8 @@ library(MSstatsPTM)\n", sep = "") else if(input$filetype == 'prog') { cat(file=stderr(), "Reached in prog\n") - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,") - annot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\") + annot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") codes = paste(codes, "data = ProgenesistoMSstatsFormat(input = data, @@ -988,8 +931,8 @@ library(MSstatsPTM)\n", sep = "") if(input$DDA_DIA=="TMT"){ - codes = paste(codes, "data = read.delim(\"insert your quantification dataset filepath\",sep=",input$sep_data,") - annot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\") + annot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") @@ -1000,7 +943,7 @@ library(MSstatsPTM)\n", sep = "") } else{ - codes = paste(codes, "data = read.delim(\"insert your quantification dataset filepath\",sep=",input$sep_data,")\nannot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") codes = paste(codes, "data = PDtoMSstatsFormat(data, @@ -1015,7 +958,7 @@ library(MSstatsPTM)\n", sep = "") } else if(input$filetype == 'spec') { - codes = paste(codes, "data = read.csv(\"insert your MSstats scheme output from Spectronaut filepath\", header = TRUE, sep = ",input$sep_specdata,")\nannot_file = read.csv(\"insert your annotation filepath\", sep='\t')#Optional\n" + codes = paste(codes, "data = data.table::fread(\"insert your MSstats scheme output from Spectronaut filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")#Optional\n" , sep = "") codes = paste(codes, "data = SpectronauttoMSstatsFormat(data, @@ -1028,7 +971,7 @@ library(MSstatsPTM)\n", sep = "") } else if(input$filetype == 'diann') { - codes = paste(codes, "data = read.csv(\"insert your MSstats scheme output from DIANN filepath\", header = TRUE, sep = '\\t')\nannot_file = read.csv(\"insert your annotation filepath\")#Optional\n" + codes = paste(codes, "data = data.table::fread(\"insert your MSstats scheme output from DIANN filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")#Optional\n" , sep = "") codes = paste(codes, "data = DIANNtoMSstatsFormat(data, @@ -1040,10 +983,10 @@ library(MSstatsPTM)\n", sep = "") else if(input$filetype == 'meta') { if (input$BIO == "PTM") { codes = paste(codes, "ptm_data = data.table::fread(\"insert your AllQuantifiedPeaks.tsv filepath\")\n", sep = "") - codes = paste(codes, "annot = read.csv(\"insert your ExperimentalDesign annotation filepath\")\n", sep = "") + codes = paste(codes, "annot = data.table::fread(\"insert your ExperimentalDesign annotation filepath\")\n", sep = "") codes = paste(codes, "fasta_path = \"insert your FASTA filepath\"\n", sep = "") codes = paste(codes, "# Optional: set protein_data = NULL if no GlobalProteome data\nprotein_data = tryCatch(data.table::fread(\"insert your GlobalProteome AllQuantifiedPeaks.tsv filepath\"), error = function(e) NULL)\n", sep = "") - codes = paste(codes, "annot_protein = if (!is.null(protein_data)) read.csv(\"insert your GlobalProteome annotation filepath\") else NULL\n", sep = "") + codes = paste(codes, "annot_protein = if (!is.null(protein_data)) data.table::fread(\"insert your GlobalProteome annotation filepath\") else NULL\n", sep = "") # Resolve mod ID for generated code code_mod_id <- tryCatch( .resolve_mod_id(input$mod_id_meta_select, input$mod_id_meta_custom), @@ -1060,7 +1003,7 @@ library(MSstatsPTM)\n", sep = "") use_unmod_peptides = use_unmod_peptides, mod_ids = c(\"", gsub('"', '\\\\"', gsub("\\\\", "\\\\\\\\", code_mod_id)), "\"))\n", sep = "") } else { - codes = paste(codes, "data = data.table::fread(\"insert your QuantifiedPeaks.tsv filepath\")\nannot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "data = data.table::fread(\"insert your QuantifiedPeaks.tsv filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") codes = paste(codes, "data = MetamorpheusToMSstatsFormat(data, @@ -1073,7 +1016,7 @@ library(MSstatsPTM)\n", sep = "") } else if(input$filetype == 'open') { - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,")\nannot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") codes = paste(codes, "data = OpenSWATHtoMSstatsFormat(data, @@ -1088,41 +1031,41 @@ library(MSstatsPTM)\n", sep = "") else if(input$filetype == 'openms') { if(input$DDA_DIA=="TMT"){ - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,")\ndata = OpenMStoMSstatsTMTFormat(data, use_log_file = FALSE)\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\ndata = OpenMStoMSstatsTMTFormat(data, use_log_file = FALSE)\n" , sep = "") } else{ - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,")\nunique(data[, c('Run', 'BioReplicate', 'Condition')])\ndata = OpenMStoMSstatsFormat(data, removeProtein_with1Feature=TRUE, use_log_file = FALSE)\n" + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\nunique(data[, c('Run', 'BioReplicate', 'Condition')])\ndata = OpenMStoMSstatsFormat(data, removeProtein_with1Feature=TRUE, use_log_file = FALSE)\n" , sep = "") } } else if(input$filetype == 'spmin') { - codes = paste(codes, "data = read.csv(\"insert your quantification dataset filepath\", header = TRUE, sep = ",input$sep_data,")\nannot_file = read.csv(\"insert your annotation filepath\")\ndata = SpectroMinetoMSstatsTMTFormat(data, annot_file, + codes = paste(codes, "data = data.table::fread(\"insert your quantification dataset filepath\")\nannot_file = data.table::fread(\"insert your annotation filepath\")\ndata = SpectroMinetoMSstatsTMTFormat(data, annot_file, use_log_file = FALSE)" , sep = "") } else if(input$filetype == 'phil' & input$DDA_DIA == "TMT") { - codes = paste(codes,"data = read.csv(\"insert your msstats filepath\",sep=",input$sep_data,")\n" + codes = paste(codes,"data = data.table::fread(\"insert your msstats filepath\")\n" , sep = "") - codes = paste(codes,"annot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes,"annot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") codes = paste(codes, "data = PhilosophertoMSstatsTMTFormat(data, annotation = annot_file)\n", sep = "") }else if (input$filetype == 'phil' & input$BIO == "PTM"){ - codes = paste(codes,"data = read.csv(\"insert your msstats filepath\")\n" + codes = paste(codes,"data = data.table::fread(\"insert your msstats filepath\")\n" , sep = "") - codes = paste(codes,"annot_file = read.csv(\"insert your annotation filepath\")\n" + codes = paste(codes,"annot_file = data.table::fread(\"insert your annotation filepath\")\n" , sep = "") - codes = paste(codes,"data_protein = read.csv(\"insert your global profiling msstats filepath\")\n" + codes = paste(codes,"data_protein = data.table::fread(\"insert your global profiling msstats filepath\")\n" , sep = "") - codes = paste(codes,"annot_protein_file = read.csv(\"insert your global profiling annotation filepath\")\n" + codes = paste(codes,"annot_protein_file = data.table::fread(\"insert your global profiling annotation filepath\")\n" , sep = "") codes = paste(codes, paste0("data = PhilosophertoMSstatsPTMFormat(data, @@ -1135,7 +1078,7 @@ library(MSstatsPTM)\n", sep = "") ")\n"), sep = "") } else if (input$filetype == 'phil'){ codes = paste(codes, - "data = read.csv(\"insert your msstats.csv filepath\")\n" + "data = data.table::fread(\"insert your msstats.csv filepath\")\n" , sep = "") codes = paste(codes, paste0("data = FragPipetoMSstatsFormat(data)\n"), sep = "") @@ -1519,4 +1462,4 @@ fitResponseCurves <- function(statmodel_input, matrix, input_data, transform_dos ratio_response = FALSE ) return(list(ComparisonResult = response_results)) -} \ No newline at end of file +} diff --git a/man/MSstatsShiny.Rd b/man/MSstatsShiny.Rd index 6f654ed..68c65a2 100644 --- a/man/MSstatsShiny.Rd +++ b/man/MSstatsShiny.Rd @@ -43,6 +43,7 @@ Useful links: Authors: \itemize{ + \item Anthony Wu \email{wu.anthon@northeastern.edu} \item Devon Kohler \email{kohler.d@northeastern.edu} \item Deril Raju \email{raju.d@northeastern.edu} \item Maanasa Kaza \email{maanasakaza@gmail.com} diff --git a/tests/testthat/ex.R b/tests/testthat/ex.R index 8f287a9..eba72af 100644 --- a/tests/testthat/ex.R +++ b/tests/testthat/ex.R @@ -78,9 +78,8 @@ mock_input <- list( remove_norm_channel = TRUE, maxQC1 = NULL, summ = TRUE, - sep_skylinedata = NULL, moderated = TRUE - + ) diff --git a/tests/testthat/test-module-loadpage-ui.R b/tests/testthat/test-module-loadpage-ui.R index f04ac57..f1136a3 100644 --- a/tests/testthat/test-module-loadpage-ui.R +++ b/tests/testthat/test-module-loadpage-ui.R @@ -94,10 +94,6 @@ test_that("loadpageUI properly handles file input elements and validation", { expect_true(grepl("proceed1", html_output), "Upload button not found") - # Check for separator radio buttons for file parsing - expect_true(grepl("sep_data", html_output) || grepl("Column separator", html_output), - "File separator options not found") - # Should include help text and external links expect_true(grepl("User Guide", html_output), "Help documentation links not found") @@ -336,21 +332,6 @@ test_that("create_quality_filtering_options creates filtering controls", { expect_true(grepl("MBR Enabled", options_html)) }) -# Tests for create_separator_buttons() -test_that("create_separator_buttons creates proper radio buttons", { - buttons <- create_separator_buttons(NS("test"), "sep_test") - buttons_html <- as.character(buttons) - - expect_true(grepl("Column separator", buttons_html)) - expect_true(grepl("Comma", buttons_html)) - expect_true(grepl("Semicolon", buttons_html)) - expect_true(grepl("Tab", buttons_html)) - expect_true(grepl("Pipe", buttons_html)) - - # Check for inline display - expect_true(grepl("radio-inline", buttons_html)) -}) - # Test order preservation in main selection controls test_that("main selection controls maintain proper order", { controls <- create_main_selection_controls(NS("test")) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 9f84b74..cf0b13a 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -78,9 +78,7 @@ mock_input <- list( remove_norm_channel = TRUE, maxQC1 = NULL, summ = TRUE, - moderated = TRUE, - sep_skylinedata = NULL, - sep_data = NULL + moderated = TRUE ) ################################################################################ @@ -467,8 +465,7 @@ test_that("dda pd", { mock_input$DDA_DIA <- "LType" mock_input$filetype = "PD" mock_input$sep = "," - mock_input$sep_data = "," - + mock_input$data$datapath <- system.file("tinytest/raw_data/PD/pd_input.csv", package = "MSstatsConvert") @@ -487,8 +484,7 @@ test_that("dda prog", { mock_input$DDA_DIA <- "LType" mock_input$filetype = "prog" mock_input$sep = "," - mock_input$sep_data = "," - + mock_input$data$datapath <- system.file("tinytest/raw_data/Progenesis/progenesis_input.csv", package = "MSstatsConvert") @@ -508,7 +504,6 @@ test_that("dda metamorpheus", { mock_input$BIO <- "Protein" mock_input$DDA_DIA <- "LType" mock_input$filetype <- "meta" - mock_input$sep_data <- "\t" mock_input$unique_peptides <- TRUE mock_input$remove <- FALSE @@ -573,7 +568,6 @@ test_that("dda dia skyline", { mock_input$DDA_DIA <- "LType" mock_input$filetype = "sky" mock_input$sep = "," - mock_input$sep_skylinedata = "," mock_input$skylinedata$datapath <- system.file("tinytest/raw_data/Skyline/skyline_input.csv", package = "MSstatsConvert") @@ -599,8 +593,7 @@ test_that("dda openms", { mock_input$DDA_DIA <- "LType" mock_input$filetype = "openms" mock_input$sep = "," - mock_input$sep_data = "," - + mock_input$data$datapath <- system.file("tinytest/raw_data/OpenMS/openms_input.csv", package = "MSstatsConvert") @@ -642,8 +635,8 @@ test_that("dia spectronaut", { mock_input$q_cutoff = 0.01 stub(getData,"getAnnot",NULL) - stub(getData,"read.csv",data.table::fread(system.file("tinytest/raw_data/Spectronaut/spectronaut_input.csv", - package = "MSstatsConvert"))) + stub(getData,"data.table::fread",data.table::fread(system.file("tinytest/raw_data/Spectronaut/spectronaut_input.csv", + package = "MSstatsConvert"))) output <- getData(mock_input) expected_names <- c("ProteinName","PeptideSequence","PrecursorCharge","FragmentIon","ProductCharge","IsotopeLabelType","Condition","BioReplicate","Run","Fraction","Intensity") expect_type(output,"list") @@ -660,8 +653,8 @@ test_that("dia openswath", { stub(getData,"getAnnot",data.table::fread(system.file("tinytest/annotations/annot_os.csv", package = "MSstats"))) - stub(getData,"read.csv",data.table::fread(system.file("tinytest/raw_data/OpenSWATH/openswath_input.csv", - package = "MSstatsConvert"))) + stub(getData,"data.table::fread",data.table::fread(system.file("tinytest/raw_data/OpenSWATH/openswath_input.csv", + package = "MSstatsConvert"))) output <- getData(mock_input) expected_names <- c("ProteinName","PeptideSequence","PrecursorCharge","FragmentIon","ProductCharge","IsotopeLabelType","Condition","BioReplicate","Run","Fraction","Intensity") expect_type(output,"list") @@ -701,7 +694,7 @@ test_that("tmt openms", { mock_input$sep = "," load(system.file("data/raw.om.rda", package = "MSstatsShiny")) - stub(getData,"read.csv",raw.om) + stub(getData,"data.table::fread",raw.om) output <- getData(mock_input) print(names(output)) @@ -720,7 +713,7 @@ test_that("tmt spectromine", { package = "MSstatsShiny")) load(system.file("data/annotation.mine.rda", package = "MSstatsShiny")) - stub(getData,"read.csv",raw.mine) + stub(getData,"data.table::fread",raw.mine) stub(getData,"getAnnot",annotation.mine) output <- getData(mock_input) @@ -805,10 +798,9 @@ test_that("get data code filetype sky", { mock_input$filetype = "sky" mock_input$DDA_DIA <- "LType" - mock_input$sep_skylinedata <- "," output <- getDataCode(mock_input) expect_type(output,"character") - + mock_input$DDA_DIA <- "LType" output <- getDataCode(mock_input) expect_type(output,"character") @@ -1444,7 +1436,6 @@ describe("getData for Spectronaut input with anomaly scores", { DDA_DIA = "DIA", filetype = "spec", specdata = list(datapath = "dummy_spec.csv"), - sep_specdata = ",", annot = list(datapath = "dummy_annot.csv"), q_val = TRUE, q_cutoff = 0.01, @@ -1452,9 +1443,9 @@ describe("getData for Spectronaut input with anomaly scores", { calculate_anomaly_scores = TRUE, run_order_file = list(datapath = "dummy_run_order.csv") ) - + # Mock the functions that getData calls - stub(getData, "read.csv", function(path, ...) { + stub(getData, "data.table::fread", function(path, ...) { if (path == "dummy_run_order.csv") return(dummy_run_order) return(dummy_spec_data) }) @@ -1480,7 +1471,6 @@ describe("getData for Spectronaut input with anomaly scores", { DDA_DIA = "DIA", filetype = "spec", specdata = list(datapath = "dummy_spec.csv"), - sep_specdata = ",", annot = list(datapath = "dummy_annot.csv"), q_val = TRUE, q_cutoff = 0.01, @@ -1488,8 +1478,8 @@ describe("getData for Spectronaut input with anomaly scores", { calculate_anomaly_scores = FALSE, # Main difference run_order_file = NULL ) - - stub(getData, "read.csv", dummy_spec_data) + + stub(getData, "data.table::fread", dummy_spec_data) stub(getData, "getAnnot", dummy_annot) stub(getData, "SpectronauttoMSstatsFormat", mock_spectro_converter)