-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
47 lines (38 loc) · 1.28 KB
/
README.Rmd
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
---
output: md_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.width = 8,
fig.height = 6,
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# snifter
<!-- badges: start -->
[![R build status](https://github.com/Alanocallaghan/snifter/workflows/R-CMD-check/badge.svg)](https://github.com/Alanocallaghan/snifter/actions)
[![BioC status](http://www.bioconductor.org/shields/build/release/bioc/snifter.svg)](https://bioconductor.org/checkResults/release/bioc-LATEST/snifter)
<!-- badges: end -->
R binding for [openTSNE](https://opentsne.readthedocs.io/en/latest/index.html)
using [basilisk](https://bioconductor.org/packages/devel/bioc/html/basilisk.html).
## Example usage
Basic usage of the function returns a matrix of t-SNE coordinates.
```{r}
library("snifter")
set.seed(42)
m <- matrix(rnorm(20000), ncol = 20)
snifter <- fitsne(m[-(1:2), ], random_state = 42L)
plot(snifter, pch = 19, xlab = "t-SNE 1", ylab = "t-SNE 2")
```
We can also project new points into an existing embedding.
```{r}
n <- 20
snifter <- fitsne(m[-(1:n), ], random_state = 42L)
plot(snifter, pch = 19, col = "black",
xlab = "t-SNE 1", ylab = "t-SNE 2")
new <- project(snifter, m[1:n, ], old = m[-c(1:n), ])
points(new, pch = 19, col = "red")
```