Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sindrle
    Senior Member
    • Aug 2013
    • 266

    #1

    Troubleshot Heatmap

    Hi!
    Im learning to make heat maps.

    I have used this data as a test:
    http://llmpp.nih.gov/DLBCL/ called "Web Figure 1 Data file"

    This is the code I used:

    data <- read.table(file = "~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", header = FALSE, skip = 1, sep = "\t")

    dim(data)

    test <- count.fields("~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", sep="\t")
    which(test != 295)

    header = scan("~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", "", n = 295)
    colnames(data) = header
    fixdata <- data[-7401,]

    x <- data.matrix(fixdata[,-2], rownames.force = NA)

    rownames(x) <- fixdata[,1]
    x[is.na(x)] = 0

    colclust <- hclust(as.dist(1-cor(x, method="pearson")), method="average")

    rowclust <- hclust(as.dist(1-cor(t(x), method="pearson")), method="complete")

    z <- x[rev(rowclust$labels[rowclust$order]), colclust$labels[colclust$order]]

    plotHeatmap(z, fast = TRUE)

    Plotting z:
    Rplot2.pdf

    Heatmap:
    Click image for larger version

Name:	Screen Shot 2014-02-16 at 08.50.13.png
Views:	1
Size:	19.5 KB
ID:	308389


    What has happened here?

    Thanks!
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    There are NAs in the data, which "cor()" doesn't handle how you likely want by default. See the "use=" option.

    Comment

    • sindrle
      Senior Member
      • Aug 2013
      • 266

      #3
      Hi again!
      I have updated the script, handling a lot of rows and columns with variance = 0.

      Should not be NAs anymore.. But don't know.

      Still, the heat map looks very black, and the row clusters seams hard to interpret?

      Screen Shot 2014-02-16 at 16.20.05.pdf

      library(clusterGenomics)
      data <- read.table(file = "~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", header = FALSE, skip = 1, sep = "\t")

      dim(data)

      test <- count.fields("~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", sep="\t")
      which(test != 295)

      header = scan("~/RNAseq/INFSTK-5010/Oblig1/NEJM_Web_Fig1data.txt", "", n = 295)
      colnames(data) = header
      fixdata <- data[-7401,-275]

      x <- data.matrix(fixdata[,-1:-2], rownames.force = NA)

      rownames(x) <- fixdata[,1]
      x[is.na(x)] = 0

      ind <- apply(x, 2, var) == 0
      x <- x[,!ind]
      ind <- apply(x, 1, var) == 0
      x <- x[!ind,]

      colclust <- hclust(as.dist(1-cor(x, method="pearson")), method="average")

      rowclust <- hclust(as.dist(1-cor(t(x), method="pearson")), method="average")

      z <- x[rev(rowclust$labels[rowclust$order]), colclust$labels[colclust$order]]

      plotHeatmap(z, fast = TRUE)

      res = part(t(x), B=10, Kmax=10, minSize=40, dist.method="cor")

      plotTreeCol(clust=colclust, groups=res$lab.hatK[colclust$order])

      res2 = part(x, B=10, Kmax=10, minSize=40, dist.method="cor")

      plotTreeRow(clust=rowclust, groups=res2$lab.hatK[rowclust$order])

      groups = cutree(colclust, k=3)

      groups2 = cutree(colclust, h=2)

      comparison <- cbind(res$lab.hatK, groups)

      colnames(comparison) <- c("PART", "cutree")

      test <- ifelse(comparison[,1]==comparison[,2], 1,NA)

      table(is.na(test))["TRUE"]

      Comment

      • dpryan
        Devon Ryan
        • Jul 2011
        • 3478

        #4
        This is because ~95% of the values are no more than 10% away from 0 after being normalized. Do a "hist(x)" to see this.

        I'd never heard of the "clusterGenomics" package before. I guess the treecutting part is interesting.

        Comment

        • sindrle
          Senior Member
          • Aug 2013
          • 266

          #5
          Thanks for input, it was what I thought, but it don't look like the one in the paper...

          I also liked the tree cutting!

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
            by SEQadmin2



            Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

            Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
            ...
            10-14-2026, 09:55 AM
          • SEQadmin2
            New Genomics Technologies Take Aim at Long-Standing Limits
            by SEQadmin2


            Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

            We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
            ...
            09-28-2026, 10:25 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 10-22-2026, 11:13 AM
          0 responses
          27 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-22-2026, 10:48 AM
          0 responses
          20 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-15-2026, 10:52 AM
          0 responses
          36 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-14-2026, 05:39 AM
          0 responses
          43 views
          0 reactions
          Last Post SEQadmin2  
          Working...