Skip to content

Commit

Permalink
Merge pull request compbiomed#46 from dfjenkins3/master
Browse files Browse the repository at this point in the history
Added example data, bugfix for pData, and fix for travis integration
  • Loading branch information
dfjenkins3 authored Feb 14, 2017
2 parents 0a390c9 + 0e972a6 commit f8f2067
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ sudo: required
warnings_are_errors: true

bioc_required: true

before_install:
- Rscript -e 'update.packages(ask = FALSE)'
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Title: Interactive Analysis of Single Cell RNA-Seq Data
Version: 0.1.2
Author: David Jenkins
Maintainer: David Jenkins <dfj@bu.edu>
Depends:
R (>= 3.2)
Description: Run common single cell analysis directly through your browser
including differential expression, downsampling analysis, and clustering.
License: MIT + file LICENSE
Expand Down
21 changes: 21 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' Example Single Cell RNA-Seq data in SCESet Object
#'
#' A subset of 30 samples from a single cell RNA-Seq experiment from Zeisel, et
#' al. Science 2015. The data was produced from cells from the mouse
#' somatosensory cortex (S1) and hippocampus (CA1). 15 of the cells were
#' identified as oligodendrocytes and 15 of the cell were identified as
#' microglia.
#'
#' @name GSE60361_subset
#' @docType data
#' @format List of two data frames, with counts and annotations. Use them as
#' input to createSCESet()
#' @source DOI: 10.1126/science.aaa1934
#' @keywords datasets
#' @examples
#' library(scater)
#' data("GSE60361_subset")
#' GSE60361_SCESet <- createSCESet(countfile = GSE60361_subset$counts,
#' annotfile = GSE60361_subset$annot,
#' inputdataframes = TRUE)
"GSE60361_subset"
6 changes: 6 additions & 0 deletions R/misc_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ summarizeTable <- function(indata){
#'
#' @return a SCESet object
#' @export createSCESet
#' @examples
#' library(scater)
#' data("GSE60361_subset")
#' GSE60361_SCESet <- createSCESet(countfile = GSE60361_subset$counts,
#' annotfile = GSE60361_subset$annot,
#' inputdataframes = TRUE)
createSCESet <- function(countfile=NULL, annotfile=NULL, featurefile=NULL,
inputdataframes=FALSE){
if(is.null(countfile)){
Expand Down
10 changes: 5 additions & 5 deletions R/scDiffEx.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
scDiffEx <- function(inSCESet, condition, significance=0.05, ntop=500,
usesig=TRUE, diffexmethod, clusterRow=TRUE,
clusterCol=TRUE){
in.condition <- droplevels(as.factor(scater::pData(inSCESet)[,condition]))
in.condition <- droplevels(as.factor(Biobase::pData(inSCESet)[,condition]))
if (length(levels(in.condition)) != 2)
stop("only two labels supported, ", condition, " has ",
length(levels(in.condition)), " labels")
Expand Down Expand Up @@ -73,7 +73,7 @@ scDiffEx <- function(inSCESet, condition, significance=0.05, ntop=500,
#'
plot_DiffEx <- function(inSCESet, condition, geneList, clusterRow=TRUE,
clusterCol=TRUE){
diffex.annotation <- data.frame(scater::pData(inSCESet)[,condition])
diffex.annotation <- data.frame(Biobase::pData(inSCESet)[,condition])
colnames(diffex.annotation) <- condition
topha <- ComplexHeatmap::HeatmapAnnotation(df = diffex.annotation,
height = unit(0.333, "cm"))
Expand Down Expand Up @@ -101,7 +101,7 @@ plot_DiffEx <- function(inSCESet, condition, geneList, clusterRow=TRUE,
#'
plot_d3DiffEx <- function(inSCESet, condition, geneList, clusterRow=TRUE,
clusterCol=TRUE){
diffex.annotation <- data.frame(scater::pData(inSCESet)[,condition])
diffex.annotation <- data.frame(Biobase::pData(inSCESet)[,condition])
colnames(diffex.annotation) <- condition
topha <- ComplexHeatmap::HeatmapAnnotation(df = diffex.annotation,
height = unit(0.333, "cm"))
Expand All @@ -126,7 +126,7 @@ plot_d3DiffEx <- function(inSCESet, condition, geneList, clusterRow=TRUE,
#'
scDiffEx_deseq2 <- function(inSCESet, condition){
cnts <- scater::counts(inSCESet)
annot_data <- scater::pData(inSCESet)[,condition,drop=F]
annot_data <- Biobase::pData(inSCESet)[,condition,drop=F]
colnames(annot_data) <- "condition"
dds <- DESeq2::DESeqDataSetFromMatrix(countData = cnts,
colData = annot_data,
Expand Down Expand Up @@ -174,7 +174,7 @@ scDiffEx_deseq <- function(inSCESet, condition){
#' @export scDiffEx_limma
#'
scDiffEx_limma <- function(inSCESet, condition){
design <- stats::model.matrix(~factor(scater::pData(inSCESet)[,condition]))
design <- stats::model.matrix(~factor(Biobase::pData(inSCESet)[,condition]))
fit <- limma::lmFit(Biobase::exprs(inSCESet), design)
ebayes <- limma::eBayes(fit)
topGenes <- limma::topTable(ebayes, coef=2, adjust="fdr", number=nrow(inSCESet))
Expand Down
1 change: 1 addition & 0 deletions inst/shiny/ui.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(singleCellTK)
library(shiny)
library(shinyjs)
library(plotly)
Expand Down
30 changes: 30 additions & 0 deletions man/GSE60361_subset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions man/createSCESet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f8f2067

Please sign in to comment.