comparison Intchecks/Script_intensity_check.R @ 6:ec75de7f1e08 draft default tip

Uploaded
author melpetera
date Mon, 11 Dec 2023 12:56:20 +0000
parents a31f3f802b2b
children
comparison
equal deleted inserted replaced
5:a31f3f802b2b 6:ec75de7f1e08
18 DM.name <- "DM_NA.tabular" 18 DM.name <- "DM_NA.tabular"
19 SM.name <- "SM_NA.tabular" 19 SM.name <- "SM_NA.tabular"
20 VM.name <- "vM_NA.tabular" 20 VM.name <- "vM_NA.tabular"
21 method <- "one_class" 21 method <- "one_class"
22 chosen.stat <- "mean,sd,quartile,decile,NA" 22 chosen.stat <- "mean,sd,quartile,decile,NA"
23 class.col <- "2" 23 class.col <- "uv"
24 test.fold <- "Yes" 24 test.fold <- "Yes"
25 class1 <- "Pools" 25 class1 <- "Pools"
26 fold.frac <- "Top" 26 fold.frac <- "Top"
27 logarithm <- "log10" 27 logarithm <- "log10"
28 VM.output <- "new_VM.txt" 28 VM.output <- "new_VM.txt"
95 test.fold <- "No" 95 test.fold <- "No"
96 } 96 }
97 97
98 98
99 if(method != "no_class"){ 99 if(method != "no_class"){
100
101 class.col <- colnames(SM)[as.numeric(class.col)]
102 100
103 if(!(class.col %in% colnames(SM))){ 101 if(!(class.col %in% colnames(SM))){
104 stop("\n- - - - - - - - -\n", "The column ",class.col, " is not a part of the specify sample Metadata","\n- - - - - - - - -\n") 102 stop("\n- - - - - - - - -\n", "The ",class.col, " column is not found in the specified sample metadata file.","\n- - - - - - - - -\n")
105 } 103 }
106 104
107 c_class <- SM[,class.col] 105 c_class <- SM[,class.col]
108 c_class <- as.factor(c_class) 106 c_class <- as.factor(c_class)
109 nb_class <- nlevels(c_class) 107 nb_class <- nlevels(c_class)
110 classnames <- levels(c_class) 108 classnames <- levels(c_class)
111 109
112 if((nb_class < 2)&&(test.fold=="Yes")){ 110 if((nb_class < 2)&&(test.fold=="Yes")){
113 err.1class <- c("\n The column",class.col, "contains only one class, fold calculation could not be executed. \n") 111 err.1class <- c("\n The ",class.col, " column contains only one class, fold calculation could not be executed. \n")
114 cat(err.1class) 112 cat(err.1class)
115 } 113 }
116 114
117 if((nb_class > (nrow(SM))/3)&&(method == "each_class")){ 115 if((nb_class > (nrow(SM))/3)&&(method == "each_class")){
118 class.err <- c("\n There are too many classes, think about reducing the number of classes and excluding those 116 class.err <- c("\n There are too many classes, think about reducing the number of classes and excluding those
123 121
124 if(method == "one_class"){ 122 if(method == "one_class"){
125 if(!(class1 %in% classnames)){ 123 if(!(class1 %in% classnames)){
126 list.class1 <- c("\n Classes:",classnames,"\n") 124 list.class1 <- c("\n Classes:",classnames,"\n")
127 cat(list.class1) 125 cat(list.class1)
128 err.class1 <- c("The class ",class1, " does not appear in the column ", class.col) 126 err.class1 <- c("The ",class1, " class does not appear in the ",class.col," column.")
129 stop("\n- - - - - - - - -\n", err.class1,"\n- - - - - - - - -\n") 127 stop("\n- - - - - - - - -\n", err.class1,"\n- - - - - - - - -\n")
130 } 128 }
131 129
132 #If method is "one_class", change others classes in "other" 130 #If method is "one_class", change others classes in "other"
133 for(i in 1:length(c_class)){ 131 for(i in 1:length(c_class)){