Mercurial > repos > genouest > askor_de
annotate AskoR.R @ 2:877d2be25a6a draft default tip
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
author | genouest |
---|---|
date | Thu, 19 Apr 2018 03:44:31 -0400 |
parents | ceef9bc6bbc7 |
children |
rev | line source |
---|---|
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
1 asko3c <- function(data_list){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
2 asko<-list() |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
3 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
4 ######### Condition ############ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
5 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
6 condition<-unique(data_list$samples$condition) # retrieval of different condition's names |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
7 col1<-which(colnames(data_list$samples)=="condition") # determination of number of the column "condition" |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
8 colcol<-which(colnames(data_list$samples)=="color") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
9 if(is.null(parameters$fileofcount)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
10 col2<-which(colnames(data_list$samples)=="file") # determination of number of the column "replicate" |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
11 column_name<-colnames(data_list$samples[,c(-col1,-col2,-colcol)]) # retrieval of column names needful to create the file condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
12 }else{column_name<-colnames(data_list$samples[,c(-col1,-colcol)])} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
13 condition_asko<-data.frame(row.names=condition) # initialization of the condition's data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
14 #level<-list() # initialization of the list will contain the level |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
15 # of each experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
16 for (name in column_name){ # for each experimental factor : |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
17 # if(str_detect(name, "condition")){ # for the column of conditions, the level is fixed to 0 because |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
18 # level<-append(level, 0) # "condition" must be the first column of the data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
19 # }else{ # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
20 # level<-append(level, length(levels(data_list$samples[,name]))) # adding to the list the level of other experimental factors |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
21 # } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
22 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
23 condition_asko$n<-NA # initialization of new column in the condition's data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
24 colnames(condition_asko)[colnames(condition_asko)=="n"]<-name # to rename the new column with with the name of experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
25 for(condition_name in condition){ # for each condition's names |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
26 condition_asko[condition_name,name]<-as.character(unique(data_list$samples[data_list$samples$condition==condition_name, name])) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
27 } # filling the condition's data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
28 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
29 # order_level<-order(unlist(level)) # list to vector |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
30 # condition_asko<-condition_asko[,order_level] # order columns according to their level |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
31 #asko$condition<-condition_asko # adding data frame of conditions to asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
32 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
33 #print(condition_asko) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
34 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
35 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
36 #############contrast + context################## |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
37 i=0 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
38 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
39 contrast_asko<-data.frame(row.names = colnames(data_list$contrast)) # initialization of the contrast's data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
40 contrast_asko$Contrast<-NA # all columns are created et initialized with |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
41 contrast_asko$context1<-NA # NA values |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
42 contrast_asko$context2<-NA # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
43 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
44 list_context<-list() # initialization of context and condition lists |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
45 list_condition<-list() # will be used to create the context data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
46 if(parameters$mk_context==TRUE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
47 for (contrast in colnames(data_list$contrast)){ # for each contrast : |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
48 i=i+1 # contrast data frame will be filled line by line |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
49 #print(contrast) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
50 set_cond1<-row.names(data_list$contrast)[data_list$contrast[,contrast]>0] # retrieval of 1st set of condition's names implicated in a given contrast |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
51 set_cond2<-row.names(data_list$contrast)[data_list$contrast[,contrast]<0] # retrieval of 2nd set of condition's names implicated in a given contrast |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
52 parameters<-colnames(condition_asko) # retrieval of names of experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
53 print(paste("set_cond1 : ", set_cond1, sep = "")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
54 # print(length(set_cond1)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
55 print(paste("set_cond2 : ", set_cond2, sep = "")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
56 # print(length(set_cond2)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
57 if(length(set_cond1)==1){complex1=F}else{complex1=T}# to determine if we have complex contrast (multiple conditions |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
58 if(length(set_cond2)==1){complex2=F}else{complex2=T}# compared to multiple conditions) or not |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
59 #print(complex1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
60 if(complex1==F && complex2==F){ # Case 1: one condition against one condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
61 contrast_asko[i,"context1"]<-set_cond1 # filling contrast data frame with the name of the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
62 contrast_asko[i,"context2"]<-set_cond2 # filling contrast data frame with the name of the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
63 contrast_name<-paste(set_cond1,set_cond2, sep = "vs") # creation of contrast name by associating the names of contexts |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
64 contrast_asko[i,"Contrast"]<-contrast_name # filling contrast data frame with contrast name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
65 list_context<-append(list_context, set_cond1) # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
66 list_condition<-append(list_condition, set_cond1) # adding respectively to the lists "context" and "condition" the context name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
67 list_context<-append(list_context, set_cond2) # and the condition name associated |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
68 list_condition<-append(list_condition, set_cond2) # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
69 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
70 if(complex1==F && complex2==T){ # Case 2: one condition against multiple condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
71 contrast_asko[i,"context1"]<-set_cond1 # filling contrast data frame with the name of the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
72 list_context<-append(list_context, set_cond1) # adding respectively to the lists "context" and "condition" the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
73 list_condition<-append(list_condition, set_cond1) # name and the condition name associated |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
74 l=0 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
75 # "common_factor" will contain the common experimental factors shared by |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
76 common_factor=list() # conditions belonging to the complex context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
77 for (param_names in parameters){ # for each experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
78 facteur<-unique(c(condition_asko[,param_names])) # retrieval of possible values for the experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
79 l=l+1 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
80 for(value in facteur){ # for each possible values |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
81 verif<-unique(str_detect(set_cond2, value)) # verification of the presence of values in each condition contained in the set |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
82 if(length(verif)==1 && verif==TRUE){common_factor[l]<-value} # if verif contains only TRUE, value of experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
83 } # is added as common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
84 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
85 if(length(common_factor)>1){ # if there are several common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
86 common_factor<-toString(common_factor) # the list is converted to string |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
87 contx<-str_replace(common_factor,", ","") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
88 contx<-str_replace_all(contx, "NULL", "")}else{contx<-common_factor} # and all common factor are concatenated to become the name of context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
89 contrast_asko[i,"context2"]<-contx # filling contrast data frame with the name of the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
90 contrast_name<-paste(set_cond1,contx, sep = "vs") # concatenation of context names to make the contrast name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
91 contrast_asko[i,"Contrast"]<-contrast_name # filling contrast data frame with the contrast name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
92 for(j in 1:length(set_cond2)){ # for each condition contained in the complex context (2nd): |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
93 list_context<-append(list_context, contx) # adding condition name with the context name associated |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
94 list_condition<-append(list_condition, set_cond2[j]) # to their respective list |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
95 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
96 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
97 if(complex1==T && complex2==F){ # Case 3: multiple conditions against one condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
98 contrast_asko[i,"context2"]<-set_cond2 # filling contrast data frame with the name of the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
99 list_context<-append(list_context, set_cond2) # adding respectively to the lists "context" and "condition" the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
100 list_condition<-append(list_condition, set_cond2) # name and the 2nd condition name associated |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
101 l=0 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
102 # "common_factor" will contain the common experimental factors shared by |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
103 common_factor=list() # conditions belonging to the complex context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
104 for (param_names in parameters){ # for each experimental factor: |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
105 facteur<-unique(c(condition_asko[,param_names])) # retrieval of possible values for the experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
106 l=l+1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
107 for(value in facteur){ # for each possible values: |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
108 verif<-unique(str_detect(set_cond1, value)) # verification of the presence of values in each condition contained in the set |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
109 if(length(verif)==1 && verif==TRUE){common_factor[l]<-value} # if verif contains only TRUE, value of experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
110 } # is added as common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
111 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
112 if(length(common_factor)>1){ # if there are several common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
113 common_factor<-toString(common_factor) # the list is converted to string |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
114 contx<-str_replace(common_factor,", ","") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
115 contx<-str_replace_all(contx, "NULL", "")}else{contx<-common_factor} # and all common factor are concatenated to become the name of context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
116 contrast_asko[i,"context1"]<-contx # filling contrast data frame with the name of the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
117 contrast_name<-paste(contx,set_cond2, sep = "vs") # concatenation of context names to make the contrast name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
118 contrast_asko[i,"Contrast"]<-contrast_name # filling contrast data frame with the contrast name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
119 for(j in 1:length(set_cond1)){ # for each condition contained in the complex context (1st): |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
120 list_context<-append(list_context, contx) # adding condition name with the context name associated |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
121 list_condition<-append(list_condition, set_cond1[j]) # to their respective list |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
122 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
123 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
124 if(complex1==T && complex2==T){ # Case 4: multiple conditions against multiple conditions |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
125 m=0 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
126 n=0 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
127 common_factor1=list() # list of common experimental factors shared by conditions of the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
128 common_factor2=list() # list of common experimental factors shared by conditions of the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
129 w=1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
130 for (param_names in parameters){ # for each experimental factor: |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
131 print(w) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
132 w=w+1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
133 facteur<-unique(c(condition_asko[,param_names])) # retrieval of possible values for the experimental factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
134 print(paste("facteur : ", facteur, sep="")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
135 for(value in facteur){ # for each possible values: |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
136 print(value) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
137 #print(class(value)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
138 #print(set_cond1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
139 verif1<-unique(str_detect(set_cond1, value)) # verification of the presence of values in each condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
140 # contained in the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
141 verif2<-unique(str_detect(set_cond2, value)) # verification of the presence of values in each condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
142 # contained in the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
143 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
144 if(length(verif1)==1 && verif1==TRUE){m=m+1;common_factor1[m]<-value} # if verif=only TRUE, value of experimental factor is added as common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
145 if(length(verif2)==1 && verif2==TRUE){n=n+1;common_factor2[n]<-value} # if verif=only TRUE, value of experimental factor is added as common factor |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
146 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
147 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
148 print(paste("common_factor1 : ",common_factor1,sep="")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
149 print(paste("common_factor2 : ",common_factor2,sep="")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
150 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
151 if(length(common_factor1)>1){ # if there are several common factor for conditions in the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
152 common_factor1<-toString(common_factor1) # conversion list to string |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
153 contx1<-str_replace(common_factor1,", ","")}else{contx1<-common_factor1}# all common factor are concatenated to become the name of context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
154 contx1<-str_replace_all(contx1, "NULL", "") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
155 print(paste("contx1 : ", contx1, sep="")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
156 if(length(common_factor2)>1){ # if there are several common factor for conditions in the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
157 common_factor2<-toString(common_factor2) # conversion list to string |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
158 contx2<-str_replace(common_factor2,", ","")}else{contx2<-common_factor2}# all common factor are concatenated to become the name of context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
159 contx2<-str_replace_all(contx2, "NULL", "") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
160 print(paste("contx2 : ", contx2, sep="")) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
161 contrast_asko[i,"context1"]<-contx1 # filling contrast data frame with the name of the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
162 contrast_asko[i,"context2"]<-contx2 # filling contrast data frame with the name of the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
163 contrast_asko[i,"Contrast"]<-paste(contx1,contx2, sep = "vs") # filling contrast data frame with the name of the contrast |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
164 for(j in 1:length(set_cond1)){ # for each condition contained in the complex context (1st): |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
165 list_context<-append(list_context, contx1) # verification of the presence of values in each condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
166 list_condition<-append(list_condition, set_cond1[j]) # contained in the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
167 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
168 for(j in 1:length(set_cond2)){ # for each condition contained in the complex context (2nd): |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
169 list_context<-append(list_context, contx2) # verification of the presence of values in each condition |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
170 list_condition<-append(list_condition, set_cond2[j]) # contained in the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
171 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
172 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
173 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
174 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
175 else{ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
176 for (contrast in colnames(data_list$contrast)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
177 i=i+1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
178 contexts=strsplit2(contrast,"vs") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
179 contrast_asko[i,"Contrast"]<-contrast |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
180 contrast_asko[i,"context1"]=contexts[1] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
181 contrast_asko[i,"context2"]=contexts[2] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
182 set_cond1<-row.names(data_list$contrast)[data_list$contrast[,contrast]>0] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
183 set_cond2<-row.names(data_list$contrast)[data_list$contrast[,contrast]<0] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
184 for (cond1 in set_cond1){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
185 # print(contexts[1]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
186 # print(cond1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
187 list_context<-append(list_context, contexts[1]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
188 list_condition<-append(list_condition, cond1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
189 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
190 for (cond2 in set_cond2){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
191 list_context<-append(list_context, contexts[2]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
192 list_condition<-append(list_condition, cond2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
193 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
194 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
195 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
196 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
197 list_context<-unlist(list_context) # conversion list to vector |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
198 list_condition<-unlist(list_condition) # conversion list to vector |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
199 # print(list_condition) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
200 # print(list_context) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
201 context_asko<-data.frame(list_context,list_condition) # creation of the context data frame |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
202 context_asko<-unique(context_asko) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
203 colnames(context_asko)[colnames(context_asko)=="list_context"]<-"context" # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
204 colnames(context_asko)[colnames(context_asko)=="list_condition"]<-"condition" # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
205 #asko$contrast<-contrast_asko # adding context data frame to asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
206 #asko$context<-context_asko # adding context data frame to asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
207 asko<-list("condition"=condition_asko, "contrast"=contrast_asko, "context"=context_asko) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
208 colnames(context_asko)[colnames(context_asko)=="context"]<-"Context" # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
209 colnames(context_asko)[colnames(context_asko)=="condition"]<-"has@Condition" # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
210 colnames(contrast_asko)[colnames(contrast_asko)=="context1"]<-paste("context1_of", "Context", sep="@") # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
211 colnames(contrast_asko)[colnames(contrast_asko)=="context2"]<-paste("context2_of", "Context", sep="@") # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
212 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
213 ######## Files creation ######## |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
214 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
215 write.table(data.frame("Condition"=row.names(condition_asko),condition_asko), paste0(parameters$out_dir,"/condition.asko.txt"), sep = parameters$sep, row.names = F, quote=F) # creation of condition file for asko |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
216 write.table(context_asko, paste0(parameters$out_dir,"/context.asko.txt"), sep=parameters$sep, col.names = T, row.names = F,quote=F) # creation of context file for asko |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
217 write.table(contrast_asko, paste0(parameters$out_dir,"/contrast.asko.txt"), sep=parameters$sep, col.names = T, row.names = F, quote=F) # creation of contrast file for asko |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
218 return(asko) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
219 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
220 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
221 .NormCountsMean <- function(glmfit, ASKOlist, context){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
222 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
223 lib_size_norm<-glmfit$samples$lib.size*glmfit$samples$norm.factors # normalization computation of all library sizes |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
224 set_condi<-ASKOlist$context$condition[ASKOlist$context$context==context] # retrieval of condition names associated to context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
225 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
226 for (condition in set_condi){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
227 sample_name<-rownames(glmfit$samples[glmfit$samples$condition==condition,]) # retrieval of the replicate names associated to conditions |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
228 subset_counts<-data.frame(row.names = row.names(glmfit$counts)) # initialization of data frame as subset of counts table |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
229 for(name in sample_name){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
230 lib_sample_norm<-glmfit$samples[name,"lib.size"]*glmfit$samples[name,"norm.factors"] # normalization computation of sample library size |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
231 subset_counts$c<-glmfit$counts[,name] # addition in subset of sample counts column |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
232 subset_counts$c<-subset_counts$c*mean(lib_size_norm)/lib_sample_norm # normalization computation of sample counts |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
233 colnames(subset_counts)[colnames(subset_counts)=="c"]<-name # to rename the column with the condition name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
234 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
235 mean_counts<-rowSums(subset_counts)/ncol(subset_counts) # computation of the mean |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
236 ASKOlist$stat.table$mean<-mean_counts # subset integration in the glm_result table |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
237 colnames(ASKOlist$stat.table)[colnames(ASKOlist$stat.table)=="mean"]<-paste(context,condition,sep = "/") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
238 } # to rename the column with the context name |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
239 return(ASKOlist$stat.table) # return the glm object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
240 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
241 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
242 AskoStats <- function (glm_test, fit, contrast, ASKOlist, dge,parameters){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
243 contrasko<-ASKOlist$contrast$Contrast[row.names(ASKOlist$contrast)==contrast] # to retrieve the name of contrast from Asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
244 contx1<-ASKOlist$contrast$context1[row.names(ASKOlist$contrast)==contrast] # to retrieve the name of 1st context from Asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
245 contx2<-ASKOlist$contrast$context2[row.names(ASKOlist$contrast)==contrast] # to retrieve the name of 2nd context from Asko object |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
246 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
247 ASKO_stat<-glm_test$table |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
248 ASKO_stat$Test_id<-paste(contrasko, rownames(ASKO_stat), sep = "_") # addition of Test_id column = unique ID |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
249 ASKO_stat$contrast<-contrasko # addition of the contrast of the test |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
250 ASKO_stat$gene <- row.names(ASKO_stat) # addition of gene column = gene ID |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
251 ASKO_stat$FDR<-p.adjust(ASKO_stat$PValue, method=parameters$p_adj_method) # computation of False Discovery Rate |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
252 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
253 ASKO_stat$Significance=0 # Between context1 and context2 : |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
254 ASKO_stat$Significance[ASKO_stat$logFC< 0 & ASKO_stat$FDR<=parameters$threshold_FDR] = -1 # Significance values = -1 for down regulated genes |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
255 ASKO_stat$Significance[ASKO_stat$logFC> 0 & ASKO_stat$FDR<=parameters$threshold_FDR] = 1 # Significance values = 1 for up regulated genes |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
256 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
257 if(parameters$Expression==TRUE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
258 ASKO_stat$Expression=NA # addition of column "expression" |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
259 ASKO_stat$Expression[ASKO_stat$Significance==-1]<-paste(contx1, contx2, sep="<") # the value of attribute "Expression" is a string |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
260 ASKO_stat$Expression[ASKO_stat$Significance==1]<-paste(contx1, contx2, sep=">") # this attribute is easier to read the Significance |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
261 ASKO_stat$Expression[ASKO_stat$Significance==0]<-paste(contx1, contx2, sep="=") # of expression between two contexts |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
262 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
263 if(parameters$logFC==T){cola="logFC"}else{cola=NULL} # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
264 if(parameters$FC==T){colb="FC";ASKO_stat$FC <- 2^abs(ASKO_stat$logFC)}else{colb=NULL} # computation of Fold Change from log2FC |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
265 if(parameters$Sign==T){colc="Significance"} # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
266 if(parameters$logCPM==T){cold="logCPM"}else{cold=NULL} # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
267 if(parameters$LR==T){cole="LR"}else{cole=NULL} # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
268 if(parameters$FDR==T){colf="FDR"}else{colf=NULL} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
269 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
270 ASKOlist$stat.table<-ASKO_stat[,c("Test_id","contrast","gene",cola,colb,"PValue", # adding table "stat.table" to the ASKOlist |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
271 "Expression",colc,cold,cole,colf)] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
272 if(parameters$mean_counts==T){ # computation of the mean of normalized counts for conditions |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
273 ASKOlist$stat.table<-.NormCountsMean(fit, ASKOlist, contx1) # in the 1st context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
274 ASKOlist$stat.table<-.NormCountsMean(fit, ASKOlist, contx2) # in the 2nd context |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
275 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
276 print(table(ASKO_stat$Expression)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
277 colnames(ASKOlist$stat.table)[colnames(ASKOlist$stat.table)=="gene"] <- paste("is", "gene", sep="@") # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
278 colnames(ASKOlist$stat.table)[colnames(ASKOlist$stat.table)=="contrast"] <- paste("measured_in", "Contrast", sep="@") # header formatting for askomics |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
279 o <- order(ASKOlist$stat.table$FDR) # ordering genes by FDR value |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
280 ASKOlist$stat.table<-ASKOlist$stat.table[o,] |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
281 |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
282 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
283 dir.create(parameters$out_dir) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
284 write.table(ASKOlist$stat.table,paste0(parameters$out_dir,"/", parameters$organism, contrasko, ".txt"), # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
285 sep=parameters$sep, col.names = T, row.names = F, quote=FALSE) |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
286 |
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
287 |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
288 if(parameters$heatmap==TRUE){ |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
289 numhigh=parameters$numhigh |
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
290 if (numhigh>length(o)) {numhigh=length(o)} |
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
291 cpm_gstats<-cpm(dge, log=TRUE)[o,][1:numhigh,] |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
292 heatmap.2(cpm_gstats, cexRow=0.5, cexCol=0.8, scale="row", labCol=dge$samples$Name, xlab=contrast, Rowv = FALSE, dendrogram="col") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
293 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
294 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
295 return(ASKOlist) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
296 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
297 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
298 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
299 loadData <- function(parameters){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
300 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
301 #####samples##### |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
302 samples<-read.table(parameters$sample_file, header=TRUE, sep="\t", row.names=1, comment.char = "#") #prise en compte des r?sultats de T2 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
303 if(is.null(parameters$select_sample)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
304 if(parameters$regex==TRUE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
305 selected<-c() |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
306 for(sel in parameters$select_sample){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
307 select<-grep(sel, rownames(samples)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
308 if(is.null(selected)){selected=select}else{selected<-append(selected, select)} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
309 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
310 samples<-samples[selected,] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
311 }else{samples<-samples[parameters$select_sample,]} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
312 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
313 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
314 if(is.null(parameters$rm_sample)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
315 if(parameters$regex==TRUE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
316 for(rm in parameters$rm_sample){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
317 removed<-grep(rm, rownames(samples)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
318 # print(removed) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
319 if(length(removed!=0)){samples<-samples[-removed,]} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
320 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
321 }else{ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
322 for (rm in parameters$rm_sample) { |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
323 rm2<-match(rm, rownames(samples)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
324 samples<-samples[-rm2,] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
325 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
326 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
327 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
328 condition<-unique(samples$condition) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
329 #print(condition) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
330 color<-brewer.pal(length(condition), parameters$palette) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
331 #print(color) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
332 samples$color<-NA |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
333 j=0 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
334 for(name in condition){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
335 j=j+1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
336 samples$color[samples$condition==name]<-color[j] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
337 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
338 #print(samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
339 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
340 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
341 #####counts##### |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
342 if(is.null(parameters$fileofcount)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
343 dge<-readDGE(samples$file, labels=rownames(samples), columns=c(parameters$col_genes,parameters$col_counts), header=TRUE, comment.char="#") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
344 dge<-DGEList(counts=dge$counts, samples=samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
345 # dge$samples=samples |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
346 #countT<-dge$counts |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
347 # if(is.null(parameters$select_sample)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
348 # slct<-grep(parameters$select_sample, colnames(countT)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
349 # dge$counts<-dge$counts[,slct] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
350 # dge$samples<-dge$samples[,slct] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
351 # } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
352 # if(is.null(parameters$rm_sample)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
353 # rmc<-grep(parameters$rm_count, colnames(dge$counts)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
354 # dge$counts<-dge$counts[,-rmc] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
355 # print(ncol(dge$counts)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
356 # rms<-grep(parameters$rm_sample, row.names(dge$samples)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
357 # dge$samples<-dge$samples[-rms,] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
358 # } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
359 }else { |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
360 if(grepl(".csv", parameters$fileofcount)==TRUE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
361 count<-read.csv(parameters$fileofcount, header=TRUE, sep = "\t", row.names = parameters$col_genes) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
362 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
363 else{ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
364 count<-read.table(parameters$fileofcount, header=TRUE, sep = "\t", row.names = parameters$col_genes, comment.char = "") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
365 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
366 select_counts<-row.names(samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
367 #countT<-count[,c(parameters$col_counts:length(colnames(count)))] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
368 countT<-count[,select_counts] |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
369 #print(countT) |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
370 dge<-DGEList(counts=countT, samples=samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
371 # if(is.null(parameters$select_sample)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
372 # slct<-grep(parameters$select_sample, colnames(countT)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
373 # countT<-countT[,slct] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
374 # } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
375 # if(is.null(parameters$rm_count)==FALSE){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
376 # rms<-grep(parameters$rm_count, colnames(countT)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
377 # #print(rms) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
378 # countT<-countT[,-rms] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
379 # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
380 # } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
381 #print(nrow(samples)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
382 #print(ncol(countT)) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
383 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
384 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
385 #####design##### |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
386 Group<-factor(samples$condition) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
387 designExp<-model.matrix(~0+Group) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
388 rownames(designExp) <- row.names(samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
389 colnames(designExp) <- levels(Group) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
390 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
391 #####contrast##### |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
392 contrastab<-read.table(parameters$contrast_file, sep="\t", header=TRUE, row.names = 1, comment.char="#", stringsAsFactors = FALSE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
393 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
394 rmcol<-list() |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
395 for(condition_name in row.names(contrastab)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
396 test<-match(condition_name, colnames(designExp),nomatch = 0) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
397 if(test==0){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
398 print(condition_name) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
399 rm<-grep("0", contrastab[condition_name,], invert = T) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
400 print(rm) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
401 if(is.null(rmcol)){rmcol=rm}else{rmcol<-append(rmcol, rm)} |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
402 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
403 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
404 if (length(rmcol)> 0){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
405 rmcol<-unlist(rmcol) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
406 rmcol<-unique(rmcol) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
407 rmcol=-rmcol |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
408 contrastab<-contrastab[,rmcol] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
409 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
410 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
411 ord<-match(colnames(designExp),row.names(contrastab), nomatch = 0) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
412 contrast_table<-contrastab[ord,] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
413 colnum<-c() |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
414 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
415 for(contrast in colnames(contrast_table)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
416 set_cond1<-row.names(contrast_table)[contrast_table[,contrast]=="+"] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
417 #print(set_cond1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
418 set_cond2<-row.names(contrast_table)[contrast_table[,contrast]=="-"] |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
419 #print(set_cond2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
420 if(length(set_cond1)!=length(set_cond2)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
421 contrast_table[,contrast][contrast_table[,contrast]=="+"]=signif(1/length(set_cond1),digits = 2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
422 contrast_table[,contrast][contrast_table[,contrast]=="-"]=signif(-1/length(set_cond2),digits = 2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
423 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
424 else { |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
425 contrast_table[,contrast][contrast_table[,contrast]=="+"]=1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
426 contrast_table[,contrast][contrast_table[,contrast]=="-"]=-1 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
427 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
428 contrast_table[,contrast]<-as.numeric(contrast_table[,contrast]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
429 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
430 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
431 #####annotation##### |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
432 #annotation <- read.csv(parameters$annotation_file, header = T, sep = '\t', quote = "", row.names = 1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
433 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
434 #data<-list("counts"=countT, "samples"=samples, "contrast"=contrast_table, "annot"=annotation, "design"=designExp) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
435 #print(countT) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
436 rownames(dge$samples)<-rownames(samples) #Â replace the renaming by files |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
437 data<-list("dge"=dge, "samples"=samples, "contrast"=contrast_table, "design"=designExp) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
438 return(data) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
439 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
440 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
441 GEfilt <- function(dge_list, parameters){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
442 cpm<-cpm(dge_list) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
443 logcpm<-cpm(dge_list, log=TRUE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
444 colnames(logcpm)<-rownames(dge_list$samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
445 nsamples <- ncol(dge_list) # cr?ation nouveau plot |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
446 plot(density(logcpm[,1]), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
447 col=as.character(dge_list$samples$color[1]), # plot exprimant la densit? de chaque g?ne |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
448 lwd=1, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
449 ylim=c(0,0.21), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
450 las=2, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
451 main="A. Raw data", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
452 xlab="Log-cpm") # en fonction de leurs valeurs d'expression |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
453 abline(v=0, lty=3) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
454 for (i in 2:nsamples){ # on boucle sur chaque condition restante |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
455 den<-density(logcpm[,i]) # et les courbes sont rajout?es dans le plot |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
456 lines(den$x, col=as.character(dge_list$samples$color[i]), den$y, lwd=1) # |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
457 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
458 legend("topright", rownames(dge_list$samples), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
459 text.col=as.character(dge_list$samples$color), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
460 bty="n", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
461 text.width=6, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
462 cex=0.5) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
463 # rowSums compte le nombre de score (cases) pour chaque colonne Sup ? 0.5 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
464 keep.exprs <- rowSums(cpm>parameters$threshold_cpm)>=parameters$replicate_cpm # en ajoutant >=3 cela donne un test conditionnel |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
465 filtered_counts <- dge_list[keep.exprs,,keep.lib.sizes=F] # si le comptage respecte la condition alors renvoie TRUE |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
466 filtered_cpm<-cpm(filtered_counts$counts, log=TRUE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
467 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
468 plot(density(filtered_cpm[,1]), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
469 col=as.character(dge_list$samples$color[1]), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
470 lwd=2, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
471 ylim=c(0,0.21), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
472 las=2, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
473 main="B. Filtered data", xlab="Log-cpm") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
474 abline(v=0, lty=3) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
475 for (i in 2:nsamples){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
476 den <- density(filtered_cpm[,i]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
477 lines(den$x,col=as.character(dge_list$samples$color[i]), den$y, lwd=1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
478 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
479 legend("topright", rownames(dge_list$samples), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
480 text.col=as.character(dge_list$samples$col), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
481 bty="n", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
482 text.width=6, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
483 cex=0.5) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
484 return(filtered_counts) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
485 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
486 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
487 GEnorm <- function(filtered_GE, parameters){ |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
488 filtered_cpm=log2(1000000*filtered_GE$counts/colSums(filtered_GE$counts)) |
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
489 #filtered_cpm <- cpm(filtered_GE, log=TRUE, normalized.lib.sizes=TRUE) #nouveau calcul Cpm sur donn?es filtr?es, si log=true alors valeurs cpm en log2 |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
490 colnames(filtered_cpm)<-rownames(filtered_GE$samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
491 boxplot(filtered_cpm, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
492 col=filtered_GE$samples$color, #boxplot des scores cpm non normalis?s |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
493 main="A. Before normalization", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
494 cex.axis=0.5, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
495 las=2, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
496 ylab="Log-cpm") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
497 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
498 norm_GE<-calcNormFactors(filtered_GE, method = parameters$normal_method) # normalisation de nos comptages par le methode TMM, estimation du taux de production d'un ARN # en estimant l'?chelle des facteurs entre echantillons -> but : pouvoir comparer nos ech entre eux |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
499 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
500 logcpm_norm <- cpm(norm_GE, log=TRUE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
501 colnames(logcpm_norm)<-rownames(filtered_GE$samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
502 boxplot(logcpm_norm, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
503 col=filtered_GE$samples$color, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
504 main="B. After normalization", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
505 cex.axis=0.5, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
506 las=2, |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
507 ylab="Log-cpm") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
508 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
509 return(norm_GE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
510 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
511 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
512 GEcorr <- function(dge, parameters){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
513 lcpm<-cpm(dge, log=TRUE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
514 colnames(lcpm)<-rownames(dge$samples) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
515 cormat<-cor(lcpm) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
516 # color<- colorRampPalette(c("yellow", "white", "green"))(20) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
517 color<-colorRampPalette(c("black","red","yellow","white"),space="rgb")(28) |
2
877d2be25a6a
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 994ecff7807bb0eb9dac740d67ad822415b0b464
genouest
parents:
0
diff
changeset
|
518 heatmap.2(cormat, col=color, symm=TRUE,RowSideColors =as.character(dge$samples$color), ColSideColors = as.character(dge$samples$color)) |
0
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
519 #MDS |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
520 mds <- cmdscale(dist(t(lcpm)),k=3, eig=TRUE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
521 eigs<-round((mds$eig)*100/sum(mds$eig[mds$eig>0]),2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
522 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
523 mds1<-ggplot(as.data.frame(mds$points), aes(V1, V2, label = rownames(mds$points))) + labs(title="MDS Axes 1 and 2") + geom_point(color =as.character(dge$samples$color) ) + xlab(paste('dim 1 [', eigs[1], '%]')) +ylab(paste('dim 2 [', eigs[2], "%]")) + geom_label_repel(aes(label = rownames(mds$points)), color = 'black',size = 3.5) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
524 print(mds1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
525 #ggsave("mds_corr1-2.tiff") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
526 #ggtitle("MDS Axes 2 and 3") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
527 mds2<-ggplot(as.data.frame(mds$points), aes(V2, V3, label = rownames(mds$points))) + labs(title="MDS Axes 2 and 3") + geom_point(color =as.character(dge$samples$color) ) + xlab(paste('dim 2 [', eigs[2], '%]')) +ylab(paste('dim 3 [', eigs[3], "%]")) + geom_label_repel(aes(label = rownames(mds$points)), color = 'black',size = 3.5) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
528 print(mds2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
529 # ggtitle("MDS Axes 1 and 3") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
530 #ggsave("mds_corr2-3.tiff") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
531 mds3<-ggplot(as.data.frame(mds$points), aes(V1, V3, label = rownames(mds$points))) + labs(title="MDS Axes 1 and 3") + geom_point(color =as.character(dge$samples$color) ) + xlab(paste('dim 1 [', eigs[1], '%]')) +ylab(paste('dim 3 [', eigs[3], "%]")) + geom_label_repel(aes(label = rownames(mds$points)), color = 'black',size = 3.5) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
532 print(mds3) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
533 #ggsave("mds_corr1-3.tiff") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
534 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
535 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
536 DEanalysis <- function(norm_GE, data_list, asko_list, parameters){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
537 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
538 normGEdisp <- estimateDisp(norm_GE, data_list$design) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
539 if(parameters$glm=="lrt"){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
540 fit <- glmFit(normGEdisp, data_list$design, robust = T) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
541 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
542 if(parameters$glm=="qlf"){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
543 fit <- glmQLFit(normGEdisp, data_list$design, robust = T) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
544 plotQLDisp(fit) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
545 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
546 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
547 #plotMD.DGEGLM(fit) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
548 #plotBCV(norm_GE) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
549 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
550 #sum<-norm_GE$genes |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
551 for (contrast in colnames(data_list$contrast)){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
552 print(asko_list$contrast$Contrast[contrast]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
553 if(parameters$glm=="lrt"){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
554 glm_test<-glmLRT(fit, contrast=data_list$contrast[,contrast]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
555 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
556 if(parameters$glm=="qlf"){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
557 glm_test<-glmQLFTest(fit, contrast=data_list$contrast[,contrast]) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
558 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
559 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
560 #sum[,contrast]<-decideTestsDGE(glm, adjust.method = parameters$p_adj_method, lfc=1) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
561 #print(table(sum[,contrast])) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
562 AskoStats(glm_test, fit, contrast, asko_list,normGEdisp,parameters) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
563 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
564 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
565 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
566 Asko_start <-function(){ |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
567 library(limma) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
568 library(statmod) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
569 library(edgeR) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
570 library(ggplot2) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
571 library(RColorBrewer) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
572 library(ggrepel) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
573 library(gplots) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
574 library(stringr) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
575 library(optparse) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
576 option_list = list( |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
577 make_option(c("-o", "--out"), type="character", default="out.pdf",dest="output_pdf", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
578 help="output file name [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
579 make_option(c("-d", "--dir"), type="character", default=".",dest="dir_path", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
580 help="data directory path [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
581 make_option("--outdir", type="character", default=".",dest="out_dir", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
582 help="outputs directory [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
583 make_option(c("-O", "--org"), type="character", default="Asko", dest="organism", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
584 help="Organism name [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
585 make_option(c("-f", "--fileofcount"), type="character", default=NULL, dest="fileofcount", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
586 help="file of counts [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
587 make_option(c("-G", "--col_genes"), type="integer", default=1, dest="col_genes", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
588 help="col of ids in count files [default= %default]", metavar="integer"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
589 make_option(c("-C", "--col_counts"), type="integer", default=7,dest="col_counts", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
590 help="col of counts in count files [default= %default (featureCounts) ]", metavar="integer"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
591 make_option(c("-t", "--sep"), type="character", default="\t", dest="sep", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
592 help="col separator [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
593 make_option(c("-a", "--annotation"), type="character", default="annotation.txt", dest="annotation_file", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
594 help="annotation file [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
595 make_option(c("-s", "--sample"), type="character", default="Samples.txt", dest="sample_file", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
596 help="Samples file [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
597 make_option(c("-c", "--contrasts"), type="character", default="Contrasts.txt",dest="contrast_file", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
598 help="Contrasts file [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
599 make_option(c("-k", "--mk_context"), type="logical", default=FALSE,dest="mk_context", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
600 help="generate automatically the context names [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
601 make_option(c("-p", "--palette"), type="character", default="Set2", dest="palette", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
602 help="Color palette (ggplot)[default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
603 make_option(c("-R", "--regex"), type="logical", default=FALSE, dest="regex", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
604 help="use regex when selecting/removing samples [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
605 make_option(c("-S", "--select"), type="character", default=NULL, dest="select_sample", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
606 help="selected samples [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
607 make_option(c("-r", "--remove"), type="character", default=NULL, dest="rm_sample", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
608 help="removed samples [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
609 make_option(c("--th_cpm"), type="double", default=0.5, dest="threshold_cpm", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
610 help="CPM's threshold [default= %default]", metavar="double"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
611 make_option(c("--rep"), type="integer", default=3, dest="replicate_cpm", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
612 help="Minimum number of replicates [default= %default]", metavar="integer"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
613 make_option(c("--th_FDR"), type="double", default=0.05, dest="threshold_FDR", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
614 help="FDR threshold [default= %default]", metavar="double"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
615 make_option(c("-n", "--normalization"), type="character", default="TMM", dest="normal_method", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
616 help="normalization method (TMM/RLE/upperquartile/none) [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
617 make_option(c("--adj"), type="character", default="fdr", dest="p_adj_method", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
618 help="p-value adjust method (holm/hochberg/hommel/bonferroni/BH/BY/fdr/none) [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
619 make_option("--glm", type="character", default="qlf", dest="glm", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
620 help=" GLM method (lrt/qlf) [default= %default]", metavar="character"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
621 make_option(c("--lfc"), type="logical", default="TRUE", dest="logFC", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
622 help="logFC in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
623 make_option("--fc", type="logical", default="TRUE", dest="FC", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
624 help="FC in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
625 make_option(c("--lcpm"), type="logical", default="FALSE", dest="logCPM", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
626 help="logCPm in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
627 make_option("--fdr", type="logical", default="TRUE", dest="FDR", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
628 help="FDR in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
629 make_option("--lr", type="logical", default="FALSE", dest="LR", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
630 help="LR in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
631 make_option(c("--sign"), type="logical", default="TRUE", dest="Sign", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
632 help="Significance (1/0/-1) in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
633 make_option(c("--expr"), type="logical", default="TRUE", dest="Expression", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
634 help="Significance expression in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
635 make_option(c("--mc"), type="logical", default="TRUE", dest="mean_counts", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
636 help="Mean counts in the summary table [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
637 make_option(c("--hm"), type="logical", default="TRUE", dest="heatmap", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
638 help="generation of the expression heatmap [default= %default]", metavar="logical"), |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
639 make_option(c("--nh"), type="integer", default="50", dest="numhigh", |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
640 help="number of genes in the heatmap [default= %default]", metavar="integer") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
641 ) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
642 opt_parser = OptionParser(option_list=option_list) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
643 parameters = parse_args(opt_parser) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
644 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
645 if(is.null(parameters$rm_sample) == FALSE ) { |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
646 str_replace_all(parameters$rm_sample, " ", "") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
647 parameters$rm_sample<-strsplit2(parameters$rm_sample, ",") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
648 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
649 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
650 if(is.null(parameters$select_sample) == FALSE ) { |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
651 str_replace_all(parameters$select_sample, " ", "") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
652 parameters$select_sample<-strsplit2(parameters$select_sample, ",") |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
653 } |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
654 |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
655 dir.create(parameters$out_dir) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
656 return(parameters) |
ceef9bc6bbc7
planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/askor commit 08a187f91ba050d584e586d2fcc99d984dac607c
genouest
parents:
diff
changeset
|
657 } |