Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics
imzmlProc
This repository is for pre-processing imzml and h5 mass spectrometry imaging files. There are also tools for annotation of optical images as well as for the coregistration of these images (and annotations) to the MS image.
Download and run
The code is written for MATLAB and makes use of some of its toolboxes (see README for further information).
Workflow
The entire pre-processing workflow is laid out imzmlWorkflow.m. It is recommended to open this file within MATLAB, and run through each cell (separated by %%
symbols) in consultation with documentation. Functions called within imzmlWorkflow.m tend to run on an entire folder’s worth of imzml files (see note at bottom). It is suggested that initially you work with a folder which contains a couple of imzml files in order to understand various parameters and their effects.
Alternative workflow
Whilst predominantly focused on pre-processing of imzML files, there is some support for reading in H5 and Waters .raw files. The H5 files that are supported are those generated from Waters .raw format using the papillon repository. Alternatively, the .raw files can be directly imported in the same workflow using functions from the seascape repository. The workflow is split into two parts, h5WorkflowPart1.m
and h5WorkflowPart2.m
. The first deals with the recalibration and averaging stages; the second is for peak picking and subsequent extraction from the .h5/.raw files. The same (or substantially so) functions are used for processing these files as for the .imzML files, and the documentation on these pages is applicable for all .imzML/.h5/.raw files.
Recalibration
Recalibrate m/z values according to certain reference ions. These ions should be present in a majority of pixels for the process to be effective.
Pre-processing
This encompasses the generation of a datacube across a cohort of files. Its various processes are detailed further in the relevant page, but they include:
- Average spectrum generation (per file)
- Peak picking across all files
- Extraction of peaks to form a datacube
Annotation
This stage facilitates the annotation of matched H&E images so that these annotations can be coregistered on to the MS image. Depending on the format of the annotations, one of these two methods should be suitable.
- Extract annotations from the H&E image: for DK samples where annotations have already been drawn on the optical image and these exported as JPEGs
- Draw in the image: likely relevant for most other studies, this approach allows free-hand drawing of annotation regions on the H&E image
Coregistration
There are workflows for coregistering a single file at a time, as well as batch mode which works through an entire folder’s worth of images. Various representations of the MS image are generated automatically in case certain ions/PCs do not provide sufficient contrast.
Statistical analysis
With annotated and coregiestered images, statistical analysis can be performed using those regions. Limited functions are available in this repository with further developments being placed in another repository.
❗️File lists
Note that the recalibration and generation of average spectra are independent processes and can be performed on any number of files at any time. The peak picking stage (essentially beginning from ‘Import the average spectra’) brings together all files in order to determine a common series of peaks which will be subsequently extracted. If any new files are added, or any removed, it is important re-load the relevant average spectra, perform peak picking, and then proceed to extract the variables from the imzml files.
Any changes to the file list necessitates that the pre-processing is performed again. Because this is a lengthy process, it is undesirable to proceed beyond these stages you wish to include more samples in this initial analysis. However, any samples acquired subsequently can be considered as part of an independent test set so it is best to leave these to one side for the moment.
Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics