changeset 3:af0a098e15bd draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/data_manager_customProDB commit 141369f97aa2804d2bbfd9ed620ea2a5574994c2-dirty
author galaxyp
date Wed, 27 Jan 2016 16:46:54 -0500
parents 20a1b026b798
children b42974daa659
files data_manager/customProDB_annotation.R data_manager/customProDB_annotation.xml data_manager_conf.xml
diffstat 3 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/customProDB_annotation.R	Tue Jan 26 18:46:21 2016 -0500
+++ b/data_manager/customProDB_annotation.R	Wed Jan 27 16:46:54 2016 -0500
@@ -17,12 +17,14 @@
 option_list <- list()
 option_list$dbkey <- make_option('--dbkey', type='character')
 option_list$outputFile <- make_option('--outputFile', type='character')
+option_list$dbkey_description <- make_option('--dbkey_description', type='character')
 
 opt <- parse_args(OptionParser(option_list=option_list))
 
 
 customProDB_annotation <- function(
 	dbkey = GalaxyCharacterParam(required=TRUE), 
+	dbkey_description = GalaxyCharacterParam(required=FALSE), 
 	outputFile = GalaxyOutput("output","json"))
 {
     if (!file.exists(outputFile))
@@ -30,16 +32,19 @@
         gstop("json params file does not exist")
     }
 
+    if (length(dbkey_description) < 1)
+    {
+        dbkey_description = dbkey
+    }
+
     suppressPackageStartupMessages(library(rjson))
     params = fromJSON(file=outputFile)
     target_directory = params$output_data[[1]]$extra_files_path
-    data_description = params$param_dict$advanced$data_description
-    data_id = params$param_dict$advanced$data_id
     dir.create(target_directory)
 
     tryCatch(
     {
-        #file.remove(outputFile)
+        file.remove(outputFile)
     }, error=function(err)
     {
         gstop("failed to remove json params file after reading")
@@ -49,17 +54,22 @@
     ucscTableProteinFastaURL = paste("http://genome.ucsc.edu/cgi-bin/hgTables?db=", dbkey, "&hgta_geneSeqType=protein&hgta_doGenePredSequence=submit&hgta_track=refGene&hgta_table=refGene", sep="")
     codingFastaFilepath = paste(target_directory, "/", dbkey, ".cds.fa", sep="")
     proteinFastaFilepath = paste(target_directory, "/", dbkey, ".protein.fa", sep="")
+
     suppressPackageStartupMessages(library(customProDB))
     options(timeout=3600)
+
     cat(paste("Downloading coding FASTA from:", ucscTableCodingFastaURL, "\n"))
     download.file(ucscTableCodingFastaURL, codingFastaFilepath, quiet=T, mode='wb')
+
     cat(paste("Downloading protein FASTA from:", ucscTableProteinFastaURL, "\n"))
     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)
     
-    outputPath = paste("customProDB/", dbkey, sep="")
+    outputPath = paste(dbkey, "/customProDB", sep="")
     output = list(data_tables = list())
-    output[["data_tables"]][["customProDB"]]=c(path=outputPath, name=dbkey, value=dbkey, dbkey=dbkey)
+    output[["data_tables"]][["customProDB"]]=c(path=outputPath, name=dbkey_description, dbkey=dbkey)
     write(toJSON(output), file=outputFile)
 }
 
--- a/data_manager/customProDB_annotation.xml	Tue Jan 26 18:46:21 2016 -0500
+++ b/data_manager/customProDB_annotation.xml	Wed Jan 27 16:46:54 2016 -0500
@@ -3,6 +3,7 @@
     <command interpreter="Rscript --vanilla">customProDB_annotation.R
       --outputFile "${out_file}"
       --dbkey "${dbkey}"
+      --dbkey_description "${ dbkey.get_display_text() }"
       2&gt;&amp;1
     </command>
     <stdio>
@@ -10,11 +11,6 @@
         <exit_code range="1:" />
     </stdio>
     <inputs>
-        <!--<param name="all_fasta_source" type="select" label="Source FASTA Sequence">
-            <options from_data_table="all_fasta"/>
-        </param>
-        <param type="text" name="sequence_name" value="" label="Name of sequence" />
-        <param type="text" name="sequence_id" value="" label="ID for sequence" />-->
         <param type="genomebuild" name="dbkey" value="" label="UCSC dbKey for reference genome" />
     </inputs>
     <outputs>
--- a/data_manager_conf.xml	Tue Jan 26 18:46:21 2016 -0500
+++ b/data_manager_conf.xml	Wed Jan 27 16:46:54 2016 -0500
@@ -10,9 +10,9 @@
                 <column name="path" output_ref="out_file" >
                     <move type="directory" relativize_symlinks="True">
                         <!-- <source>${path}</source>--> <!-- out_file.extra_files_path is used as base by default --> <!-- if no source, eg for type=directory, then refers to base -->
-                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/customProDB/${value}</target>
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/customProDB</target>
                     </move>
-                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/customProDB/${value}/${path}</value_translation>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/customProDB</value_translation>
                     <value_translation type="function">abspath</value_translation>
                 </column>
             </output>