library(devtools) load_all('..') library(rmarkdown) render('Monocle-McDavid.Rmd')
title: Monocle analysis of McDavid et al. cell cycle data author: John Reid bibliography: DeLorean.bib output: html_document
library(knitr) library(knitcitations) library(rmarkdown) # # knitr options # opts_chunk$set( fig.path = 'figures/McDavid-', stop_on_error = TRUE, fig.width = 12.5, fig.height = 8) # # Citations # cleanbib() cite_options( # hyperlink = 'to.doc', hyperlink = TRUE, # style = 'html', # citation_format = 'text', citation_format = "pandoc", cite.style = "numeric", check.entries = TRUE) # hyperlink = TRUE) bib <- read.bibtex("DeLorean.bib") if (file.exists("config.R")) { source("config.R") } # # Widths for saving figures # text.width <- 4.79 # LaTeX width in inches golden.ratio <- 1.618 # Pleasing ratio fig.width <- text.width fig.height <- text.width / golden.ratio
# suppressMessages(loadfonts()) library(DeLorean) # # Stylesheet # options(markdown.HTML.stylesheet = system.file("inst/Rmd/foghorn.css", package="DeLorean")) font.family <- "Verdana" font.theme <- theme_update(text=element_text(family=font.family)) theme_set(font.theme)
Load the data that we used for the DeLorean analysis and create a
CellDataSet
for use with Monocle
.
library(monocle) .data <- readRDS('McDavid-input.rds') colnames(.data$expr) <- rownames(.data$cell.meta) <- .data$cell.meta$cell rownames(.data$expr) <- rownames(.data$gene.meta) <- .data$gene.meta$gene mcdavid.cds <- new("CellDataSet", exprs=exp(.data$expr), phenoData=new("AnnotatedDataFrame", data=as.data.frame(.data$cell.meta)), featureData=new("AnnotatedDataFrame", data=as.data.frame(.data$gene.meta)))
mcdavid.cds <- reduceDimension(mcdavid.cds, use_irlba=F)
mcdavid.cds <- orderCells(mcdavid.cds, reverse=F) p <- plot_spanning_tree(mcdavid.cds, color_by="capture") print(p) pdf('McDavid-Monocle-order.pdf', width=fig.width, height=fig.height) print(p) dev.off() genes.to.plot <- c("MEF2D", "MCM5", "HJURP") p <- plot_genes_in_pseudotime(mcdavid.cds[genes.to.plot], color_by="capture") print(p) pdf('McDavid-Monocle-pseudotime.pdf', width=fig.width, height=fig.height) print(p) dev.off()
R version and packages used:
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.