ethanbass / chromConverter

Parsers for chromatography data in R (HPLC-DAD/UV, GC-FID, MS)
https://ethanbass.github.io/chromConverter/
GNU General Public License v3.0
29 stars 3 forks source link

read_chroms() can't find openChrom executable #12

Closed jonathanstathakis closed 1 year ago

jonathanstathakis commented 1 year ago

Apologies in advance, this is my first time posting a issue on GitHub. I am trying to use read_chroms() to convert Agilent .ch WSD files to .csv, however I cannot get read_chroms() to find the openchrom executable. Also openchrom CLI is not behaving as expected.

OS: MacOS Ventura 13.1

Environment: R interpreter in zsh.

Executing:

dat <- read_chroms(paths = file_path, format_in = 'wsd', parser = 'chromconverter', format_out = "data.frame", export = FALSE)

Produces the following error dialog:

Export directory not specified! Export files to `temp` directory (y/n)?y
Warning in configure_call_openchrom() : OpenChrom not found!
Please provide path to `OpenChrom` command line):/Applications/Eclipse.app/contents/MacOS/openchrom
    The OpenChrom command-line interface is turned off!
    Update `openchrom.ini` to activate the command-line interface (y/n)?
    (Warning: This will deactivate the GUI on your OpenChrom installation!)
y
sh: /Applications/OpenChrom_CL.app/Contents/MacOS/openchrom: No such file or directory
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: In system(paste0(openchrom_path, " -nosplash -cli -batchfile ",  :
  error in running command
2: In file(file, "rt") :
  cannot open file '/Users/jonathan/001_chromconverter_test_env/temp/DAD1D.csv': No such file or directory

Then running it again produces a different message:

Export directory not specified! Export files to `temp` directory (y/n)?y
sh: /Applications/OpenChrom_CL.app/Contents/MacOS/openchrom: No such file or directory
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  no lines available in input
In addition: Warning message:
In system(paste0(openchrom_path, " -nosplash -cli -batchfile ",  :
  error in running command

Manually setting up OpenChrom CLI and running ./openchrom -nosplash -cli --help results in an error message as below, instead of the help dialog:

WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
<<<< EncryptedJarClassLoader created >>>>
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Which I don't think is a good thing.

Investigating the openchrom path, I found that

../chromConverter/shell/path_to_openchrom_commandline.txt

contained

/Applications/Eclipse.app/contents/MacOS/openchrom

the path I initally inputted, so that's behaving as expected, however I'm not sure why read_chrom() is looking in a different path. Any help would be appreciated.

ethanbass commented 1 year ago

Hi @OctaneOolong, Thanks for posting this issue. Did you download chromConverter from CRAN? I think the first issue might actually be related to a bug that I already fixed. If you are running the CRAN version (v0.2.1), can you please try downloading the latest version of GitHub and let me know if it resolves the issue with the paths? (You will need to refresh your R session after reinstalling the package).

I'm not sure what's going on with the other error message when you try to run the command line OpenChrom directly from the terminal, but I agree that it seems like a bad sign. Does the OpenChrom GUI load correctly on your computer?

ethanbass commented 1 year ago

Here's what I get when I run the help command:

<<<< EncryptedJarClassLoader created >>>>
----------------------------------------------------------------------------------
Product Initializiation:   org.eclipse.chemclipse.logging.support.Settings
Workspace Path:            /Users/ethanbass/OpenChrom/1.5.x
System Path:               /Users/ethanbass/.openchrom/1.5.x
System Method Path:        /Users/ethanbass/.openchrom/1.5.x/methods
System Configuration Path: /Users/ethanbass/.openchrom/1.5.x/configurations
System Plugins Path:       /Users/ethanbass/.openchrom/1.5.x/plugins
----------------------------------------------------------------------------------
[Start Level: Equinox Container: f174527d-0fa0-4941-99d5-2f3e0e13fddc] INFO org.eclipse.chemclipse.support.internal.ConfigReader - Reading global plugins from /Users/ethanbass/.openchrom/1.5.x/plugins
[Start Level: Equinox Container: f174527d-0fa0-4941-99d5-2f3e0e13fddc] INFO org.eclipse.chemclipse.support.internal.ConfigReader - Reading static config files from /Users/ethanbass/.openchrom/1.5.x/configurations
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:71) Command Line Processor Options
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -peakidentbatchfile Automate the peak integration and identification.
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -batchfile Automate the processing of batch files.
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -importMSD Add a chromatogram (MSD) to the processing context.
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -importCSD Add a chromatogram (CSD) to the processing context.
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -importWSD Add a chromatogram (WSD) to the processing context.
INFO  main support.ApplicationSupportCLI.<init> (ApplicationSupportCLI.java:73) Option: -method Applies the given method to all current chromatograms.

Edit: I did a little more investigating and the logger error you're getting appears to have been introduced in OpenChrom 1.5. It was not present in the previous version (1.4.x), which I was still running on my computer. This error seems to prevent the OpenChrom command line application from printing any output to the console, but it is still able to run and convert files. Most of the output is very hard to interpret anyway, so this probably isn't such a big deal (though it could be useful for debugging).

jonathanstathakis commented 1 year ago

Hi Ethan, thank you for your response. I did download it from CRAN, and after following your advice, I was able to get it working. Glad you'd already nipped that bug in the bud, and thank you for investigating the openChrom CLI behavior as well. I'll close this issue now, thanks for your great work!

ethanbass commented 1 year ago

Glad to hear you got it working! One of these days i will get it together to update the package on CRAN. I'm not sure exactly what kind of files you're trying to read, but I also just added a new parsers for agilent .ch (version 130) files to the package, you might be interested in checking out. You can access it with `read_chroms(paths=<>, parser="chemstation_ch").