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
24 stars 3 forks source link

Converting .cdf to .mzml - different parsers? #26

Open karawiggin opened 5 months ago

karawiggin commented 5 months ago

I am trying to convert a .cdf file from a Shimadzu machine to .mzml to use in GNPS, and when I try, it says that exporting to .mzml requires the openchrom parser, but when you use openchrom it says it doesn't recognize .cdf. Is there a way around this? From the documentation it seems like standard read_chroms parsers should recognize both .cdf and .mzml

error when I don't specify a parser: The selected export format is currently only supported by openchrom parsers.

error when I specify openchrom: The ‘cdf’ format can be converted using the following parsers: ‘chromconverter’. The ‘openchrom’ parser can take the following formats as inputs: ‘msd’, ‘csd’, ‘wsd’.

Here's the code I'm trying to use (without specifying a parser), if it's simply just something wrong with how it's written: data <- read_chroms(paths = "mypath/filename.CDF", format_in = "cdf", export = TRUE, path_out = "mypath/filename.mzml", export_format = "mzml")

Would appreciate any help!!

ethanbass commented 5 months ago

Hi Kara,

Thanks for your question. chromConverter can read the ANDI mass spectrometry format, but it can't yet directly write mzML (except for the parsers that wrap OpenChrom, which is able to do this type of conversion as you noted). Unfortunately, Open Chrom recently eliminated support for the command line interface that chromConverter uses and the older version doesn't seem to be available anymore from their website. I can think of 3 options for you. Probably the simplest thing might be to use the MSnbase package instead to convert the files. The syntax would be something like:

files <- list.files(<path_to_files>, pattern="CDF", full.names = TRUE)
rawdata <- readMSData(files, msLevel = 1, verbose = FALSE)
writeMSData(rawdata, file = fs::path(<path_out>, basename(files), ext = "mzML"), outformat = "mzml")

Alternatively, if you can find OpenChrom v1.4.x, you could use the OpenChrom parser to convert the files through chromConverter.

Otherwise, you could use the OpenChrom software directly through the graphical user interface to convert the files.

I think it would be nice to incorporate better support for writing mzML into chromConverter, but unfortunately I don't think i'll have much time to look into it at least for a while.

Ethan