Description Usage Arguments Value Examples
Helper function to plot aligned data from the results of running scAlign().
1 2 |
object |
scAlign class object with aligned data |
data.use |
Specifies which alignment results to use. |
labels.use |
Specifies "dataset" or "celltype" labeling from object meta.data. |
cols |
Colours for plot |
title |
ggplot title |
legend |
Determines if legend should be drawn |
seed |
Random seed for reproducability |
... |
Additional arguments to Rtsne function |
labels |
Object labels |
ggplot2 object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | library(SingleCellExperiment)
## Input data, 1000 genes x 100 cells
data = matrix( rnorm(1000*100,mean=0,sd=1), 1000, 100)
rownames(data) = paste0("gene", seq_len(1000))
colnames(data) = paste0("cell", seq_len(100))
age = c(rep("young",50), rep("old",50))
labels = c(c(rep("type1",25), rep("type2",25)), c(rep("type1",25), rep("type2",25)))
ctrl.data = data[,which(age == "young")]
stim.data = data[,which(age == "old")]
## Build the SCE object for input to scAlign using Seurat preprocessing and variable gene selection
ctrlSCE <- SingleCellExperiment(
assays = list(scale.data = data[,which(age == "young")]))
stimSCE <- SingleCellExperiment(
assays = list(scale.data = data[,which(age == "old")]))
## Build the scAlign class object and compute PCs
scAlignHSC = scAlignCreateObject(sce.objects = list("YOUNG"=ctrlSCE,
"OLD"=stimSCE),
labels = list(labels[which(age == "young")],
labels[which(age == "old")]),
pca.reduce = FALSE,
cca.reduce = FALSE,
project.name = "scAlign_Kowalcyzk_HSC")
## Run scAlign with high_var_genes
scAlignHSC = scAlign(scAlignHSC,
options=scAlignOptions(steps=100,
log.every=100,
norm=TRUE,
early.stop=FALSE),
encoder.data="scale.data",
supervised='none',
run.encoder=TRUE,
run.decoder=FALSE,
log.results=FALSE,
log.dir=file.path('~/models','gene_input'),
device="CPU")
## Plot alignment for 3 input types
example_plot = PlotTSNE(scAlignHSC,
"ALIGNED-GENE",
"scAlign.labels",
title="scAlign-Gene",
perplexity=30)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.