annotate plotwithscale.R @ 0:800c7e974e3b draft

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