|
1 | 1 | #' Converter for Agilent MassHunter UV files |
2 | 2 | #' |
3 | | -#' Converts a single chromatogram from MassHunter \code{.sp} format to R \code{data.frame}. |
| 3 | +#' Converts a single chromatogram from MassHunter \code{.sp} format to R |
| 4 | +#' \code{data.frame}. |
4 | 5 | #' |
5 | 6 | #' Uses the [Aston](https://github.com/bovee/aston) file parser. |
6 | 7 | #' |
@@ -40,7 +41,8 @@ sp_converter <- function(file, format_out = c("matrix", "data.frame"), |
40 | 41 |
|
41 | 42 | #' Converter for Agilent ChemStation UV files |
42 | 43 | #' |
43 | | -#' Converts a single chromatogram from ChemStation \code{.uv} format to R \code{data.frame}. |
| 44 | +#' Converts a single chromatogram from ChemStation \code{.uv} format to R |
| 45 | +#' \code{data.frame}. |
44 | 46 | #' |
45 | 47 | #' Uses the [Aston](https://github.com/bovee/aston) file parser. |
46 | 48 | #' |
@@ -74,10 +76,9 @@ uv_converter <- function(file, format_out = c("matrix","data.frame"), |
74 | 76 | } |
75 | 77 | if (correction){ |
76 | 78 | # multiply by empirical correction value |
77 | | - x <- apply(x,2,function(xx)xx*0.9536743164062551070259132757200859487056732177734375) |
| 79 | + correction_value <- 0.9536743164062551070259132757200859487056732177734375 |
| 80 | + x <- apply(x,2,function(xx)xx*correction_value) |
78 | 81 | } |
79 | | - # correct column order |
80 | | - # x <- lapply(x, function(xx) xx[,order(as.numeric(colnames(xx)))]) |
81 | 82 | if (read_metadata){ |
82 | 83 | meta <- read_chemstation_metadata(file) |
83 | 84 | x <- attach_metadata(x, meta, format_in = "chemstation_uv", |
@@ -129,24 +130,21 @@ trace_converter <- function(file, format_out = c("matrix", "data.frame"), |
129 | 130 | #' @author Ethan Bass |
130 | 131 | #' @import reticulate |
131 | 132 | #' @export |
132 | | -configure_aston <- function(return_boolean=FALSE){ |
| 133 | +configure_aston <- function(return_boolean = FALSE){ |
133 | 134 | install <- FALSE |
134 | | - # path <- miniconda_path() |
135 | 135 | if (!dir.exists(miniconda_path())){ |
136 | 136 | install <- readline("It is recommended to install miniconda in your R library to use Aston parsers. Install miniconda now? (y/n)") |
137 | 137 | if (install %in% c('y', "Y", "YES", "yes", "Yes")){ |
138 | 138 | install_miniconda() |
139 | 139 | } |
140 | | - } # else{ |
141 | | - # envs <- conda_list() |
142 | | - # use_miniconda(envs[grep("r-reticulate", envs$name)[1],2]) |
143 | | - # } |
| 140 | + } |
144 | 141 | env <- reticulate::configure_environment("chromConverter") |
145 | 142 | if (!env){ |
146 | 143 | reqs <- c("pandas","scipy","numpy","aston") |
147 | 144 | reqs_available <- sapply(reqs, reticulate::py_module_available) |
148 | 145 | if (!all(reqs_available)){ |
149 | | - conda_install(envname = "chromConverter", reqs[which(!reqs_available)], pip = TRUE) |
| 146 | + conda_install(envname = "chromConverter", reqs[which(!reqs_available)], |
| 147 | + pip = TRUE) |
150 | 148 | } |
151 | 149 | } |
152 | 150 | assign_trace_file() |
|
0 commit comments