diff data_manager/customProDB_annotation.R @ 5:a0ca66b32792 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/data_manager_customProDB commit 98f3323d4b92a4a3668788b3e1bad1a6529fd6df-dirty
author galaxyp
date Tue, 24 May 2016 11:47:26 -0400
parents b42974daa659
children c922df2f9c2a
line wrap: on
line diff
--- a/data_manager/customProDB_annotation.R	Thu Jan 28 18:46:50 2016 -0500
+++ b/data_manager/customProDB_annotation.R	Tue May 24 11:47:26 2016 -0400
@@ -16,6 +16,8 @@
 
 option_list <- list()
 option_list$dbkey <- make_option('--dbkey', type='character')
+option_list$dbsnp <- make_option('--dbsnp', type='character')
+option_list$cosmic <- make_option('--cosmic', type='logical')
 option_list$outputFile <- make_option('--outputFile', type='character')
 option_list$dbkey_description <- make_option('--dbkey_description', type='character')
 
@@ -24,6 +26,8 @@
 
 customProDB_annotation <- function(
 	dbkey = GalaxyCharacterParam(required=TRUE), 
+	dbsnp_str = GalaxyCharacterParam(required=FALSE), 
+	cosmic = GalaxyLogicalParam(required=FALSE), 
 	dbkey_description = GalaxyCharacterParam(required=FALSE), 
 	outputFile = GalaxyOutput("output","json"))
 {
@@ -37,6 +41,24 @@
         dbkey_description = dbkey
     }
 
+    if (length(dbsnp_str) > 0)
+    {
+        dbsnp = dbsnp_str
+    }
+    else
+    {
+        dbsnp = NULL
+    }
+    
+    if (cosmic && grepl("^hg", dbkey))
+    {
+        use_cosmic = TRUE
+    }
+    else
+    {
+        use_cosmic = NULL
+    }
+
     suppressPackageStartupMessages(library(rjson))
     params = fromJSON(file=outputFile)
     target_directory = params$output_data[[1]]$extra_files_path
@@ -65,7 +87,7 @@
     download.file(ucscTableProteinFastaURL, proteinFastaFilepath, quiet=T, mode='wb')
 
     cat(paste("Preparing Refseq annotation files\n"))
-    customProDB::PrepareAnnotationRefseq(genome=dbkey, CDSfasta=codingFastaFilepath, pepfasta=proteinFastaFilepath, annotation_path=target_directory)
+    customProDB::PrepareAnnotationRefseq(genome=dbkey, CDSfasta=codingFastaFilepath, pepfasta=proteinFastaFilepath, annotation_path=target_directory, dbsnp=dbsnp, cosmic=use_cosmic)
     
     outputPath = paste(dbkey, "/customProDB", sep="")
     output = list(data_tables = list())