From 2dbb099f8ada99543bd6def16c32e1e16e0ad73d Mon Sep 17 00:00:00 2001 From: Vlad Petyuk Date: Sat, 23 Nov 2024 22:52:13 -0800 Subject: [PATCH] generic reader --- R/read_genetic_tool_results_from_DMS.R | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 R/read_genetic_tool_results_from_DMS.R diff --git a/R/read_genetic_tool_results_from_DMS.R b/R/read_genetic_tool_results_from_DMS.R new file mode 100644 index 0000000..82791d6 --- /dev/null +++ b/R/read_genetic_tool_results_from_DMS.R @@ -0,0 +1,35 @@ +#' Reading generic tool output from PNNL's DMS +#' +#' @param data_package_num numeric or character; the Data Package ID in the DMS. +#' @param tool character; MS-GF+ parameter file. No need to specify this +#' if there is only one parameter file associated with the jobs. +#' +#' @return (data.table) results in the form of one data.table +#' +#' @md +#' +#' @importFrom data.table data.table rbindlist +#' +#' @examples +#' if (is_PNNL_DMS_connection_successful()) { +#' x <- read_generic_job_from_DMS(6148, "Decon2LS_V2") +#' (x) +#' } +#' +#' @export + +read_generic_job_from_DMS <- function(data_package_num, tool) +{ + if (length(data_package_num) > 1) { + job_rec_ls <- lapply(data_package_num, get_job_records_by_dataset_package) + jobRecords <- rbindlist(job_rec_ls) + } + else { + jobRecords <- get_job_records_by_dataset_package(data_package_num) + } + + jobRecords <- jobRecords[tool == jobRecords$tool,] + results <- get_results_for_multiple_jobs.dt(jobRecords) + results <- rbindlist(results) + return(results) +}