Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

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

    Comment


    • #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


      • #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


        • #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

          • seqadmin
            Essential Discoveries and Tools in Epitranscriptomics
            by seqadmin


            The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist on Modified Bases...
            Yesterday, 07:01 AM
          • seqadmin
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          39 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          41 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          35 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          55 views
          0 likes
          Last Post seqadmin  
          Working...
          X