Skip to the content.

Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics


Statistical analysis

Note that this is only relevant for files which have been pre-processed, annotated and coregistered. See the previous sections for further information.

Single file

For performing statistical analysis on a single file, use the workflow file StatsWorkflow.m in the main folder. The following sections are briefly described here with more information available in the file itself.

The code is slightly different to what has been prepared previously. The file MSData.m contains a class definition and various methods associated with that class. On importing a file, we create an instance of the class called on object. The methods can be run on the object fairly easily.

Import data

To import the data, provide a file path and name to a coregistered .mat file. The various parts are imported and an MSData class object with name `d’ is returned. The name can be changed as you wish. When the file is imported, the tissue/background mask is taken from the coregistration stage; this can be checked in the next section and amended as required.

Normalisation

There are four options available for normalisation: 'tic' | 'vec2' | 'pqn' | 'none'. Following this stage, a log transformation can be applied by setting the value to true | false.

Principal components analysis

Perform PCA over either all pixels or just the tissue pixels. Images can be plot as either single components or as RGB images of 3 components.

Cross-validated predictions

The annotations extracted from the H&E image in a previous section are used, along with (if selected) a series of random background pixels. These are split into 4 groups and a leave region out cross validation is performed, whereby one ‘rectangle’ is omitted each turn and the other regions are used to predict that omitted rectangle. Results can be presented as a confusion matrix or an image.

Whole image predictions

This uses logistic regression to predict the class of all pixels in the image. A model is trained using the annotated regions and subsequently applied to all pixels.

Univariate statistical analysis

ANOVA is performed for each variable to determine differences between annotation groups (requires more than 1). The results can be output as a table sorted according to the FDR-corrected p values, which provides basic variable information such as mean intensity of the annotated regions.

Variable visualisation

Plot ion images or box plots for specific variables. Ion images can be either individual or in RGB form (i.e. 3 ions) and intensities for each ion are modified, whereby intensities above the 95th percentile are set to that value. In RGB form, the individual images are scaled between 0-1 for visualisation purposes.

Box plots can be generated in a few different ways, either classically as box and whisker plots with outliers, or as scattered plots to show the variable distribution.

Multiple files

No further information will be included to this section. Further development will be in another repository.


Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics