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
            Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
            by SEQadmin2



            CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

            Despite this, “CRISPR helped turn genome editing from a specialized technique into
            ...
            07-31-2026, 11:01 AM
          • SEQadmin2
            Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
            by SEQadmin2


            Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

            The systematic characterization of the human proteome has
            ...
            07-20-2026, 11:48 AM
          • SEQadmin2
            Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
            by SEQadmin2



            Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
            ...
            07-09-2026, 11:10 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Yesterday, 10:13 AM
          0 responses
          14 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-31-2026, 02:55 AM
          0 responses
          29 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-24-2026, 12:17 PM
          0 responses
          22 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-23-2026, 11:41 AM
          0 responses
          21 views
          0 reactions
          Last Post SEQadmin2  
          Working...