Skip to content

Commit

Permalink
style: fixed whitespace, removed zombie code
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbass committed Jul 30, 2023
1 parent 0e98b7c commit ebd7bd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions R/aston_parsers.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Converter for Agilent MassHunter UV files
#'
#' Converts a single chromatogram from MassHunter \code{.sp} format to R \code{data.frame}.
#' Converts a single chromatogram from MassHunter \code{.sp} format to R
#' \code{data.frame}.
#'
#' Uses the [Aston](https://github.com/bovee/aston) file parser.
#'
Expand Down Expand Up @@ -40,7 +41,8 @@ sp_converter <- function(file, format_out = c("matrix", "data.frame"),

#' Converter for Agilent ChemStation UV files
#'
#' Converts a single chromatogram from ChemStation \code{.uv} format to R \code{data.frame}.
#' Converts a single chromatogram from ChemStation \code{.uv} format to R
#' \code{data.frame}.
#'
#' Uses the [Aston](https://github.com/bovee/aston) file parser.
#'
Expand Down Expand Up @@ -74,10 +76,9 @@ uv_converter <- function(file, format_out = c("matrix","data.frame"),
}
if (correction){
# multiply by empirical correction value
x <- apply(x,2,function(xx)xx*0.9536743164062551070259132757200859487056732177734375)
correction_value <- 0.9536743164062551070259132757200859487056732177734375
x <- apply(x,2,function(xx)xx*correction_value)
}
# correct column order
# x <- lapply(x, function(xx) xx[,order(as.numeric(colnames(xx)))])
if (read_metadata){
meta <- read_chemstation_metadata(file)
x <- attach_metadata(x, meta, format_in = "chemstation_uv",
Expand Down Expand Up @@ -129,24 +130,21 @@ trace_converter <- function(file, format_out = c("matrix", "data.frame"),
#' @author Ethan Bass
#' @import reticulate
#' @export
configure_aston <- function(return_boolean=FALSE){
configure_aston <- function(return_boolean = FALSE){
install <- FALSE
# path <- miniconda_path()
if (!dir.exists(miniconda_path())){
install <- readline("It is recommended to install miniconda in your R library to use Aston parsers. Install miniconda now? (y/n)")
if (install %in% c('y', "Y", "YES", "yes", "Yes")){
install_miniconda()
}
} # else{
# envs <- conda_list()
# use_miniconda(envs[grep("r-reticulate", envs$name)[1],2])
# }
}
env <- reticulate::configure_environment("chromConverter")
if (!env){
reqs <- c("pandas","scipy","numpy","aston")
reqs_available <- sapply(reqs, reticulate::py_module_available)
if (!all(reqs_available)){
conda_install(envname = "chromConverter", reqs[which(!reqs_available)], pip = TRUE)
conda_install(envname = "chromConverter", reqs[which(!reqs_available)],
pip = TRUE)
}
}
assign_trace_file()
Expand Down
2 changes: 1 addition & 1 deletion R/read_cdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @author Ethan Bass
#' @export

read_cdf <- function(file, format_out = c("matrix","data.frame"),
read_cdf <- function(file, format_out = c("matrix", "data.frame"),
data_format = c("wide","long"),
what = "chromatogram", read_metadata = TRUE){
check_for_pkg("ncdf4")
Expand Down

0 comments on commit ebd7bd4

Please sign in to comment.