-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-signatures.Rmd
88 lines (64 loc) · 1.91 KB
/
generate-signatures.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: "Generate signatures"
author: "Tiago Maié"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Generate signatures}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
## CimpleG (Simple CpG signatures)
* CimpleG tries to find the CpGs that best classify a cell-type given a train dataset
* It also enables you to perform cell-type deconvolution in a couple of easy steps
* It can use beta or M values
* Here we show how easy it is to generate a signatures
### Installation
If you haven't installed CimpleG, you can find the instructions to do so [here](https://costalab.github.io/CimpleG/#installation).
However it should be as simple as:
```{r install_cimpleg, eval=FALSE}
if(!require("CimpleG")) devtools::install_github("costalab/CimpleG")
```
### Loading package
We load the CimpleG package.
```{r load_cimpleg}
library("CimpleG")
```
### Loading data
In this tutorial, we will use a small dataset with just 409 samples and 1000 CpGs.
We will also use a table with metadata regarding these samples.
This dataset comes included with CimpleG. You can read more about it [here]().
```{r load_data}
# load data
data(train_data)
data(train_targets)
```
### Running CimpleG
Running CimpleG can be quite simple. You just need to run the CimpleG function with a few parameters.
```{r cimpleg}
# run CimpleG
cimpleg_result <- CimpleG(
train_data,
train_targets,
target_columns = c("blood_cells","hepatocytes"),
train_only = TRUE
)
```
Here we are generating signatures to find leukocytes and hepatocytes.
### Plotting CimpleG CpG signature
We can quickly visualize how our signature is able to separate the data.
```{r plot_cimpleg}
signature_plot(
cimpleg_result,
train_data,
train_targets,
sample_id_column = "gsm",
true_label_column = "cell_type"
)
```