mass spectrometric analysis
loading analyzeGCMSdata (basic)
phylochemistry
provides a simple application for integrating and analyzing GC-MS data. With it, you can analyze .CDF files, which contain essentially all the data from a GC-MS run, and can be exported from most GC-MS systems using the software provided by the manufacturer. Instructions for this are provided at the end of this chapter. To run the application, use the following guidelines:
Create a new folder on your hard drive and place your CDF file(s) into that folder. It doesn’t matter what the name of that folder is, but it must not contain special characters (including a space
in the name). For example, if my CDF file is called “sorghum_bicolor.CDF”, then I might create a folder called
gc_data
on my hard drive, and place the “sorghum_bicolor.CDF” file in that folder.In RStudio, run the source command to load
gcms
(note: if you are loading thephylochemistry
source, you can skip this step):
source("https://thebustalab.github.io/phylochemistry/gcms.R")
- In RStudio, run the
analyzeGCMSdata
command on the folder that contains your CDF file.
If you are on a Mac, use single forward slashes. For example:
analyzeGCMSdata("/Volumes/My_Drive/gc_data")
If you are on a PC, use double back slashes. For example:
analyzeGCMSdata("C:\\Users\\My_Profile\\gc_data")
The first time you open your datafile, it may take a while to load. Once the new RShiny window opens, press shift+q to load the chromatogram(s).
1.1 using analyzeGCMSdata
As a reference, below are the key commands used to operate the integration app. This is the information that is covered in the overview video.
To control the chromatogram window:
- shift + q = update
- shift + a = add selected peak
- shift + r = remove selected peak
- shift + g = add global peak
- shift + z = save table
To control the mass spectrum window:
- shift+1 = extract mass spectra from highlighted chromatogram region, plot average mass spectrum in panel 1.
- shift+2 = refresh mass spectrum in panel 1. This is used for zooming in on a region of the mass spectrum that you have highlighted. A spectrum needs to first be extracted for this to be possible.
- shift+3 = extract mass spectra from highlighted chromatogram region, subtract their average from the mass spectrum in panel 1.
- shift+4 = search current spectrum in panel 1 against library of mass spectra (only available if you load via
phylochemistry
). - shift+5 = save the current spectrum in panel 1 as a csv file (only available if you load via
phylochemistry
).
using analyzeGCMSdata (advanced)
You can ask analyzeGCMSdata
to extract single ion chromatograms if you wish. Just specify a list of ions as an argument. Note that specifying “0” corresponds to the total ion chromatogram and must be included as the first item in the list. For example:
analyzeGCMSdata("/Volumes/My_Drive/gc_data", ions = c("0", "218"))
Will return an interface that shows chromatograms for the total ion count and for ion 218.
At this point, note that you have a new set of files in your data-containing folder. There will be one *.CDF.csv
file for each CDF file you have in the folder. This contains a matrix of all the mass measurements in your entire sample - the abundance of each m/z value during each scan. There is also a chromatograms.csv
file. This is a list of all the chromatograms (total ion + whatever single ions were specified). These can be useful for creating plots of chromatograms via ggplot.
1.2 CDF export
- On the GC-MS computer, open Enhanced Data Analysis
- File > Export Data To .AIA Format, Create New Directory (“OK”) > Desktop (create a folder with a name you will remember)
- Select all the datafiles you wish to analyze and process them, saving the output into the folder you just created
- Copy the .D files for the samples you wish to analyze to the same folder
- Move this folder to your personal computer
- Create one folder for each sample, and put the corresponding .CDF file into that folder.