Cluster Dendrogram for Whole Genome Methylation Data
1
2
Entering edit mode
19 months ago

I am doing WGBS data analysis, where I am using MethylKIT package. I used clusterSamples(object, dist= "correlation", method= "ward", plot=TRUE) to get a dendrogram. How can I change the color of the line according to my need. I mean what argument or whatever should I put.

Dendrogram Cluster • 522 views
ADD COMMENT
0
Entering edit mode
19 months ago

You can inspect the internals of functions in R by calling the function without parentheses, e.g. clusterSamples. If the function is written in C/Fortran etc. its internals will remain elusive, but for functions written in R, you usually get to see what you need to know.

if(plot){

    my.cols=rainbow(length(unique(treatment)), start=1, end=0.6)

    dend = as.dendrogram(hc)
    dend_colored <- dendrapply(dend, colLab,col.list)

    plot(dend_colored, ...);
    # end of plot
    }
  return(hc)
  }

Evidently, there are no parameters to customize the colors, since they are auto-generated. The function, however, returns hc, which is the result of the hierarchical clustering. It is fairly straightforward to feed this into the wonderful ggtree package by Guangchuang Yu that will generate beautiful and highly customizable trees. See chapter 9.2 of the book.

ADD COMMENT

Login before adding your answer.

Traffic: 1997 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6