diff customProDB.R @ 6:61e45c111ef7 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/customProDB commit 98f3323d4b92a4a3668788b3e1bad1a6529fd6df-dirty
author galaxyp
date Wed, 03 Feb 2016 12:37:47 -0500
parents 7e078d4e40f8
children b83a4002aab1
line wrap: on
line diff
--- a/customProDB.R	Fri Jan 29 16:03:10 2016 -0500
+++ b/customProDB.R	Wed Feb 03 12:37:47 2016 -0500
@@ -17,10 +17,12 @@
 option_list <- list()
 
 option_list$bam <- make_option('--bam', type='character')
+option_list$bai <- make_option('--bai', type='character')
 option_list$vcf <- make_option('--vcf', type='character')
 option_list$exon_anno <- make_option('--exon_anno', type='character')
 option_list$proteinseq <- make_option('--proteinseq', type='character')
 option_list$procodingseq <- make_option('--procodingseq', type='character')
+option_list$ids <- make_option('--ids', type='character')
 option_list$outputFile <- make_option('--outputFile', type='character')
 
 
@@ -29,36 +31,28 @@
 
 customProDB <- function(
 	bam_file = GalaxyInputFile(required=TRUE), 
+	bai_file = GalaxyInputFile(required=TRUE), 
 	vcf_file = GalaxyInputFile(required=TRUE), 
 	exon_anno_file = GalaxyInputFile(required=TRUE),
 	proteinseq_file = GalaxyInputFile(required=TRUE),
 	procodingseq_file = GalaxyInputFile(required=TRUE),
+	ids_file = GalaxyInputFile(required=TRUE),
 	outputFile = GalaxyOutput("FASTA","fasta"))
 {
-    if (dirname(exon_anno_file) != dirname(proteinseq_file) ||
-        dirname(exon_anno_file) != dirname(procodingseq_file))
-    {
-        gstop("parent directory of annotation files must all be the same")
-    }
-
-    if (file.exists(outputFile))
-    {
-        if (file.info(outputFile)$size > 0) { gstop("output file already exists") }
-        else
-        {
-            tryCatch(
-            {
-                file.remove(outputFile)
-            }, error=function(err)
-            {
-                gstop("failed to remove empty existing file")
-            })
-        }
-    }
+    file.symlink(exon_anno_file, paste(dirname(exon_anno_file), "exon_anno.RData", sep="/"))
+    file.symlink(proteinseq_file, paste(dirname(exon_anno_file), "proseq.RData", sep="/"))
+    file.symlink(procodingseq_file, paste(dirname(exon_anno_file), "procodingseq.RData", sep="/"))
+    file.symlink(ids_file, paste(dirname(exon_anno_file), "ids.RData", sep="/"))
+    
+    bamLink = paste(dirname(bam_file), "input.bam", sep="/")
+    file.symlink(bam_file, bamLink)
+    file.symlink(bai_file, paste(bamLink, ".bai", sep=""))
 
     suppressPackageStartupMessages(library(customProDB))
 
-    easyRun(bamFile=bamFile, vcfFile=vcfFile, annotation_path=dirname(exon_anno_file), outfile_path=dirname(outputFile), outfile_name=basename(outputFile))
+    easyRun(bamFile=bamLink, vcfFile=vcf_file, annotation_path=dirname(exon_anno_file),
+            outfile_path=".", outfile_name="output",
+            nov_junction=F, INDEL=T, lablersid=F, COSMIC=F)
 }