Mercurial > repos > sblanck > mpagenomics_wrappers
annotate segcall.R @ 8:d5ed62b4d3ac draft default tip
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233
author | sblanck |
---|---|
date | Tue, 12 May 2020 13:40:07 +0000 |
parents | af4f63f27c77 |
children |
rev | line source |
---|---|
5
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
2 # setup R error handling to go to stderr |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
4 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
5 # we need that to not crash galaxy with an UTF8 error on German LC settings. |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
6 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
7 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
8 library("optparse") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
9 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
10 ##### Read options |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
11 option_list=list( |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
12 make_option("--chrom",type="character",default=NULL, dest="chrom"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
13 make_option("--input",type="character",default=NULL, dest="input"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
14 make_option("--output",type="character",default=NULL, dest="output"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
15 make_option("--new_file_path",type="character",default=NULL, dest="new_file_path"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
16 make_option("--nbcall",type="character",default=NULL, dest="nbcall"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
17 make_option("--settingsType",type="character",default=NULL, dest="settingsType"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
18 make_option("--outputgraph",type="character",default=NULL, dest="outputgraph"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
19 make_option("--snp",type="character",default=NULL, dest="snp"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
20 make_option("--zipfigures",type="character",default=NULL, dest="zipfigures"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
21 make_option("--settingsTypeTumor",type="character",default=NULL, dest="settingsTypeTumor"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
22 make_option("--cellularity",type="character",default=NULL, dest="cellularity"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
23 make_option("--outputlog",type="character",default=NULL, dest="outputlog"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
24 make_option("--log",type="character",default=NULL, dest="log"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
25 make_option("--userid",type="character",default=NULL, dest="userid"), |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
26 make_option("--method",type="character",default=NULL, dest="method") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
27 ); |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
28 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
29 opt_parser = OptionParser(option_list=option_list); |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
30 opt = parse_args(opt_parser); |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
31 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
32 if(is.null(opt$input)){ |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
33 print_help(opt_parser) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
34 stop("input required.", call.=FALSE) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
35 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
36 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
37 #loading libraries |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
38 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
39 chrom=opt$chrom |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
40 datasetFile=opt$input |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
41 output=opt$output |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
42 tmp_dir=opt$new_file_path |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
43 nbcall=as.numeric(opt$nbcall) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
44 settingsType=opt$settingsType |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
45 outputfigures=type.convert(opt$outputgraph) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
46 snp=type.convert(opt$snp) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
47 tumorcsv=opt$settingsTypeTumor |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
48 cellularity=as.numeric(opt$cellularity) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
49 user=opt$userid |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
50 method=opt$method |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
51 log=opt$log |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
52 outputlog=opt$outputlog |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
53 outputgraph=opt$outputgraph |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
54 zipfigures=opt$zipfigures |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
55 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
56 library(MPAgenomics) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
57 workdir=file.path(tmp_dir, "mpagenomics",user) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
58 setwd(workdir) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
59 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
60 if (grepl("all",tolower(chrom)) | chrom=="None") { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
61 chrom_vec=c(1:25) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
62 } else { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
63 chrom_tmp <- strsplit(chrom,",") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
64 chrom_vecstring <-unlist(chrom_tmp) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
65 chrom_vec <- as.numeric(chrom_vecstring) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
66 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
67 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
68 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
69 if (outputlog){ |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
70 sinklog <- file(log, open = "wt") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
71 sink(sinklog ,type = "output") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
72 sink(sinklog, type = "message") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
73 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
74 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
75 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
76 inputDataset=read.table(file=datasetFile,stringsAsFactors=FALSE) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
77 dataset=inputDataset[1,2] |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
78 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
79 fig_dir = file.path("mpagenomics", user, "figures", dataset, "segmentation","CN") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
80 abs_fig_dir = file.path(tmp_dir, fig_dir) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
81 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
82 if (outputgraph) { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
83 if (dir.exists(abs_fig_dir)) { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
84 system(paste0("rm -r ", abs_fig_dir)) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
85 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
86 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
87 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
88 if (settingsType == 'dataset') { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
89 if (tumorcsv== "none") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
90 { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
91 segcall=cnSegCallingProcess(dataset,chromosome=chrom_vec, nclass=nbcall, savePlot=outputfigures,onlySNP=snp, cellularity=cellularity, method=method) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
92 } else { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
93 segcall=cnSegCallingProcess(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv, nclass=nbcall, savePlot=outputfigures,onlySNP=snp, cellularity=cellularity, method=method) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
94 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
95 } else { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
96 input_tmp <- strsplit(settingsType,",") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
97 input_tmp_vecstring <-unlist(input_tmp) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
98 input_vecstring = sub("^([^.]*).*", "\\1", input_tmp_vecstring) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
99 if (tumorcsv== "none") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
100 { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
101 segcall=cnSegCallingProcess(dataset,chromosome=chrom_vec, listOfFiles=input_vecstring, nclass=nbcall, savePlot=outputfigures, onlySNP=snp, cellularity=cellularity, method=method) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
102 } else { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
103 segcall=cnSegCallingProcess(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv, listOfFiles=input_vecstring, nclass=nbcall, savePlot=outputfigures, onlySNP=snp, cellularity=cellularity, method=method) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
104 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
105 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
106 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
107 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
108 write.table(format(segcall),output,row.names = FALSE, quote=FALSE, sep = "\t") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
109 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
110 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
111 if (outputgraph) { |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
112 setwd(abs_fig_dir) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
113 files2zip <- dir(abs_fig_dir) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
114 zip(zipfile = "figures.zip", files = files2zip) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
115 file.rename("figures.zip",zipfigures) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
116 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
117 |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
118 if (outputlog){ |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
119 sink(type="output") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
120 sink(type="message") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
121 close(sinklog) |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
122 } |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
123 #write.fwf(segcall,output,rownames = FALSE, quote=FALSE, sep = "\t") |
af4f63f27c77
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff
changeset
|
124 |