From 2c1017320e953b56f9fa5d0593f2146a88df2096 Mon Sep 17 00:00:00 2001 From: Holger Brandl <brandl@mpi-cbg.de> Date: Wed, 8 Apr 2015 16:41:53 +0200 Subject: [PATCH] added pathview species guesser --- R/bio/diffex_commons.R | 14 ++++++++++++++ R/ggplot_commons.R | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/R/bio/diffex_commons.R b/R/bio/diffex_commons.R index 4e5c230..b63d5af 100644 --- a/R/bio/diffex_commons.R +++ b/R/bio/diffex_commons.R @@ -32,6 +32,20 @@ guess_mart <- function(gene_id){ stop(paste("could not guess mart from ", an_id)) } } + +guess_pathview_species <- function(gene_id){ + an_id <-gene_id[1] + + if(str_detect(an_id, "ENSMUSG")){ + return("mmu") + }else if(str_detect(an_id, "ENSDARG")){ + return("dre") + }else if(str_detect(an_id, "ENSG")){ + return("hsa") + }else{ + stop(paste("could not guess mart from ", an_id)) + } +} #guess_mart("ENSCAFG00000000043") diff --git a/R/ggplot_commons.R b/R/ggplot_commons.R index a699dcd..1f8159f 100644 --- a/R/ggplot_commons.R +++ b/R/ggplot_commons.R @@ -149,7 +149,7 @@ makePcaPlot <- function(x = getData(), group = NA, items=rownames(x), title = "" ### Base-plot utils -plotPDF <- function(filename, expr){ pdf(paste0(filename, ".pdf")); expr; dev.off(); } +plotPDF <- function(fileBaseName, expr, ...){ pdf(paste0(fileBaseName, ".pdf"), ...); expr; dev.off(); } #plotPDF("test", plot(1:10)) -- GitLab