comparison high_dim_visu.R @ 2:7e7a2a4cfce2 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/gsc_high_dimension_visualization commit e15ae06208ef1d3d42c0576ed28eb6ba10a36671
author artbio
date Tue, 25 Jun 2019 16:20:27 -0400
parents cad0001b9cfb
children 8e44c9e18a56
comparison
equal deleted inserted replaced
1:c756ab726a85 2:7e7a2a4cfce2
227 ) 227 )
228 rownames(contrasting_factor) <- contrasting_factor[,1] 228 rownames(contrasting_factor) <- contrasting_factor[,1]
229 contrasting_factor <- contrasting_factor[colnames(data),] 229 contrasting_factor <- contrasting_factor[colnames(data),]
230 colnames(contrasting_factor) <- c("id","factor") 230 colnames(contrasting_factor) <- c("id","factor")
231 contrasting_factor$factor <- as.factor(contrasting_factor$factor) 231 contrasting_factor$factor <- as.factor(contrasting_factor$factor)
232 if(nlevels(contrasting_factor$factor) == 2){
233 colors_labels <- c("#E41A1C", "#377EB8")
234 } else {
235 colors_labels <- brewer.pal(nlevels(contrasting_factor$factor), name = 'Paired')
236 }
232 factorColors <- 237 factorColors <-
233 with(contrasting_factor, 238 with(contrasting_factor,
234 data.frame(factor = levels(factor), 239 data.frame(factor = levels(contrasting_factor$factor),
235 data.frame(factor = levels(factor), 240 color = I(colors_labels)
236 color = I(brewer.pal(nlevels(factor), name = 'Paired')))) 241 )
237 ) 242 )
238 factor_cols <- factorColors$color[match(contrasting_factor$factor, 243 factor_cols <- factorColors$color[match(contrasting_factor$factor,
239 factorColors$factor)] 244 factorColors$factor)]
240 } else { 245 } else {
241 factor_cols <- rep("deepskyblue4", length(rownames(data))) 246 factor_cols <- rep("deepskyblue4", length(rownames(data)))