1
$\begingroup$

I've been give mass spec data in very simple format .txt files. Each file is two columns, m/z and intensity. There is no header or anything. Are there any programs that can read this file? Or how can I convert this to a file readable by a program such as OpenChrom.

I know I can use Excel, but I'd really like the functionality of dedicated MS programs (simulated peaks, zooming, etc).

UPDATE: Some extra info for anyone with similar issues in the future. The MS measurements were performed via direct infusion on a Waters brand MS. I learned that Waters output files are notoriously opaque, which is part of the reason I was given a .txt output. I asked for the original files and got them. I was able to convert the raw files to mzML with MSConvert from proteowizard. OpenChrom was then able to open and view the spectra. At this point, it's merely a matter of me learning the best software to do what I want to do, i.e. view the full, combined spectra of a direct infusion MS measurement, then pick the picks and export those with predictive spectra.

Thanks to everyone who took a look at this and provided insight.

$\endgroup$
2
  • $\begingroup$ Not familiar with that particular software. Your TXT file is an ASCII file and you can open it with a text editor (Notepad, NotePad++, etc). Usually this kind of files are also written with the extensión DAT and CSV (Comma Separated Values). In the web page of OpenChrom indicates that it can read TXT and DAT formats so you could probably read those data directly in the program. $\endgroup$
    – PAEP
    Sep 29, 2023 at 19:25
  • $\begingroup$ @PAEP OpenChrom can recognize and open the .txt from File>Open Chromatogram, but there are no visualizations at all. I believe that since there is no actual chromatogram data, just MS peaks, OpenChrom either can't interpret it or I don't know how to make it do so. Thank you for your quick reply. $\endgroup$
    – J.R.
    Sep 29, 2023 at 19:41

1 Answer 1

5
$\begingroup$

A simple approach can rely on gnuplot, which is freely available at least for the Windows, Mac, and Linux operating system. It is not a dedicated MS program to simulate fragmentation patterns / predict the intensity of the $\ce{^{13}C}$ peak next to the one of the molecule ion, but provides you a quick visualization of the data recorded.

Because you don't state if the two columns in question are separated by space, or by column, I assume they are space separated. This is a pattern e.g. for mass spectra in the AIST Spectral Database. Let's depart from the MS data for their entry 4275, benzyl bromide:

      38.0       1.5
      39.0       5.6
      41.0       1.3
      50.0       2.1
      51.0       3.1
      52.0       1.4
      62.0       1.8
      63.0       5.0
      64.0       1.6
      65.0      12.2
      89.0       4.3
      90.0       2.5
      91.0     100.0
      92.0       8.0
     170.0       4.1
     172.0       4.0

with the first column about m/z, and the second about the relative intensity of peaks recorded which I save as file BnBr.dat.

Launching gnuplot (in Linux, this would be gnuplot) in the folder containing the data file to visualize, the minimal command within gnuplot's terminal would be

plot "BnBr.dat" with impulses

The then available window includes a magnifying glass, by right button mouse click and drag you can define the region of interest to magnify. Note that simple hoovering of the mouse allows to read values of abcissa and ordinate, too.

enter image description here

If you invest yourself a little bit deeper into the syntax of gnuplot, you can write small scripts to reuse certain actions. Let's assume you saved the following snippet as file example_script.gp

#!/usr/bin/gnuplot -c

set term png

output_a=ARG1
output_b=".png"
output_file=output_a.output_b

set output output_file

set grid
set xrange [20:*]
set yrange [0:100]
set xlabel "m/z"
set ylabel "intensity [%]"

plot ARG1 with impulses linewidth 2 title ARG1

then this utility can write you a permanent record (as .png file) when called in pattern of

gnuplot -c example_script.gp  BnBr.dat

to yield the static file BnBr.dat.png as lightly embellished overview:

enter image description here

(In case of Linux, you can provide the script the executable bit by chmod +x ./example_script.gp, to shorten subsequent calls to a pattern like ./example_script.gp BnBr.dat) Not only that this script documents how the data were processed (and that this recipe can be shared/extended with colleagues), this allows you to consistently apply the same operation on stack of many MS data:

  • the flag -c instructs gnuplot to collect arguments from the command line, here: the file name containing the raw data
  • it defines png as output format (alternatives can be pdf, svg)
  • it constructs a file name for the permanent record to be written
  • as visual embellishments, an optional grid, labels on abscissa and ordinate, and explicit ranges of the axes: always the complete range (intensity scale), and to skip the display of fragments typically too light to be of diagnostic value for organic molecules (m/z scale)
  • eventually plot the diagram with wider lines

(Beside the material on gnuplot.info, the blog gnuplotting.org and Philip Janert's Gnuplot in Action are among valuable resources to gradually learn gnuplot.)

If your data are comma separated/.csv and you don't mind adding a header on each column, you can upload the file to a service like plotly chart studio. This approach is more spread sheet/mouse click centred with interactive pan and zoom:

enter image description here


Addition:

Contrasting to UV-Vis, IR, and NMR with fix chromophores to absorb some radiation to yield a signal (perhaps it overlaps with a signal by an other), the fragmentation mechanism and hence pattern of the eventual recorded MS spectrum depends e.g. on the nature of ionization (hard EI vs the softer CI and MALDI technique). This complicates the prediction of a complete MS spectra.

Nevertheless, rules derived from recorded spectra provide guidance which can be implemented into computer programs. Among the MS toolbox by EPFL however are calculators like a mass calculator for small molecules (enter Hill formula, SMILES string, mol file, or structure formula) to provide a prediction which simultaneously considers the isotopic intensity pattern $\ce{^{12}C}$/$\ce{^{13}C}$ and e.g., $\ce{^{79}Br}$/$\ce{^{81}Br}$. The pattern about the input structure can be downloaded as .svg or .csv:

enter image description here

This leaves it to the user to recognize in the molecule structures known to plausible fragmentation reactions ($\alpha$-cleavage of aryl ketones, McLafferty fragmentation, etc.) which seem to be implemented in the predictions by ChemDraw, or ChemSketch MS Fragmenter.

Within the project Competitive Fragmentation Modelling for Metabolite Identification (CFM-ID), there is a spectra prediction which, departing from SMILES or InChI

« ... predicts QToF MS/MS spectra for multiple collision energies for a given input small molecule. Spectra are computed for low (10 eV), medium (20 eV) and high (40 eV) collision energy levels and are represented by a list of 'mass intensity' pairs, each corresponding to a peak in the spectrum.»

along with a peak assignment (for experimentally recorded spectra) and compound identification. With BrCc1ccccc1, a SMILES string to represent again benyzl bromide, two of the spectra of fragmentation pattern suggested are shown below:

enter image description here

Though you can access the results of the algorithm as pure text file and by pic of the peaks a suggested fragment (e.g., an isomer of the tropylium ion), differences between the suggestion for $\pu{20 eV}$ vs $\pu{40 eV}$ are noticeable. However, though an ionization with $\pu{40 eV}$ here is considered high, it is low in comparison to frequently seen $\pu{70 eV}$ in routine LC-MS in the organic synthesis lab to yield as much as possible fragmentation of small molecules (the MS by AIST was recored with $\pu{75 eV}$).* Your question does not detail if the data to analyze and compare with a reference actually are larger proteins/biomolecules, or not (perhaps BnBr is not representive for your analytes).

* In fairness to the algorithm however, a primary alkyl bromide is a nasty function unlikely to be present in a drug, nor metabolite.

$\endgroup$
2
  • $\begingroup$ Thank you for the very in-depth answer. I really appreciate the effort you've put into helping me solve my problem. I've used Gnuplot in the past, so I knew that it had the capability to make nice looking plots of this data. But I'm a novice with the program, so this explanation is definitely valuable as I try to make better looking plots. Thank you! However, the main functionality I'd like is simulated/theoretical peaks, ideally input with molecular formula. This way, I can quickly analyze messy spectra. I don't think I conveyed that very well in my original post. Thanks again. $\endgroup$
    – J.R.
    Oct 2, 2023 at 16:05
  • $\begingroup$ @J.R. The answer was slightly extended. $\endgroup$
    – Buttonwood
    Oct 3, 2023 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.