Hierrachical Clustering of Array Columns (Samples) using Pearson Correlation

Script-wise version

f.distCol.Pearson <- function (x.mx)
# correlation among columns
        {
        dist.mx <- 1 - cor (x.mx, method = "pearson")
        dist.dmx <- as.dist (dist.mx)
        return (dist.dmx)
        }

x.hclust <- hclust (d = f.distCol.Pearson (x.mx))

plot (  x.hclust,
        main = "",
        xlab = "1 - Pearson Correlation")

library (geneplotter)

saveeps ("filename")
savepng ("filename")

Function-wise Version

f.Hclust_col_pc <- function (
                        expr.mx,
                        title.ch)
        {

        f.distCol.Pearson <- function (expr.mx)
        # correlation among columns
                {
                dist.mx <- 1 - cor (expr.mx, method = "pearson")
                dist.dmx <- as.dist (dist.mx)
                return (dist.dmx)
                }

        x.hclust <- hclust (d = f.distCol.Pearson (expr.mx))

        plot (  x.hclust,
                main = title.ch,
                xlab = "1 - Pearson Correlation")
        }

Hclust_arrayCols_PearsCorr_01.R

DanieleMerico/Code/Hierarchical_Pearson (last edited 2010-03-30 21:57:00 by DanieleMerico)

MoinMoin Appliance - Powered by TurnKey Linux