#' [CuffDiff](http://cufflinks.cbcb.umd.edu/manual.html) and [cummeRbund](http://compbio.mit.edu/cummeRbund/) were used to perform this analysis. For details about how the test for differntial expression works, refer to [Differential analysis of gene regulation at transcript resolution with RNA-seq](http://www.nature.com/nbt/journal/v31/n1/full/nbt.2450.html).
#' For the volcano plot matrix we calculate fold-changes as x/y (aka column/row). For details see [here](http://rpackages.ianhowson.com/bioc/cummeRbund/man/csVolcano.html)
csVolcanoMatrix(genes(cuff))
#' We also plot more detailed scatter plots for just the contrasts for interest. Signifcance coloring is based on cuffdiff's internal score an not our hit criterion.
#' For most type of experiments we expect replicates to cluster together. Second similar biological conditions should cluster together. As clustering results depend on the method being used, we try a few here to check if we get consistent results.
## Map replicates into 2-dimensional space to highlight replicate clusters (or the lack of them)
#' Map replicates into 2-dimensional space to highlight replicate clusters (or the lack of them)
#' Here we are using [cuffdiff](http://cole-trapnell-lab.github.io/cufflinks/cuffdiff) to test for differential expression. Estimate variance-mean dependence in count data from high-throughput sequencing assays and test for differential expression based on a model using the negative binomial distribution.
allDiff<-diffData(genes(cuff))%>%
## just keep pairs of interest
merge(contrasts)%>%
## discard all genes that are not expressed in any of the cell types (>1)
ggplot(degs,aes(paste(sample_1,"vs",sample_2),fill=status))+geom_bar()+xlab(NULL)+ylab("# DGEs")+ggtitle("DEGs by contrast")+coord_flip()
ggplot(degs,aes(paste(sample_1,"vs",sample_2),fill=sample_1_overex))+geom_bar(position="dodge")+xlab(NULL)+ylab("# DGEs")+ggtitle("DEGs by direction")+coord_flip()
#' Hit Browser:
#+ results='as.is'
#' DEGs can be browsed in Excel using the exported table or via the embedded table browser. To enable the IGV links, you need to set the port in the IGV preferences to 3334.
#' For the volcano plot matrix we calculate fold-changes as x/y (aka column/row). For details see [here](http://rpackages.ianhowson.com/bioc/cummeRbund/man/csVolcano.html)