Skip to main content
Chemistry LibreTexts

3.2 Representing and Managing Digital Spectra

  • Page ID
    95655
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    imageedit_3_8831637006.png

    CHEM3351: Cheminformatics

    Spring 2018: Bucholtz

    LibreText

    imageedit_1_6622691582.png

    REPRESENTING AND MANAGING DIGITAL SPECTRA

    Since the early 1970’s microcomputers (as they were called at the time) have been a huge part of the development of scientific instrumentation. As computer control of instrumentation became more prevalent, there was a need to also interface the detectors of instruments to the computer so that data (analog or digital) could be captured as it was generated, rather than output it on oscilloscope screens or chart recorders (see https://en.wikipedia.org/wiki/Chart_recorder).

    In the early years of the digital capture of spectral data the main limitation was storage capacity. As a result there was a practical limit on the time resolution (points per minute) and signal resolution (how many bits an analog signal was digitized as – see https://en.wikipedia.org/wiki/Analog-to-digital_converter). It wasn’t until the early 1980’s and the advent of the 5 1/4“ floppy disk which initially stored an amazing ~100 kB (0.1 MB) of data, that scientists were easily able to collect and save digital spectra.

    Today, instruments generate a vast amount of data and file sizes can be up to several GB each for certain techniques (e.g. GC-MS). This module describes some of the common file formats for spectral data, websites where you can obtain reliable spectral data, and software for viewing/simulating spectra.

    Spectral File Formats

    As there are many instrument vendors, there are many different file formats for spectral data. This approach was supported vendors who developed the instruments and software to operate them; thus, in order to go back and view spectra you need to use their proprietary software – which of course gets updated on a regular basis and generates revenue. However, the majority of software does have an export format for the data (and maybe some of the spectral metadata) that can be directly imported into Excel or other applications because this has been a need for users for many years. This is typically as Tab-Delimited Text (.txt file) or Comma Separate Variable (.csv file) files.

    Over time many scientists have lamented (even complained) that it would be much better if all of the data collected on instruments were stored in a common format that would make it easy to view and share data. While .txt and .csv files can be used for both activities, there has always been a need for a file format that supports both the spectral data and the associated metadata that describes the instrument type and settings, samples, analyte(s) and any other contextual information that gives the data value. Historically, this has been achieved using the following specifications (what are listed below are major specifications with formal standards – there are others that are less formally defined).

    ANalytical Data Interchange (ANDI)

    This is for mass spectrometry and chromatography data and is described by the ASTM Standards E1947 – Mass Spectrometry (http://www.astm.org/Standards/E1947.htm) and E1947 – Chromatography (http://www.astm.org/Standards/E1948.htm). ANDI uses the Network Common Data Form (NetCDF) self-describing data format that is generically defined to store array-oriented scientific data (http://www.unidata.ucar.edu/software/netcdf/).

    Crystallographic Information Framework (CIF)

    Used for crystallographic data only. This format is less traditional in its data organization than other formats because it not only contains x-ray crystallography patterns but a large, and very well organized, array of metadata about the system under study. This text format is a fundamental standard in the discipline of crystallography and authors of new crystallographic work must provide data in this format to get their work published. (http://www.iucr.org/resources/cif)

    The Joint Committee on Atomic and Molecular Physical Data – Data Exchange format (JCAMP-DX)

    For UV/Visible Spectrophotometry, Infrared, Mass Spectrometry, Nuclear Magnetic Resonance, and Electron Spin Resonance data. JCAMP-DX is currently administered by the International Union of Pure and Applied Chemistry (IUPAC) at http://www.jcamp-dx.org, although the format has not been actively updated in almost 10 years. Although JCAMP-DX has not formally been standardized, it is currently the de facto standard for sharing spectral data and all the major databases store their data in the format.

    JCAMP-DX is a file specification consisting of a number of LABELLED-DATA-RECORDs or LDRs. These are defined to allow reporting of spectral metadata and raw/processed instrument data. The table below outlines some of the main LDRs in JCAMP-DX.

    COMPUTER 21.jpeg

    An example JCAMP-DX file is shown below.

    ##TITLE= Cholesterol (pktab1.jdx)

    ##JCAMP-DX= 5 $$home made

    ##DATA TYPE= MASS SPECTRUM

    ##DATA CLASS= PEAK TABLE

    ##ORIGIN= Dept of Chem, UWI, Mona, JAMAICA

    ##OWNER= public domain

    ##$URL= http://wwwchem.uwimona.edu.jm:1104/s...ata/index.html

    ##SPECTROMETER/DATA SYSTEM= Finnigan

    ##INSTRUMENTAL PARAMETERS= LOW RESOLUTION

    ##.SPECTROMETER TYPE= TRAP

    ##.INLET= GC

    ##.IONIZATION MODE= EI+

    ##XUNITS= m/z

    ##YUNITS= relative abundance

    ##XFACTOR= 1

    ##YFACTOR= 1

    ##FIRSTX= 0

    ##LASTX= 386

    ##NPOINTS= 46

    ##FIRSTY= 0

    ##PEAK TABLE= (XY..XY)

    0,0

    41,520 43,1000 55,630 67,417 69,404 79,544 81,906 91,685 95,772 105,801

    107,685 119,439 121,515 133,468 135,461 145,760 147,571 159,529 161,386

    173,249 185,150 187,149 199,216 213,454 215,130 228,122 229,187 231,150

    247,568 255,378 260,165 261,106 275,306 287,24 297,22 301,207 314,67

    325,65 328,20 339,19 353,354 368,791 369,262 371,140 386,324

    ##END=

    Note the LDRs for XFACTOR and YFACTOR. Although in the above example these LDRs are both 1 (because the raw data is already integers), these factors are commonly used to represent numeric values with a large number of decimal places as integers so that only one or two numbers (the factors) have to be stored as decimal values. This means that storage of rounded numbers is minimized and any error incurred because of rounding is applied evenly to all the data points. An example of data in this format is below.

    ##YFACTOR= 9.5367E-7

    ##XYDATA= (X++(Y..Y))

    4400 68068800 68092800 68145600 68100800 68140800 68232000

    4394 68304000 68316800 68195200 68152000 68182400 68176000

    4388 68240000 68252800 68156800 68156800 68236800 68292800

    4382 68302400 68265600 68233600 68214400 68224000 68284800

    4376 68353600 68334400 68219200 68230400 68315200 68276800

    4370 68259200 68264000 68257600 68316800 68292800 68339200

    The data in a JCAMP-DX file can be all be compressed using a number of different human readable compression formats. This capability was added in order that spectral files were not to large for the storage media available (see above). There are four formats for compression, called ASCII Squeezed Difference Format (ASDF) outlined in one of the original articles on the JCAMP-DX format (http://old.iupac.org/jcamp/protocols/dxir01.pdf). These are listed below and use the letters as pseudo-digits.

    COMPUTER 22.jpeg

    As can be seen, the best compression is obtained by using the DIFDUP format which results in a 22/7 or 3.14x compression of the data. However, this is not always the amount of compression that will get because it depends on how variable the data points are in the file and it is important to choose the right format to get the best compression.

    In addition to these existing formats there are a couple of newer formats that will eventually replace the JCAMP-DX specification.

    Analytical Information Markup Language (AnIML)

    For all spectral data. AnIML is an eXtensible Markup Language (XML) format for storing instrument data and metadata under development since 2004 (http://animl.sourceforge.net). The specification is being coordinated under the American Standards and Testing of Materials (ASTM) E13.15 committee on analytical data.

    It was recognized in 2004 that there needed to be a successor to JCAMP-DX because of i) advances in technology, ii) a recognized need to represent data from all analytical techniques, and iii) issues with variants of JCAMP-DX that made interoperability of the files difficult. AnIML files consist of up to four data sections; SampleSet, ExperimentStepSet, AuditTrailEntrySet, and SignatureSet. By design very little data/metadata is required so that legacy data, which may not have much or any metadata to describe it, can be stored in the AnIML format. An example ‘minimum’ AnIML file is shown below:

    COMPUTER 23.jpeg

    For all analytical data. The Allotrope Foundation was formed in 2012 from seven (now twelve) pharma companies around the notion of changing instrument data standards so that they were uniform across all instrument vendors. Three years later, Allotrope has just made available the first version of the Allotrope Document Format (ADF) that is based on the HD5 format for managing and storing data (https://www.hdfgroup.org/HDF5/). The ADF format stores data and metadata from the entire laboratory process (not just the instrument data) and is arrange in layers for metadata (using controlled vocabularies and ontologies), data, and linked files. The specification is so new that it has not yet been released to the community, but should be out by the end of the year. See http://www.allotrope.org.

    Other spectral file formats

    Lists of file formats for the following analytical techniques can be found at

    SOURCES OF SPECTRAL DATA

    AIST Spectral Database for Organic Compounds (SDBS) - http://sdbs.db.aist.go.jp

    This database from Japan has a wealth of spectral information and is the best for searching, as there are many options to find what you need. Sadly, the majority of the spectra are presented as image files only (no JCAMP-DX) with only numeric peak data for MS and 1-NMR spectra (click the ‘peak data’ button. Currently, the site has the following amounts of spectral data:

    • MS: ~25000 spectra
    • 1H NMR: ~15900 spectra
    • 13C NMR: ~14200 spectra
    • FT-IR: ~54100 spectra
    • Raman: ~3500 spectra
    • ESR: ~2000 spectra

    NIST Chemistry Webbook - http://webbook.nist.gov/chemistry/

    The NIST Webbook is a prime source of spectral information about small organic compounds available as JCAMP-DX files, Scalable Vector Graphic (SVG - http://www.w3.org/Graphics/SVG/) files (an image format specified in XML), png image files, and scans of the original data (some from the 1960s). Searching for spectra on the site is done via the compound search and selection of the spectral data to be returned (if it is available for the compound(s) found). Other information such as thermodynamic property data, gas chromatograms (linked to original journal papers), and vibrational and electronic energy levels is also available on the site. Currently, the site has the following of spectral data:

    • IR spectra for over 16,000 compounds
    • Mass spectra for over 33,000 compounds
    • UV/Vis spectra for over 1600 compounds

    ChemSpider - http://www.chemspider.com

    ChemSpider has over 10,000 spectra associated with chemical compounds in its database. Some of these are from commercial companies and organizations, but a large number have been uploaded by users of the website. As a result there may be spectra for compounds that are not available elsewhere. Finding compounds that have spectra available is not easy to do and in fact you can only access this information via one of the sites API’s (see below), which you need to create an account (free) to use. Access the following URL to get an XML file that lists all current spectral data by entering your security token in the ‘token’ field, which can be found on the http://www.chemspider.com/UserProfile.aspx page once you login on the ChemSpider website.

    http://www.chemspider.com/Spectra.as...AllSpectraInfo

    You can also search for spectra using the other commands on the http://www.chemspider.com/Spectra.asmx page, and search the mass spectra using commands found in the MassSpecAPI page at http://www.chemspider.com/MassSpecAPI.asmx. For example to search for peaks in a mass spectrum of mass 1000 ± 0.1 you can go to (no token required):

    http://www.chemspider.com/MassSpecAP...1000&range=0.1

    Other Sources of Spectra

    SOFTWARE

    Spectral Viewers

    • Jmol with JSpecView - http://jmol.sourceforge.net/ - the best and most widely used online and offline spectral viewer. Browser plugin provides a lot of features for display of data and export in different formats (right mouse click the plugin to see options for viewing spectra and exporting data). Go to the links below to test out the functionality
      http://chemapps.stolaf.edu/jmol/jsmol/jsv.htm - drag and drop spectra viewing or search for molecules and display simulated spectra

    http://chemapps.stolaf.edu/jmol/jsmol/jsv_jme.htm - draw a molecule and get simulated

    spectrum

    http://chemapps.stolaf.edu/jmol/jsmol/jsv_predict2.htm - same as the previous page but with 3D representation of molecular structure

    Spectral Prediction

    Google Sheet WebScaping Spectra from NIST WebBook

    1. Set up the cells to talk to the databases: in each cell identified by brackets type in the following

    [A1]: Name (you will place the name of the chemical into [B2}, the cell next to it)
    [A2]: CASRN (we will remove the dashes from the CAS Registry Number as that is what the webbook uses to.

    [A3] In this cell we will use Data validation to provide options between MASS, IR and UVVis spectra.
    After clicking on cell A3, go to (click):DATA/DATA VALIDATION, and in Criteria choose "list of items", and in the box type IR,MASS,UVVis , and click "SAVE. You now have a dropdown box with these three options.

    [B1] - here you will type the chemical you are searching for.
    [B2]: =MID(IMPORTXML("https://chem.nlm.nih.gov/chemidplus/name/" & B1,"//link[@rel='canonical']/@href"),40,60)

    Here you are using the ChemIDplus service of NIH TOXNET to obtain the CAS registry number. For example, if you look up anthracene at toxnet the URL is: https://chem.nlm.nih.gov/chemidplus/name/anthracene, and you can see the CAS number is 120-12-7. Now if in your browser you click on "show page source", and search for that CAS number (ctrl "F"), <link rel="canonical" href="https://chem.nlm.nih.gov/chemidplus/rn/120-12-7" />, and you see that the CAS number starts at position 40. This search uses two Google SpreadSheets Functions, MID and IMPORTXML

    What you want is the link "https://chem.nlm.nih.gov/chemidplus/name/[CAS of your Chemical]

    IMPORTXML has syntax (url, expath_query), where "//link[@rel='canonical']@href" reads search for a "link" tag wherever in the pages such as it has the attribute "rel" that equals "canonical and pulls the value of its "href" attribute.

    MID has syntax ("string", starting _at, exact_length)

    note, https://chem.nlm.nih.gov/chemidplus/rn/120-12-7 has 39 characters, and so you take the 40th character of the string, with up to 60 in total.

    [B3]: =SUBSTITUTE(B2,"-","")

    The above removes the "-" from the CAS number because we need that when we find the spectra in the NIST webbook. To see this, go to http://webbook.nist.gov/chemistry/ click "search options"/name", type in anthracene, and click the buttons for IR, Mass and UVVis spectra. Scroll down the page until you see the UVVis, right click on the image and click copy image address, which gives you: http://webbook.nist.gov/cgi/cbook.cg...x=0&Type=UVVis, and note that the 120127 is the CAS number with no dashes.

    2. Insert Image of spectra

    Merge Cells over the ranges of C2 to L2 and and C19 to L19 making one large block,

    [Merged Cell Block]: =IMAGE("http://webbook.nist.gov/cgi/cbook.cgi?Spec=C" & B3 & "&Type=" &A5, 1)

    Here, you go to the Nist webbook, and grab the image at this address, with the number in cell B3 and pull the spectra of the type in the dropdown box)

    3. Download data

    [F24] =IMPORTDATA("http://webbook.nist.gov/cgi/cbook.cgi?JCAMP=C" & B3 & "&Type=" &A5)

    To understand the logic, go back to the UV-VIS spectra in the NIST book (see above), and scroll down to "Download spectrum in JCAMP-DX format," right click on "spectrum" and "Copy link address", given,http://webbook.nist.gov/cgi/cbook.cg...x=0&Type=UVVis. The above code allows you to change the modified CAS number to the one of your compound [B1], and to choose the type of spectra from the dropdown box [A5]

    SPECTRAL ASSIGNMENT

    1. Go to the NIST WebBook and download the following spectra in JCAMP-DX format
      1. Mass spectra for each of the three isomers of nitrobenzoic acid
      2. Gas phase IR spectra for each of the three isomers of nitroaniline
    2. Go to ChemSpider and download the HNMR spectra of the three isomers of xylene in JCAMP-DX (can you find them?)
    3. Go to the first JSpecView page above or download the JCAMP Viewer software for your OS. Import each of the spectra into the viewer you choose and export them to X,Y format.
    4. Finally, import each of the X,Y data files into Excel with one sheet for the MS data, one sheet for the IR data, and another sheet for the NMR data. Plot the three IR spectra on one graph (so they are overlaid) and do the same for the MS and NMR data (so you end up with three graphs). Save the file.
    5. Write a short paragraph comparing/contrasting for each of the three plots of overlaid IR, MS, and NMR spectra.
    Contributors:

    Stuart Chalk, University of North Florida
    Bob Belford, UALR
    Jordi Cuadros, IQS Universitat Ramon Llull


    3.2 Representing and Managing Digital Spectra is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?