diff --git a/dge_workflow/dge_analysis.R b/dge_workflow/dge_analysis.R index 87e6cb3371102d5b16165f3a3bbd30e0d1184a02..f27e9a3d251225320c6cdf7e7c877df3f9acbfe0 100755 --- a/dge_workflow/dge_analysis.R +++ b/dge_workflow/dge_analysis.R @@ -42,7 +42,7 @@ devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R") require(cummeRbund) -devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/bio/cummerutils.R") +devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/bio/diffex_commons.R") #knitr::opts_knit$set(root.dir = getwd()) @@ -286,62 +286,12 @@ save(degs, file=".degs.RData") #' ## Term enrichment #+ echo=FALSE -#fpkmMatrix(genes(cuff)) %>% head() - -ontologies <- c( - "GOTERM_CC_FAT", - "GOTERM_MF_FAT", - "GOTERM_BP_FAT", - - "PANTHER_PATHWAY", - "REACTOME_PATHWAY", - "KEGG_PATHWAY", - - "GOTERM_CC_FAT", - "GOTERM_MF_FAT", - "GOTERM_BP_FAT" -) - #' This analysis was performed using [David](http://david.abcc.ncifcrf.gov/). The following ontologies were tested: `r paste(ontologies, collapse=', ')` -require(RDAVIDWebService) ## just works if installed on non-network-drive (e.g. /tmp/) - geneLists <- degs %>% # transmute(ensembl_gene_id, list_id=paste(sample_1, "vs", sample_2, "ovex", sample_1_overex, sep="_")) transmute(ensembl_gene_id, list_id=paste(sample_1, "vs", sample_2)) - -## http://www.bioconductor.org/packages/release/bioc/vignettes/RDAVIDWebService/inst/doc/RDavidWS-vignette.pdf -## e.g. getClusterReport --> plot2D - - -davidAnnotationChart <- function(someGenes){ ## expexted to have a column with gene_id -# echo("processing list with", length(someGenes), "genes") -# someGenes <- degs$ensembl_gene_id - - - if(length(someGenes)>1500){ - someGenes <- sample(someGenes) %>% head(1500) - } - - david<-DAVIDWebService$new(email="brandl@mpi-cbg.de") - -# getTimeOut(david) - setTimeOut(david, 80000) ## http://www.bioconductor.org/packages/release/bioc/vignettes/RDAVIDWebService/inst/doc/RDavidWS-vignette.pdf - - result<-addList(david, someGenes, idType="ENSEMBL_GENE_ID", listName=paste0("list_", sample(10000)[1]), listType="Gene") - - david %>% setAnnotationCategories(ontologies) - - annoChart <-getFunctionalAnnotationChart(david) - -# clusterReport <-getClusterReport(david) - - return(annoChart %>% subset(select=-Genes)) -} - - - grpdDegs <- if(split_hit_list){ degs %>% group_by(sample_1, sample_2, sample_1_overex) }else{ @@ -350,6 +300,7 @@ grpdDegs <- if(split_hit_list){ enrResults <- grpdDegs %>% do(davidAnnotationChart(.$ensembl_gene_id)) + write.delim(enrResults, file="enrResults.txt") # enrResults <- read.delim("enrResults.txt") #' [Enrichment Results](enrResults.txt) diff --git a/dge_workflow/dge_utils.sh b/dge_workflow/dge_utils.sh index 833cf9a0e20df02038f30abf2017f4472f445524..2f4c267fa9fff7ac9a358c10b1bdb3e0be31e1d1 100755 --- a/dge_workflow/dge_utils.sh +++ b/dge_workflow/dge_utils.sh @@ -287,7 +287,7 @@ cp -r . $tmpDbDir genome=$(echo $gtfFile | cut -f7 -d'/'); echo "genome is $genome" ## make sure to use temp-r to avoid file locking problems -R_LIBS=/tmp/r_index +export R_LIBS=/tmp/r_index echo ' require(cummeRbund) diff --git a/misc/spin.R b/misc/spin.R index 27940c4999a746ace6827fde9e1e882d32ddeff7..b4fb6dca9786e3c5acc94906db04e1c1f366d5a8 100755 --- a/misc/spin.R +++ b/misc/spin.R @@ -70,8 +70,19 @@ cssHeader=' max-width: 90%; } </style> + + +<!-- add jquery datatable support --> +<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.4/css/jquery.dataTables.css"> +<script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-2.1.2.min.js"></script> +<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script> ' +#<!-- add bootstrap support --> +#<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"> +#<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> + + ## custom title http://stackoverflow.com/questions/14124022/setting-html-meta-elements-with-knitr opts_chunk$set( cache = spin_opts$c, diff --git a/misc/spin_utils.sh b/misc/spin_utils.sh new file mode 100755 index 0000000000000000000000000000000000000000..c740d87fe1b9a5e4f03c182cdb17340c2e0090e2 --- /dev/null +++ b/misc/spin_utils.sh @@ -0,0 +1,20 @@ + +spinsnip(){ + if [ $# -ne 1 ]; then + >&2 echo "Usage: spinsnip <report name> [other args]*" + return + fi + + reportName=$1 + tmpR=$(echo $reportName | tr " " "_").R + + ## http://stackoverflow.com/questions/11454343/pipe-output-to-bash-function + cat | sed 's/#>/#'"'"'/g' > $tmpR + + echo "spining $tmpR..." + + shift + spin.R $tmpR $* + + rm $tmpR +}