-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
86 lines (67 loc) · 3.14 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
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: "Reconstructing Ordered Ontogenic Trajectories"
author: "Wajid Jawaid"
date: "`r Sys.Date()`"
output: github_document
vignette: >
%\VignetteIndexEntry{Infer biologically plausible journeys through single cell data}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/roots)](https://cran.r-project.org/package=roots) [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![CRAN mirror downloads](http://cranlogs.r-pkg.org/badges/roots)](https://cran.r-project.org/package=roots/)
Reconstructing ordered ontogenic trajectories provides methods for:
1. Identifying informative genes (crude),
2. Finding a sparse graph structure between closely related cells by removing spurious edges and
3. Traversing the graph in a biologiclal informed way using a Directed Non-markovian Monte-Carlo method.
The main goal of *roots* is to infer plausible developmental journeys guided by the user.
## Installation
Can be installed through CRAN or GitHub
### CRAN
```{r installation_CRAN, echo=TRUE, eval=FALSE}
install.packages("roots")
```
### Bleeding edge
```{r installation_GitHub, echo=TRUE, eval=FALSE}
library(devtools)
install_github("wjawaid/roots")
```
## Example
Here I take the mouse adult haematopoietic data from [Nestorowa et al.](http://www.bloodjournal.org/content/early/2016/06/30/blood-2016-05-716480). Data is downloaded and processed using the **goggles()** function as below.
```{r example, echo=TRUE, eval=FALSE}
library(roots)
## Load data
blood <- read.table("http://blood.stemcells.cam.ac.uk/data/norm_counts_nestorowa_data.txt",
sep = " ")
cellNames <- read.table("http://blood.stemcells.cam.ac.uk/data/cell_names_nestorowa_data.txt",
sep = " ", stringsAsFactors = FALSE)[,1]
rownames(blood) <- gsub("LT\\.", "LT-", cellNames)
geneNames <- read.table("http://blood.stemcells.cam.ac.uk/data/gene_names_nestorowa_data.txt",
sep = " ", stringsAsFactors = FALSE)[,1]
colnames(blood) <- geneNames
blood <- as.matrix(blood)
rm(cellNames, geneNames)
## Load metadata
meta <- read.csv("http://blood.stemcells.cam.ac.uk/data/wj_out_jd.csv")
colnames(meta) <- c("cellType", "index", "name")
rownames(meta) <- meta$name
meta$col <- bglab::ggCol(meta$cellType)
nmeta <- data.frame(col=rep("#00000011", nrow(blood)), stringsAsFactors = FALSE,
row.names = rownames(blood))
nmeta[rownames(meta),"col"] <- meta$col
leg <- data.frame(cell=as.character(unique(meta$cellType)),
col=as.character(unique(meta$col)), stringsAsFactors = FALSE)
legOrd <- c(5, 8, 6, 7, 1, 4, 2, 3)
## Analyse
xx <- goggles(blood)
## Plot
plot(xx$l, pch=16, col = nmeta[rownames(xx$l), "col"])
legend("topright", legend = leg$cell[legOrd], fill=leg$col[legOrd], inset=0.02)
```
![Output from goggle() function](./vignettes/example.png)