View source: R/plotAlignedSamples.R
plotAlignedSamples | R Documentation |
Visualise how input samples align to the reference set using PCA
plotAlignedSamples(preds, pcs = c(1, 2), color_by = "SRS")
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" |
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.
A plot showing the distribution of input and reference samples in PCA space. This plot is a ggplot object.
# Load test data set data(test_data) # Stratify patients predictions <- stratifyPatients(test_data) # Plot alignment results plotAlignedSamples(predictions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.