ISS_tsne: Dimentionality reduction to 2D by tSNE

Description Usage Arguments Value Examples

View source: R/5.2_ISS_tsne.R

Description

Any data in class MolDiaISS clusteded or not clustered used to reduce dimention to 2D by RCA-tsne.

Usage

1
ISS_tsne(data, pc = 1, perplexity = 30)

Arguments

data

Input data in class MolDiaISS. Output of readISS.

pc

Desired percent of variance to be explained by PCA. Default is 1 which means 100 percent variation explained.

perplexity

Numeric; Perplexity parameter. See Rtsne

Value

2D dataframe of points in slot @tsne.data.

Examples

 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
## Reading data
left_hypo <- readISS(file = system.file("extdata", "Hypocampus_left.csv", package="MolDia"),
                  cellid = "CellId", centX = "centroid_x", centY = "centroid_y")

## Arrange marker gene
data(marker_gene)
mark_gene <- list(genr = marker_gene$genr, neuron = c(marker_gene$genr_neuro,
                                                      marker_gene$genr_neuro_pyra1,
                                                      marker_gene$genr_neuro_pyra2,
                                                      marker_gene$genr_neuro_inter1,
                                                      marker_gene$genr_neuro_inter2,
                                                      marker_gene$genr_neuro_inter3,
                                                      marker_gene$genr_neuro_inter4,
                                                      marker_gene$genr_neuro_inter5,
                                                      marker_gene$genr_neuro_inter6),
                                            nonneuron = marker_gene$genr_nonneuro)

## Barplot of Neuronal marker gene and extract those cells only
neuron_group <- ISS_barplot(data = left_hypo, gene = mark_gene, gene.target = 2,
                            at.least.gene = 2, gene.show = 2)

## Data preprocessing
neuron_group <- ISS_preprocess(data = neuron_group, normalization.method = "LogNormalize",
                               do.scale = TRUE, do.center = TRUE)
                               
#### Dimention reduction by tSNE on non-clustered data
tsne_noclust <- ISS_tsne(data = neuron_group, pc = 0.7)
# Plot tSNE
result <- ISS_map(data = tsne_noclust, what = "tsneAll")
# Plot selected gene on tSNE plot
result <- ISS_map(data = tsne_noclust, what = "tsne", gene =tsne_noclust@gene[1:2] )


#### Dimention reduction by tSNE on clustered data
# Cluster data based on SEURAT pipeline
neuron_group_clust  <- ISS_cluster(data = neuron_group, pc = 0.7, resolution = 0.3, method = "seurat")
# Dimention reduction by tSNE
tsne_clust   <- ISS_tsne(data = neuron_group_clust, pc= 0.9, perplexity= 100)
Plot cluster on tSNE plot
result <- ISS_map(data = tsne_clust, what = "tsneAll")

mashranga/MolDia documentation built on May 26, 2019, 9:36 a.m.