annotate extractCN.R @ 4:3fcbb8030fcc draft

"planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
author sblanck
date Mon, 12 Apr 2021 14:47:09 +0000
parents 4d539083cf7f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
1 #!/usr/bin/env Rscript
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
2 # setup R error handling to go to stderr
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
4
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
5 # we need that to not crash galaxy with an UTF8 error on German LC settings.
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
6 # loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
7
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
8 library("optparse")
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
9 library("zip")
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
10
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
11 ##### Read options
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
12 option_list=list(
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
13 make_option("--chrom",type="character",default=NULL, dest="chrom"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
14 make_option("--input",type="character",default=NULL, dest="input"),
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
15 make_option("--zip",type="character",default=NULL, dest="zip"),
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
16 make_option("--output",type="character",default=NULL, dest="output"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
17 make_option("--new_file_path",type="character",default=NULL, dest="new_file_path"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
18 make_option("--settings_type",type="character",default=NULL, dest="settings_type"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
19 make_option("--settings_tumor",type="character",default=NULL, dest="settings_tumor"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
20 make_option("--symmetrize",type="character",default=NULL, dest="symmetrize"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
21 make_option("--settings_signal",type="character",default=NULL, dest="settings_signal"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
22 make_option("--settings_snp",type="character",default=NULL, dest="settings_snp"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
23 make_option("--outputlog",type="character",default=NULL, dest="outputlog"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
24 make_option("--log",type="character",default=NULL, dest="log"),
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
25 make_option("--userid",type="character",default=NULL, dest="userid")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
26 );
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
27
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
28 opt_parser = OptionParser(option_list=option_list);
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
29 opt = parse_args(opt_parser);
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
30
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
31 if(is.null(opt$input)){
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
32 print_help(opt_parser)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
33 stop("input required.", call.=FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
34 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
35
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
36 #loading libraries
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
37
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
38 chrom=opt$chrom
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
39 input=opt$input
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
40 zip=opt$zip
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
41 tmp_dir=opt$new_file_path
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
42 output=opt$output
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
43 settingsType=opt$settings_type
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
44 tumorcsv=opt$settings_tumor
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
45 symmetrize=opt$symmetrize
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
46 signal=opt$settings_signal
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
47 snp=type.convert(opt$settings_snp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
48 outputlog=opt$outputlog
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
49 log=opt$log
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
50 user=opt$userid
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
51
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
52 library(MPAgenomics)
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
53 library(aroma.affymetrix)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
54 library(R.utils)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
55 #workdir=file.path(tmp_dir, "mpagenomics",user)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
56 tmp_dir
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
57 tmp_dir=file.path(tmp_dir)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
58 if (!dir.exists(tmp_dir))
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
59 dir.create(tmp_dir, showWarnings = TRUE, recursive = TRUE)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
60 setwd(tmp_dir)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
61 # tmpzip=file.copy(from = zip,to=paste0(workdir,"/tmp.zip"))
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
62 # tmpzip
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
63 unzip(zipfile = zip,exdir = ".")
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
64 # if (file.exists(tmpzip)) {
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
65 # #Delete file if it exists
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
66 # file.remove(fn)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
67 # }
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
68
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
69 workdir=file.path(tmp_dir,user)
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
70 setwd(workdir)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
71 inputDataset=read.table(file=input,stringsAsFactors=FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
72 dataset=inputDataset[1,2]
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
73
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
74 if (outputlog){
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
75 sinklog <- file(log, open = "wt")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
76 sink(sinklog ,type = "output")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
77 sink(sinklog, type = "message")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
78 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
79
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
80
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
81 if (grepl("all",tolower(chrom)) | chrom=="None") {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
82 chrom_vec=c(1:25)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
83 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
84 chrom_tmp <- strsplit(chrom,",")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
85 chrom_vecstring <-unlist(chrom_tmp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
86 chrom_vec <- as.numeric(chrom_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
87 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
88 if (signal == "CN")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
89 {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
90 if (settingsType == "dataset") {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
91 if (tumorcsv== "None")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
92 {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
93 CN=getCopyNumberSignal(dataset,chromosome=chrom_vec, onlySNP=snp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
94
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
95 } else {
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
96 CN=getCopyNumberSignal(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv, onlySNP=snp)
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
97 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
98 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
99 input_tmp <- strsplit(settingsType,",")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
100 input_tmp_vecstring <-unlist(input_tmp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
101 input_vecstring = sub("^([^.]*).*", "\\1", input_tmp_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
102 if (tumorcsv== "None")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
103 {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
104 CN=getCopyNumberSignal(dataset,chromosome=chrom_vec, listOfFiles=input_vecstring, onlySNP=snp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
105 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
106 CN=getCopyNumberSignal(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv, listOfFiles=input_vecstring, onlySNP=snp )
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
107 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
108 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
109
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
110 list_chr=names(CN)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
111 CN_global=data.frame(check.names = FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
112 for (i in list_chr) {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
113 chr_data=data.frame(CN[[i]],check.names = FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
114 CN_global=rbind(CN_global,chr_data)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
115 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
116 names(CN_global)[names(CN_global)=="featureNames"] <- "probeName"
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
117 write.table(format(CN_global), output, row.names = FALSE, quote = FALSE, sep = "\t")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
118
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
119 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
120 if (symmetrize=="TRUE") {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
121 if (settingsType == "dataset") {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
122 input_vecstring = getListOfFiles(dataset)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
123 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
124 input_tmp <- strsplit(settingsType,",")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
125 input_tmp_vecstring <-unlist(input_tmp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
126 input_vecstring = sub("^([^.]*).*", "\\1", input_tmp_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
127 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
128
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
129 symFracB_global=data.frame(check.names = FALSE)
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
130 tumorFile=read.csv(tumorcsv,header=TRUE)
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
131 tumor=tumorFile$tumor
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
132 input_vecstring=input_vecstring[which(input_vecstring %in% tumor)]
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
133 for (currentFile in input_vecstring) {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
134 cat(paste0("extracting signal from ",currentFile,".\n"))
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
135 currentSymFracB=data.frame()
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
136 symFracB=getSymFracBSignal(dataset,chromosome=chrom_vec,file=currentFile,normalTumorArray=tumorcsv)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
137 list_chr=names(symFracB)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
138 for (i in list_chr) {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
139 cat(paste0(" extracting ",i,".\n"))
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
140 chr_data=data.frame(symFracB[[i]]$tumor,check.names = FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
141 currentSymFracB=rbind(currentSymFracB,chr_data)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
142
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
143 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
144 if (is.null(symFracB_global) || nrow(symFracB_global)==0) {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
145 symFracB_global=currentSymFracB
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
146 } else {
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
147 #symFracB_global=cbind(symFracB_global,currentFile=currentSymFracB[[3]])
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
148
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
149 symFracB_global=merge(symFracB_global,currentSymFracB[,c(3,4)],by="featureNames")
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
150 symFracB_global=symFracB_global[c(2:ncol(symFracB_global),1)]
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
151 symFracB_global=symFracB_global[order(symFracB_global$chromosome, symFracB_global$position),]
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
152 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
153 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
154 names(symFracB_global)[names(symFracB_global)=="featureNames"] <- "probeName"
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
155
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
156 write.table(format(symFracB_global), output, row.names = FALSE, quote = FALSE, sep = "\t")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
157 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
158 if (settingsType == "dataset") {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
159 if (tumorcsv== "None")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
160 {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
161 fracB=getFracBSignal(dataset,chromosome=chrom_vec)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
162
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
163 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
164 fracB=getFracBSignal(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
165 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
166 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
167 input_tmp <- strsplit(settingsType,",")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
168 input_tmp_vecstring <-unlist(input_tmp)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
169 input_vecstring = sub("^([^.]*).*", "\\1", input_tmp_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
170 if (tumorcsv== "None")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
171 {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
172 fracB=getFracBSignal(dataset,chromosome=chrom_vec, listOfFiles=input_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
173 } else {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
174 fracB=getFracBSignal(dataset,chromosome=chrom_vec, normalTumorArray=tumorcsv, listOfFiles=input_vecstring)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
175 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
176 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
177 #formatage des données
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
178 list_chr=names(fracB)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
179 fracB_global=data.frame(check.names = FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
180 for (i in list_chr) {
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
181 chr_data=data.frame(fracB[[i]]$tumor,check.names = FALSE)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
182 fracB_global=rbind(fracB_global,chr_data)
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
183 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
184 names(fracB_global)[names(fracB_global)=="featureNames"] <- "probeName"
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
185 write.table(format(fracB_global), output, row.names = FALSE, quote = FALSE, sep = "\t")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
186 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
187
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
188 }
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
189
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
190 if (dir.exists(workdir))
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
191 system(paste0("rm -r ", workdir))
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
192
0
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
193 if (outputlog){
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
194 sink(type="output")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
195 sink(type="message")
4d539083cf7f planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233-dirty
sblanck
parents:
diff changeset
196 close(sinklog)
4
3fcbb8030fcc "planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
sblanck
parents: 0
diff changeset
197 }