comparison w4mcorcov_calc.R @ 3:61935618f92c draft

planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 7682e8e7ae2bfb926d94b414b9a1649389f33582
author eschen42
date Sun, 12 Nov 2017 16:40:57 -0500
parents a06344808ffc
children d3bb34e764fe
comparison
equal deleted inserted replaced
2:a06344808ffc 3:61935618f92c
32 min_x <- min(covariance) 32 min_x <- min(covariance)
33 max_x <- max(covariance) 33 max_x <- max(covariance)
34 lim_x <- max(sapply(X=c(min_x, max_x), FUN=abs)) 34 lim_x <- max(sapply(X=c(min_x, max_x), FUN=abs))
35 covariance <- covariance / lim_x 35 covariance <- covariance / lim_x
36 lim_x <- 1.2 36 lim_x <- 1.2
37 main_label <- sprintf("%s for levels %s versus %s", x_prefix, fctr_lvl_1, fctr_lvl_2) 37 main_label <- sprintf("%s for level %s versus %s", x_prefix, fctr_lvl_1, fctr_lvl_2)
38 main_cex <- min(1.0, 46.0/nchar(main_label)) 38 main_cex <- min(1.0, 46.0/nchar(main_label))
39 # "It is generally accepted that a variable should be selected if vj>1, [27–29], 39 # "It is generally accepted that a variable should be selected if vj>1, [27–29],
40 # but a proper threshold between 0.83 and 1.21 can yield more relevant variables according to [28]." 40 # but a proper threshold between 0.83 and 1.21 can yield more relevant variables according to [28]."
41 # (Mehmood 2012 doi:10.1186/1748-7188-6-27) 41 # (Mehmood 2012 doi:10.1186/1748-7188-6-27)
42 vipco <- pmax(0, pmin(1,(vip4p-0.83)/(1.21-0.83))) 42 vipco <- pmax(0, pmin(1,(vip4p-0.83)/(1.21-0.83)))
48 cex <- 0.75 48 cex <- 0.75
49 plot( 49 plot(
50 y = plus_cor 50 y = plus_cor
51 , x = plus_cov 51 , x = plus_cov
52 , type="p" 52 , type="p"
53 , xlim=c(-lim_x, lim_x + off(0.2)) 53 , xlim=c( -lim_x - off(0.2), lim_x + off(0.2) )
54 , ylim=c(-1.0 - off(0.2), 1.0) 54 , ylim=c( -1.0 - off(0.2), 1.0 + off(0.2) )
55 , xlab = sprintf("relative covariance(feature,t1)") 55 , xlab = sprintf("relative covariance(feature,t1)")
56 , ylab = sprintf("correlation(feature,t1)") 56 , ylab = sprintf("correlation(feature,t1)")
57 , main = main_label 57 , main = main_label
58 , cex.main = main_cex 58 , cex.main = main_cex
59 , cex = cex 59 , cex = cex
88 } 88 }
89 labels <- unname(sapply( X = tsv1$featureID, FUN = function(x) if( x %in% labels_to_show ) x else "" )) 89 labels <- unname(sapply( X = tsv1$featureID, FUN = function(x) if( x %in% labels_to_show ) x else "" ))
90 text( 90 text(
91 y = plus_cor - 0.013 91 y = plus_cor - 0.013
92 , x = plus_cov + 0.020 92 , x = plus_cov + 0.020
93 , cex = 0.3 93 , cex = 0.4
94 , labels = labels 94 , labels = labels
95 , col = rgb(blue = blue, red = red, green = 0, alpha = 0.2 + 0.8 * alpha) 95 , col = rgb(blue = 0, red = 0, green = 0, alpha = 0.5) # rgb(blue = blue, red = red, green = 0, alpha = 0.2 + 0.8 * alpha)
96 , srt = -30 # slant 30 degrees downward 96 , srt = -30 # slant 30 degrees downward
97 , adj = 0 # left-justified 97 , adj = 0 # left-justified
98 ) 98 )
99 } 99 }
100 } 100 }