From 09e825d9476031c469a1473a58d25291024e3ea9 Mon Sep 17 00:00:00 2001 From: Ben Drucker Date: Mon, 12 Aug 2024 18:06:21 -0500 Subject: [PATCH] Candidate release --- R/read_MSstats_from_MSFragger_job.R | 15 +++++++++------ R/read_msfragger_data_from_DMS.R | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/R/read_MSstats_from_MSFragger_job.R b/R/read_MSstats_from_MSFragger_job.R index 52c7db2..3dc2a48 100644 --- a/R/read_MSstats_from_MSFragger_job.R +++ b/R/read_MSstats_from_MSFragger_job.R @@ -26,7 +26,7 @@ #' if (is_PNNL_DMS_connection_successful()) { #' msnset <- read_MSstats_from_MSFragger_job( #' data_package_num = 4938, -#' param_file = "MSFragger_Tryp_Dyn_MetOx_ProtNTermAcet_StatCysAlk_20ppmParTol.params", +#' param_file = "MSFragger_Tryp_Dyn_MetOx_ProtNTermAcet_Stat_CysAlk_20ppmParTol.params", #' settings_file = "MSFragger_MatchBetweenRuns_Java80GB.xml", #' organism_db = "ID_008026_7A1842EC.fasta") #' show(msnset) @@ -40,8 +40,7 @@ read_MSstats_from_MSFragger_job <- function(data_package_num, settings_file = NULL, organism_db = NULL) { - job_records <- - PNNL.DMS.utils::get_job_records_by_dataset_package(data_package_num) + job_records <- get_job_records_by_dataset_package(data_package_num) # add filters on tool, parameter file and setting file job_records <- filter(job_records, tool == "MSFragger") @@ -59,7 +58,12 @@ read_MSstats_from_MSFragger_job <- function(data_package_num, } path <- unique(job_records$folder) - + remote_folder <- gsub("\\\\", "/", path) + mount_folder <- local_folder <- .new_tempdir() + mount_cmd <- sprintf("mount -t smbfs %s %s", remote_folder, local_folder) + system(mount_cmd) + on.exit(system(glue::glue("umount {mount_folder}"))) + if (length(path) == 0) { stop("No jobs found.") } @@ -69,8 +73,7 @@ read_MSstats_from_MSFragger_job <- function(data_package_num, "Please refine the arguments to make sure they uniquely", " define the MSFragger job.")) } - - path_to_file <- file.path(path, "MSstats.csv") + path_to_file <- file.path(local_folder, "MSstats.csv") if (!file.exists(path_to_file)) { stop(sprintf("MSstats.csv file not found in %s", path)) diff --git a/R/read_msfragger_data_from_DMS.R b/R/read_msfragger_data_from_DMS.R index 61b9938..bb309c0 100644 --- a/R/read_msfragger_data_from_DMS.R +++ b/R/read_msfragger_data_from_DMS.R @@ -63,6 +63,7 @@ read_msfragger_data_from_DMS <- function(data_package_num, mount_folder <- local_folder <- .new_tempdir() mount_cmd <- sprintf("mount -t smbfs %s %s", remote_folder, local_folder) system(mount_cmd) + on.exit(system(glue::glue("umount {mount_folder}"))) if (length(path) == 0) { stop("No jobs found.") @@ -108,7 +109,6 @@ read_msfragger_data_from_DMS <- function(data_package_num, `Spectrum File` = sub("\\.pep\\.xml", "", `Spectrum File`), `Spectrum File` = sub(fileNamePttrn, "", `Spectrum File`)) - system(glue::glue("umount {mount_folder}")) if (!assume_inference) { dt <- dt %>%