diff --git a/DESCRIPTION b/DESCRIPTION index 1b3ba1c..e3ebcfe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: binneR Title: Spectral Processing for High Resolution Flow Infusion Mass Spectrometry -Version: 2.5.1 +Version: 2.5.2 Authors@R: person("Jasen", "Finch", email = "jsf9@aber.ac.uk", role = c("aut", "cre")) Description: A spectral binning approach for high resolution flow infusion mass spectrometry data. biocViews: MassSpectrometry, Metabolomics diff --git a/NAMESPACE b/NAMESPACE index 5bff7d3..19f9a86 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -80,6 +80,7 @@ importFrom(magrittr,"%>%") importFrom(magrittr,set_colnames) importFrom(magrittr,set_names) importFrom(methods,show) +importFrom(mzR,close) importFrom(mzR,header) importFrom(mzR,openMSfile) importFrom(mzR,peaks) diff --git a/NEWS.md b/NEWS.md index 022c592..93f09cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# binneR v2.5.2 + +* Fixed I/O issues for sample sets over ~1200. + +* Minor alteration to console output + # binneR v2.5.1 * Performance and memory usage gains through ensuring 0 values are not read from raw files. diff --git a/R/detect.R b/R/detect.R index e0da7c9..b317917 100644 --- a/R/detect.R +++ b/R/detect.R @@ -20,9 +20,13 @@ detectInfusionScans <- function(files, ms <- files %>% future_map(~{ - .x %>% - openMSfile() %>% + ms <- .x %>% + openMSfile() + + file_header <- ms %>% header() + + return(file_header) }) %>% set_names(files) diff --git a/R/get.R b/R/get.R index 908fc82..c49296d 100644 --- a/R/get.R +++ b/R/get.R @@ -1,4 +1,3 @@ -#' @importFrom mzR openMSfile peaks #' @importFrom stats aggregate #' @importFrom dplyr bind_rows group_by summarise #' @importFrom magrittr %>% @@ -13,7 +12,7 @@ sampProcess <- function(file,scans,dp){ return(pl) } -#' @importFrom mzR openMSfile peaks +#' @importFrom mzR openMSfile peaks close #' @importFrom purrr map #' @importFrom dplyr bind_rows #' @importFrom tibble as_tibble @@ -32,7 +31,7 @@ getFile <- function(file,scans){ hd$polarity[hd$polarity == 0] <- 'n' hd$polarity[hd$polarity == 1] <- 'p' - ms %>% + file_peaks <- ms %>% peaks() %>% .[hd$seqNum] %>% map(~{ @@ -47,6 +46,8 @@ getFile <- function(file,scans){ mutate(seqNum = as.numeric(seqNum)) %>% left_join(hd, by = "seqNum") %>% select(-filterString,-seqNum) + + return(file_peaks) } #' @importFrom parallel makeCluster stopCluster parLapply clusterExport @@ -68,9 +69,13 @@ getHeaders <- function(files){ headers <- files %>% future_map(~{ - .x %>% - openMSfile(backend = 'pwiz') %>% + ms <- .x %>% + openMSfile(backend = 'pwiz') + + file_header <- ms %>% header() + + return(file_header) }) %>% set_names(files) %>% bind_rows(.id = 'FileName') %>% diff --git a/R/spectralBinning-method.R b/R/spectralBinning-method.R index 7c132ae..758affa 100644 --- a/R/spectralBinning-method.R +++ b/R/spectralBinning-method.R @@ -16,7 +16,7 @@ setMethod("spectralBinning", if (isTRUE(verbose)) message('Reading raw data') pks <- getPeaks(files,scans(x)) - if (isTRUE(verbose)) message('Calculating bins') + if (isTRUE(verbose)) message('Gathering bins') bin_list <- calcBinList(pks) if (isTRUE(verbose)) message('Removing single scan events') @@ -65,7 +65,7 @@ setMethod("spectralBinning", }) %>% bind_rows() - if (isTRUE(verbose)) message('Calculating bin measures') + if (isTRUE(verbose)) message('Calculating bin metrics') bin_measures <- calcBinMeasures(pks, cls) @@ -96,6 +96,7 @@ setMethod("spectralBinning", select(-fileName,-polarity) }) + if (isTRUE(verbose)) message('Gathering file headers') headers <- getHeaders(files) binnedData(x) <- binned_data diff --git a/docs/404.html b/docs/404.html index 7204dd0..bf4f208 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@ binneR - 2.4.0 + 2.5.2 @@ -79,7 +79,7 @@