plotAlignedSamples: Visualise how input samples align to the reference set using...

View source: R/plotAlignedSamples.R

plotAlignedSamplesR Documentation

Visualise how input samples align to the reference set using PCA

Description

Visualise how input samples align to the reference set using PCA

Usage

plotAlignedSamples(preds, pcs = c(1, 2), color_by = "SRS")

Arguments

preds

A sepsisPrediction object containing the output from the stratifyPatients() function

pcs

A vector of length 2, specifying which principal components should be plotted

color_by

Variable by which data points should be coloured. Must be one of the following: "SRS", "SRSq", and "mNN_outlier"

Details

This function can be used to check whether a set of input samples was successfully mapped to the reference set.

When called, this function performs principal component analysis on the aligned data (i.e. an integrated set containing both the user's input and the reference samples). Next, the first two principal components are plotted. Reference samples are plotted in the background with low transparency, with the user's input samples as darker points in the foreground. The user can specify which variable to color the data points by. Three options are available: "SRS", "SRSq" and "mNN_outlier" This last ooption is useful when assessing if a subset of samples flagged as outliers should be excluded.

Value

A plot showing the distribution of input and reference samples in PCA space. This plot is a ggplot object.

Examples

# Load test data set
data(test_data)

# Stratify patients
predictions <- stratifyPatients(test_data)

# Plot alignment results
plotAlignedSamples(predictions)

jknightlab/SepstratifieR documentation built on March 19, 2022, 9:43 p.m.