Skip to content
Prev 351630 / 398500 Next

rename and color a list of list of list of values

Thanks Sven,

I started with the first function.
The values are not in a list but in df. it is more easy for me

the output is a df:
 Genes    brca_tcga  gbm_tcga   color_brca      color_gbm
name1     v1                    v2            col1                 col2
name2     v3                    v4            col3                 col4
name3    v5                     v6            col5                 col6



attriColorGene <- function(df,colname, color=c(x,y,z)){
Max <- max(df, na.rm=TRUE)
Min <- min(df, na.rm=TRUE)
#"white","yellow", "darkgoldenrod3"
my.colors <- colorRampPalette(c(x,y,z )) #creates a function my.colors
which interpolates n colors between blue, white and red
color.df <- data.frame(colname=seq(Min,Max,1), paste("col_", colname,
sep="")=my.colors(Max- Min)) #generates 2001 colors from the color ramp
df.with.color <- merge(df, color.df, by=colname)
return(df.with.color)
}

for(i in 2:length(colnames(df)) ){
  colname <- colnames[i]
  attriColorGene(df,colname, color=c(x,y,z))
}


could you describe me the structure of the output of
magic_colour, list_child , list_parent?

Thanks
Karim



On Fri, Jun 5, 2015 at 6:12 PM, Sven E. Templer <sven.templer at gmail.com>
wrote: