Skip to content

Commit

Permalink
fix: read chemstation .ms files with entab
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbass committed Dec 17, 2023
1 parent df189b4 commit 1163c70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## chromConverter 0.6.0

* Added parser for reading ANDI MS (`.cdf`) files.
* Fixed parsing of Agilent MS files with 'entab' reader.
* Fixed `read_chemstation_ch` parser to correctly read "Mustang Chemstation" 179 files with 8-byte encoding.
* Added alias to `read_chroms` for reading `mzxml` files with `RaMS`.
* Added internal parser for 1D 'Waters RAW' chromatograms.
Expand Down
23 changes: 15 additions & 8 deletions R/call_entab.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,24 @@ call_entab <- function(file, data_format = c("wide", "long"),
metadata_format <- switch(metadata_format,
chromconverter = format_in, raw = "raw")
r <- entab::Reader(file)
x <- entab::as.data.frame(r)
signal.idx <- grep("signal", colnames(x))
if (length(signal.idx) == 1){
colnames(x)[signal.idx] <- "wavelength"
if (is.null(format_in)){
format_in <- r$parser()
}
if (data_format == "wide"){
x <- entab::as.data.frame(r)
if (format_in == "chemstation_uv"){
signal.idx <- grep("signal", colnames(x))
if (length(signal.idx) == 1){
colnames(x)[signal.idx] <- "wavelength"
}
if (data_format == "wide"){
x <- reshape_chrom_wide(x, time_var = "time", lambda_var = "wavelength",
value_var = "intensity")
}
if (format_out == "matrix"){
x <- as.matrix(x)
if (format_out == "matrix"){
x <- as.matrix(x)
}
}
} else if (format_in == "chemstation_ms"){
colnames(x)[1] <- "rt"
}
if (read_metadata){
meta <- r$metadata()
Expand Down

0 comments on commit 1163c70

Please sign in to comment.