Page 1 of 1

netCDF not opening properly in AMDIS

Posted: Fri Sep 28, 2018 5:03 pm
by cswanson
Hi all,

Long story short, I've been doing baseline correction of GC-MS data with metAlign and attempting to do deconvolution (thru OpenChrom) in AMDIS. However, AMDIS doesn't like the look of the .cdf file that metAlign spits out. In AMDIS it seems like all my chromatography is there, but it's crammed to the left side of the TIC window and the rest of it is basically blank. The file opens correctly in OpenChrom and mzMine.
Link to the offending file.
Because it opens correctly in other programs I have a feeling it has to do with how AMDIS reads this .cdf. Has anyone had this problem/solved it?

Re: netCDF not opening properly in AMDIS

Posted: Fri Sep 28, 2018 6:48 pm
by antonk
Thank you, with your file I fixed a bug in UniChrom MS Import.

Your file is pretty normal, maybe AMDIS does not like sections which are not mandatory according to spec and filled with NO_VALUE(-9999).

a_d_sampling_rate, a_d_coaddition_factor, resolution, actual_scan_number, time_range_min, time_range_max

you can dump the file in human-readable format using ncdump utility

ncdump file.cdf > file.cdl

Then remove suspected section using text editor and generate CDF file back

ncgen file.cdl

Re: netCDF not opening properly in AMDIS

Posted: Fri Sep 28, 2018 7:40 pm
by cswanson
Glad my suffering was good for something, haha.

I'm thinking that it might have something to do with the sections for time_range, since the data all seems to be there but is just smashed over to the left side.

I'll try your suggestion of removing those sections. I thought I was handy with computers/software, but I'm finding out that I only know the most basic of basics haha.

Re: netCDF not opening properly in AMDIS

Posted: Fri Sep 28, 2018 9:59 pm
by cswanson
I examined my "bad" file against a "good" file and they look pretty much the same.

Seems like I didn't link the correct bad file. Here is an actual bad actor. There are a lot of zeros in the intensity section (could be due to the baseline correction). Scan_index also looks like it has a bunch of repeating numbers...

Also when I convert the .cdl back to .cdf using ncgen, it is unreadable by AMDIS and mzMine...

As a bonus, I took a picture of what this file looks like when you try to open it in AMDIS. The pink box shows what I think is my whole 40min run; if I click over there and scroll with the directional keys I can see the scan number, RT, and spectrum increasing.

Re: netCDF not opening properly in AMDIS

Posted: Sat Sep 29, 2018 7:02 am
by antonk
This file is Really Bad!

This array should contain the number of MS peaks in successive scans
point_count = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

mass_values = 50, 50, 77, 77, 77, 77, 77, 77, 77, 157, 157, 157, 125, 125,

It looks like off-by-one programming error.

Scan #1 contain 1 mass-peak with 50 m/z,
Scan #2 - 50
Scan #3 - 77
But point count should be 1, not 0!

Try this http://unichrom.com/support/chrom/ReallyBad-fixed.cdf
with AMDIS

Re: netCDF not opening properly in AMDIS

Posted: Mon Oct 01, 2018 8:30 pm
by cswanson
Thank you so much for your help antonk, but unfortunately the file looks the same as the others: in AMDIS it's all pushed up to the left side, but opens normally in MZmine.

I did some testing today with my metAlign - long story short, if I set my output format as .cdf, I get the bad file that won't open in AMDIS (just the "baseline" file is messed up, though, the "nominal" file reads just fine...). If I set my output as ChemStation (.D), it can be read in AMDIS (well, you have to change the file name to DATA.ms instead of msd1.ms, or else AMDIS won't recognize it).

I'm not sure if this is a flaw in metAlign in general or in my particular install - when I was having problems earlier last week I attempted to "uninstall" and reinstall, but I don't know if that may have made it wacky. Also, I couldn't get netCDF to make a readable file from the .cdl, but maybe it is operator error (i.e. me).
*sigh* Maybe I should look into seeing if I can do this testing in a virtual machine so I can stop messing up my work computer!

Re: netCDF not opening properly in AMDIS

Posted: Fri Oct 19, 2018 6:58 pm
by cswanson
I ended up finding a solution if anyone runs across the same problem.

It seems like AMDIS does not like "empty" scans in the netCDF file format (other programs have no problem tho...). The baseline-corrected MetAlign output in Chemstation .D format opens fine in AMDIS, even with the "empty" scans. When I attempted to do deconvolution through OpenChrom, OpenChrom first translates the file to a netCDF and then sends this to AMDIS for processing. This led to the same issue I was having with the MetAlign output as netCDF - chromatography was all bunched up to the left and no deconvolution could be done.

The empty scans need to be removed if you are wanting to use AMDIS with netCDF data. (I'm thinking it is likely empty ones at the start of the data, but this is speculation) OpenChrom has a filter to remove empty scans (Chromatogram>Filter>Chromatogram>Remove Empty Scans; thanks Alexander and Andreas from OpenChrom for the help!) before doing the AMDIS deconvolution. I am sure other programs can have similar filters for removing empty scans.