comparison 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
comparison
equal deleted inserted replaced
5:6db27bef602f 6:61e45c111ef7
15 15
16 16
17 option_list <- list() 17 option_list <- list()
18 18
19 option_list$bam <- make_option('--bam', type='character') 19 option_list$bam <- make_option('--bam', type='character')
20 option_list$bai <- make_option('--bai', type='character')
20 option_list$vcf <- make_option('--vcf', type='character') 21 option_list$vcf <- make_option('--vcf', type='character')
21 option_list$exon_anno <- make_option('--exon_anno', type='character') 22 option_list$exon_anno <- make_option('--exon_anno', type='character')
22 option_list$proteinseq <- make_option('--proteinseq', type='character') 23 option_list$proteinseq <- make_option('--proteinseq', type='character')
23 option_list$procodingseq <- make_option('--procodingseq', type='character') 24 option_list$procodingseq <- make_option('--procodingseq', type='character')
25 option_list$ids <- make_option('--ids', type='character')
24 option_list$outputFile <- make_option('--outputFile', type='character') 26 option_list$outputFile <- make_option('--outputFile', type='character')
25 27
26 28
27 opt <- parse_args(OptionParser(option_list=option_list)) 29 opt <- parse_args(OptionParser(option_list=option_list))
28 30
29 31
30 customProDB <- function( 32 customProDB <- function(
31 bam_file = GalaxyInputFile(required=TRUE), 33 bam_file = GalaxyInputFile(required=TRUE),
34 bai_file = GalaxyInputFile(required=TRUE),
32 vcf_file = GalaxyInputFile(required=TRUE), 35 vcf_file = GalaxyInputFile(required=TRUE),
33 exon_anno_file = GalaxyInputFile(required=TRUE), 36 exon_anno_file = GalaxyInputFile(required=TRUE),
34 proteinseq_file = GalaxyInputFile(required=TRUE), 37 proteinseq_file = GalaxyInputFile(required=TRUE),
35 procodingseq_file = GalaxyInputFile(required=TRUE), 38 procodingseq_file = GalaxyInputFile(required=TRUE),
39 ids_file = GalaxyInputFile(required=TRUE),
36 outputFile = GalaxyOutput("FASTA","fasta")) 40 outputFile = GalaxyOutput("FASTA","fasta"))
37 { 41 {
38 if (dirname(exon_anno_file) != dirname(proteinseq_file) || 42 file.symlink(exon_anno_file, paste(dirname(exon_anno_file), "exon_anno.RData", sep="/"))
39 dirname(exon_anno_file) != dirname(procodingseq_file)) 43 file.symlink(proteinseq_file, paste(dirname(exon_anno_file), "proseq.RData", sep="/"))
40 { 44 file.symlink(procodingseq_file, paste(dirname(exon_anno_file), "procodingseq.RData", sep="/"))
41 gstop("parent directory of annotation files must all be the same") 45 file.symlink(ids_file, paste(dirname(exon_anno_file), "ids.RData", sep="/"))
42 } 46
43 47 bamLink = paste(dirname(bam_file), "input.bam", sep="/")
44 if (file.exists(outputFile)) 48 file.symlink(bam_file, bamLink)
45 { 49 file.symlink(bai_file, paste(bamLink, ".bai", sep=""))
46 if (file.info(outputFile)$size > 0) { gstop("output file already exists") }
47 else
48 {
49 tryCatch(
50 {
51 file.remove(outputFile)
52 }, error=function(err)
53 {
54 gstop("failed to remove empty existing file")
55 })
56 }
57 }
58 50
59 suppressPackageStartupMessages(library(customProDB)) 51 suppressPackageStartupMessages(library(customProDB))
60 52
61 easyRun(bamFile=bamFile, vcfFile=vcfFile, annotation_path=dirname(exon_anno_file), outfile_path=dirname(outputFile), outfile_name=basename(outputFile)) 53 easyRun(bamFile=bamLink, vcfFile=vcf_file, annotation_path=dirname(exon_anno_file),
54 outfile_path=".", outfile_name="output",
55 nov_junction=F, INDEL=T, lablersid=F, COSMIC=F)
62 } 56 }
63 57
64 58
65 params <- list() 59 params <- list()
66 for(param in names(opt)) 60 for(param in names(opt))