Mercurial > repos > iuc > iwtomics_plotwithscale
annotate plotwithscale.R @ 1:4bd560127b68 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/iwtomics commit 11ee7ac206d41894c0b6a11f2439aaea490824f0
author | iuc |
---|---|
date | Thu, 09 Nov 2017 13:58:42 -0500 |
parents | 25030f0d1154 |
children |
rev | line source |
---|---|
0
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
1 if (require("IWTomics",character.only = TRUE,quietly = FALSE)) { |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
2 args=commandArgs(TRUE) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
3 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
4 # get args names and values |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
5 args_values=strsplit(args,'=') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
6 args_names=unlist(lapply(args_values,function(arg) arg[1])) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
7 names(args_values)=args_names |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
8 args_values=lapply(args_values,function(arg) arg[2]) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
9 # read filenames |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
10 adjustedpvalue=args_values$adjustedpvalue |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
11 iwtomicsrespdf=args_values$iwtomicsrespdf |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
12 iwtomicssumpdf=args_values$iwtomicssumpdf |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
13 iwtomicsrdata=args_values$iwtomicsrdata |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
14 iwtomicstests=args_values$iwtomicstests |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
15 iwtomicsselectedfeatures=args_values$iwtomicsselectedfeatures |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
16 test_subset=paste0('c(',strsplit(args_values$test_subset,'\\|')[[1]],')') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
17 feature_subset=paste0('c(',strsplit(args_values$feature_subset,'\\|')[[1]],')') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
18 # read parameters (from test_subset on) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
19 i_scale_subset=which(args_names=='scale_subset') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
20 for(i in i_scale_subset:length(args)){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
21 eval(parse(text=args[[i]])) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
22 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
23 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
24 # load RData |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
25 load(iwtomicsrdata) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
26 # read testids and featureids and check them |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
27 unlisted=lapply(seq_along(test_subset), |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
28 function(i){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
29 test_subset_i=eval(parse(text=test_subset[i])) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
30 feature_subset_i=eval(parse(text=feature_subset[i])) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
31 test_subset_i=rep(test_subset_i,each=length(feature_subset_i)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
32 feature_subset_i=rep(feature_subset_i,length.out=length(test_subset_i)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
33 scale_subset_i=rep(scale_subset[i],length(test_subset_i)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
34 return(list(test_subset=test_subset_i,feature_subset=feature_subset_i,scale_subset=scale_subset_i)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
35 }) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
36 test_subset=unlist(lapply(unlisted,function(l) l$test_subset)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
37 feature_subset=unlist(lapply(unlisted,function(l) l$feature_subset)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
38 scale_subset=unlist(lapply(unlisted,function(l) l$scale_subset)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
39 testids=as.character(read.delim(iwtomicstests,header=FALSE,sep='\t',stringsAsFactors=FALSE)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
40 featureids=as.character(read.delim(iwtomicsselectedfeatures,header=FALSE,sep='\t',stringsAsFactors=FALSE)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
41 id_features_subset=featureids[feature_subset] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
42 if(sum(testids!=paste(testInput(regionsFeatures_test)$id_region1,'vs',testInput(regionsFeatures_test)$id_region2))){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
43 write("Wrong test ids.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
44 quit(save="no", status=10) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
45 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
46 if(sum(featureids!=idFeatures(regionsFeatures_test))){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
47 write("Wrong feature ids.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
48 quit(save="no", status=20) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
49 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
50 # retrieve test and features_subset ids |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
51 id_features_subset=featureids[feature_subset] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
52 if(sum(duplicated(paste0(test_subset,id_features_subset)))){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
53 write("Two scale thresholds selected for the same test and feature.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
54 quit(save="no", status=30) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
55 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
56 # If scale_subset=0, do not change the threshold |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
57 default=(scale_subset==0) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
58 scale_subset=scale_subset[!default] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
59 test_subset=test_subset[!default] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
60 id_features_subset=id_features_subset[!default] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
61 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
62 # get scale threshold |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
63 scale_threshold=lapply(regionsFeatures_test@test$result, |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
64 function(result) unlist(lapply(result,function(feature) feature$max_scale))) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
65 for(i in seq_along(test_subset)){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
66 if(scale_threshold[[test_subset[i]]][id_features_subset[i]]<scale_subset[i]){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
67 write("Scale threshold too high.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
68 quit(save="no", status=40) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
69 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
70 scale_threshold[[test_subset[i]]][id_features_subset[i]]=scale_subset[i] |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
71 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
72 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
73 # create adjustedvalue output |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
74 pval=adjusted_pval(regionsFeatures_test,scale_threshold=scale_threshold) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
75 for(test in seq_along(pval)){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
76 for(id_feature in idFeatures(regionsFeatures_test)){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
77 write(paste0('Test: ',testids[test],', on feature ',id_feature), |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
78 file=adjustedpvalue,append=TRUE,sep='\t') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
79 pval_i=as.data.frame(t(pval[[test]][[id_feature]])) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
80 row.names(pval_i)=paste('Scale',scale_threshold[[test]][[id_feature]]) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
81 write.table(pval_i,file=adjustedpvalue,append=TRUE,sep='\t',quote=FALSE,row.names=TRUE,col.names=FALSE) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
82 write('',file=adjustedpvalue,append=TRUE,sep='\t') |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
83 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
84 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
85 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
86 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
87 # plot test results |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
88 pdf(iwtomicsrespdf,width=5,height=7) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
89 if(plottype=='boxplot'){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
90 # fix repeated probs |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
91 probs=sort(unique(probs)) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
92 }else{ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
93 probs=c(0.25,0.5,0.75) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
94 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
95 plotTest(regionsFeatures_test,alpha=testalpha,type=plottype,probs=probs,average=average,size=size,scale_threshold=scale_threshold,ask=FALSE) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
96 dev.off() |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
97 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
98 # plot summary results |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
99 if(groupby!='none'){ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
100 tryCatch({ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
101 pdf(iwtomicssumpdf,width=15,height=10) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
102 plotSummary(regionsFeatures_test,alpha=summaryalpha,only_significant=only_significant,groupby=groupby,scale_threshold=scale_threshold,ask=FALSE,append=TRUE) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
103 dev.off() |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
104 }, error = function(err) { |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
105 if (grepl('selected features with different resolution',err$message)) { |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
106 write("Group by 'test' but selected features with different resolution.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
107 quit(save="no", status=50) #error: groupby 'test' but selected features with different resolution. |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
108 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
109 write("Summary plot error. Please try again.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
110 quit(save="no", status=60) #error |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
111 }) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
112 } |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
113 |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
114 }else{ |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
115 write("Missing IWTomics package. Please be sure to have it installed before using this tool.", stderr()) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
116 quit(save="no", status=255) |
25030f0d1154
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff
changeset
|
117 } |