annotate plotwithscale.R @ 3:ce633cc8f5f9 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/iwtomics commit 69ca0c7a7e444f54b56d111e16432f5d8dddb96d
author iuc
date Wed, 21 Feb 2018 14:16:45 -0500
parents 0027f3287b34
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0027f3287b34 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)) {
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
2 args=commandArgs(TRUE)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
3
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
4 # get args names and values
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
5 args_values=strsplit(args,'=')
0027f3287b34 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]))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
7 names(args_values)=args_names
0027f3287b34 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])
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
9 # read filenames
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
10 adjustedpvalue=args_values$adjustedpvalue
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
11 iwtomicsrespdf=args_values$iwtomicsrespdf
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
12 iwtomicssumpdf=args_values$iwtomicssumpdf
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
13 iwtomicsrdata=args_values$iwtomicsrdata
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
14 iwtomicstests=args_values$iwtomicstests
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
15 iwtomicsselectedfeatures=args_values$iwtomicsselectedfeatures
0027f3287b34 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]],')')
0027f3287b34 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]],')')
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
18 # read parameters (from test_subset on)
0027f3287b34 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')
0027f3287b34 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)){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
21 eval(parse(text=args[[i]]))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
22 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
23
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
24 # load RData
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
25 load(iwtomicsrdata)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
26 # read testids and featureids and check them
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
27 unlisted=lapply(seq_along(test_subset),
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
28 function(i){
0027f3287b34 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]))
0027f3287b34 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]))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
35 })
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 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))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
41 id_features_subset=featureids[feature_subset]
0027f3287b34 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))){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
43 write("Wrong test ids.", stderr())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
44 quit(save="no", status=10)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
45 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
46 if(sum(featureids!=idFeatures(regionsFeatures_test))){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
47 write("Wrong feature ids.", stderr())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
48 quit(save="no", status=20)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
49 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
50 # retrieve test and features_subset ids
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
51 id_features_subset=featureids[feature_subset]
0027f3287b34 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)))){
0027f3287b34 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())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
54 quit(save="no", status=30)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
55 }
0027f3287b34 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
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
57 default=(scale_subset==0)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
58 scale_subset=scale_subset[!default]
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
59 test_subset=test_subset[!default]
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
60 id_features_subset=id_features_subset[!default]
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
61
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
62 # get scale threshold
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
63 scale_threshold=lapply(regionsFeatures_test@test$result,
0027f3287b34 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)))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
65 for(i in seq_along(test_subset)){
0027f3287b34 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]){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
67 write("Scale threshold too high.", stderr())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
68 quit(save="no", status=40)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
69 }
0027f3287b34 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]
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
71 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
72
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
73 # create adjustedvalue output
0027f3287b34 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)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
75 for(test in seq_along(pval)){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
76 for(id_feature in idFeatures(regionsFeatures_test)){
0027f3287b34 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),
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
78 file=adjustedpvalue,append=TRUE,sep='\t')
0027f3287b34 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]]))
0027f3287b34 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]])
0027f3287b34 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)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
82 write('',file=adjustedpvalue,append=TRUE,sep='\t')
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
83 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
84 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
85
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
86
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
87 # plot test results
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
88 pdf(iwtomicsrespdf,width=5,height=7)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
89 if(plottype=='boxplot'){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
90 # fix repeated probs
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
91 probs=sort(unique(probs))
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
92 }else{
0027f3287b34 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)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
94 }
0027f3287b34 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)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
96 dev.off()
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
97
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
98 # plot summary results
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
99 if(groupby!='none'){
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
100 tryCatch({
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
101 pdf(iwtomicssumpdf,width=15,height=10)
0027f3287b34 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)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
103 dev.off()
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
104 }, error = function(err) {
0027f3287b34 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)) {
0027f3287b34 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())
0027f3287b34 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.
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
108 }
0027f3287b34 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())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
110 quit(save="no", status=60) #error
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
111 })
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
112 }
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
113
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
114 }else{
0027f3287b34 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())
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
116 quit(save="no", status=255)
0027f3287b34 planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
iuc
parents:
diff changeset
117 }