Mercurial > repos > galaxyp > psm_to_sam
comparison PSM2SAM.R @ 3:ce09f1a1bbad draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/psm_to_sam commit 141369f97aa2804d2bbfd9ed620ea2a5574994c2-dirty
author | galaxyp |
---|---|
date | Thu, 28 Jan 2016 18:40:54 -0500 |
parents | 34f9e847dd4e |
children | cd69250e1150 |
comparison
equal
deleted
inserted
replaced
2:e1bb35f6ca28 | 3:ce09f1a1bbad |
---|---|
30 | 30 |
31 | 31 |
32 | 32 |
33 PSMtab2SAM <- function( | 33 PSMtab2SAM <- function( |
34 passedPSM_file = GalaxyInputFile(required=TRUE), | 34 passedPSM_file = GalaxyInputFile(required=TRUE), |
35 exon_anno_file = GalaxyInputFile(), | 35 exon_anno_file = GalaxyInputFile(required=TRUE), |
36 proteinseq_file = GalaxyInputFile(), | 36 proteinseq_file = GalaxyInputFile(required=TRUE), |
37 procodingseq_file = GalaxyInputFile(), | 37 procodingseq_file = GalaxyInputFile(required=TRUE), |
38 header_file = GalaxyInputFile(), | 38 header_file = GalaxyInputFile(required=TRUE), |
39 XScolumn = GalaxyCharacterParam(required=TRUE), | 39 XScolumn = GalaxyCharacterParam(required=TRUE), |
40 OutputFile = GalaxyOutput("proSAM","sam")) | 40 OutputFile = GalaxyOutput("proSAM","sam")) |
41 { | 41 { |
42 if (length(exon_anno_file) == 0) { exon_anno_file = paste(script_parent_dir, "tool-data/exon_anno.RData", sep="/") } | |
43 if (length(proteinseq_file) == 0) { proteinseq_file = paste(script_parent_dir, "tool-data/proseq.RData", sep="/") } | |
44 if (length(procodingseq_file) == 0) { procodingseq_file = paste(script_parent_dir, "tool-data/procodingseq.RData", sep="/") } | |
45 if (length(header_file) == 0) { header_file = paste(script_parent_dir, "tool-data/header_refseq_hg19.txt", sep="/") } | |
46 | |
47 if (!file.exists(header_file)) { gstop("failed to read header file") } | 42 if (!file.exists(header_file)) { gstop("failed to read header file") } |
48 if (file.exists(OutputFile)) | 43 if (file.exists(OutputFile)) |
49 { | 44 { |
50 if (file.info(OutputFile)$size > 0) { gstop("output file already exists") } | 45 if (file.info(OutputFile)$size > 0) { gstop("output file already exists") } |
51 else | 46 else |
53 tryCatch( | 48 tryCatch( |
54 { | 49 { |
55 file.remove(OutputFile) | 50 file.remove(OutputFile) |
56 }, error=function(err) | 51 }, error=function(err) |
57 { | 52 { |
58 gstop("failed to read empty existing file") | 53 gstop("failed to remove empty existing file") |
59 }) | 54 }) |
60 } | 55 } |
61 } | 56 } |
62 | 57 |
63 suppressPackageStartupMessages(library(GenomicRanges)) | 58 suppressPackageStartupMessages(library(GenomicRanges)) |