bovee / entab

* -> TSV
MIT License
21 stars 5 forks source link

Unknown doesn't have a parser for Chemstation .ch FID data #42

Closed nhadler closed 2 months ago

nhadler commented 1 year ago

When I try to load an FID file from chemstation Rev. C.01.07 via entab-cli and it throws an error:

> cat FID1A.ch | entab
##### AN ERROR OCCURRED ####
Unknown doesn't have a parser
#####

I've attached the file below

FID1A.ch.txt

bovee commented 1 year ago

Thanks for filing this and for attaching an example!

I checked the file and the magic is [0x03, 0x31, 0x37, 0x39] ("179" in ASCII) which had some rough support in Aston. It should be relatively easy to port that over although I'm not sure that was necessarily returning the correct numbers.

Separately, this error message could be more helpful for debugging so I opened #43 to improve it.

nhadler commented 1 year ago

Awesome. I can attach the exported CSV files from chemstation if that helps.

bovee commented 1 year ago

A CSV would be really helpful; I rewrote the old Aston code into Rust (as a new branch here), but the number of records and the intensities both aren't quite right.

ethanbass commented 1 year ago

Maybe the documentation included with rainbow can be helpful here as well (https://rainbow-api.readthedocs.io/en/latest/agilent/ch_fid.html)

ethanbass commented 1 year ago

I obtained some 181 type files and they seem to be very similar to the 179 except they are encoded in the big endian instead of the little endian as seems to be the case for the 179. I can share the 181 files with you over email if you'd like to have a look.

I wrote a little parser in R that seems to work for both versions (179 & 181) as far as I can tell, but i'm not sure if it's reading the file at the top of this thread correctly. The output is looking a little funny to me image

bovee commented 1 year ago

Yeah, I'm not totally sure, but I think the FID1A.ch file above might be slightly atypical of this format? A CSV/other open format export from Chemstation would help debug.

I'm a little busy with family and work for the near future, but happy to add 180/181 files to the backlog. Also happy to take pull requests! :)

ethanbass commented 1 year ago

Sounds good. I don't really know any rust at this point, but maybe some day i will try to learn. Happy holidays!

ethanbass commented 10 months ago

I checked it out in GC Chemstation (Rev. B.04.02 SP1 [212]) and the chromatogram I posted above seems to match (except there's something weird going on with the y-units). nhadler