Skip to content

Load and analyze MS-DIAL alignment files in R for analysis of mass spectrometry data.

License

Notifications You must be signed in to change notification settings

ethanbass/mzinspectr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msdialreadr

msdialreadr status badge stability-experimental

A few functions for analyzing MS-DIAL alignments in R.

Note: This package is not created or endorsed by the creators of MS-DIAL.

Installation

Currently it's recommended to install msdialreadr directly from GitHub.

install.packages("devtools")
devtools::install_github("https://github.com/ethanbass/msdialreadr/")

It can also be installed via R Universe:

install.packages("msdialreadr", repos="https://ethanbass.r-universe.dev/", type="source")

Exporting your alignment

Export your alignment from MS-DIAL by selecting the Export:Alignment Result menu.

Reading alignment into R

Read your alignment into R using the read_alignment function, providing the path to your MS-DIAL alignment file. This will produce a list of matrices. The first element will be the actual peak table (tab) with the areas or heights of the features detected by MS-DIAL. The second element will contain the peak metadata returned by MS-DIAL such as retention indices, mass spectra, and any identifications done in MS-DIAL (peak_meta). The third element is intended to hold sample metadata (sample_meta) provided by the user, which can be added using the attach_metadata function.

The attach_metadata function takes three arguments: an MS-DIAL alignment object (x), a dataframe or matrix containing the sample metadata (meta), and a string specifying the column in meta to be matched with the names of the samples (col).

Normalization

There are currently several different options for feature normalization, including normalization by an internal standard (normalize_itsd), total sum normalization (tsn) and probabilistic quotient normalization (pqn). You can also subtract the mean or median value from a set of blanks from each peak using the subtract_blanks function.

Peak identification

There is preliminary support for peak identification by searching a user-provided mass-spectral database through the search_spectra function. It takes several parameters, including an ms-dial alignment object (x), a spectral database (db), the column or columns to identify (cols), the maximum retention index shift to exclude a match from consideration (ri_thresh), the relative weight to give spectral similarity versus retention index similarity (spectral_weight), the number of results to return (n.results), and the number of cores to use for parallel processing (mc.cores).

To compile a mass spectral database, I recommend checking out mspcompiler.

Visualization

Spectra can be plotted using either "base R" graphics or plotly graphics using the plot_spectrum function, which takes an ms-dial alignment object (x) and a column index (col) as arguments.

About

Load and analyze MS-DIAL alignment files in R for analysis of mass spectrometry data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages