Error when trying to create a heatmap with DESeq2
1
0
Entering edit mode
langziv • 0
@717f878c
Last seen 5 months ago
Israel

I'm following a tutorial for using the DESeq2 package, specifically, for creating heat maps.
Here's the code I use:

library('dplyr')
library('pheatmap')
library(ggplot2)

counts <- read.csv("Control vs serum - RN 1.tsv", header=TRUE, sep = '\t')
counts <- counts[, -c(ncol(counts) - 1, ncol(counts))]
counts$Gene <- NULL
counts.matrix <- as.matrix(counts)
columns <- read.csv("Metadata.tsv", header=TRUE, sep = '\t')
library(DESeq2)
dds <- DESeqDataSetFromMatrix(counts.matrix, columns, design = ~ 1)
dds <- DESeq(dds)
rld <- rlog(dds, blind=FALSE)

# Heat maps:
matrix <- SummarizedExperiment::assay(rld)
top_variable_genes <- head(order(rowVars(matrix), decreasing=TRUE), 500)
heatmap_matrix <- matrix(top_variable_genes,)
heatmap <- pheatmap(heatmap_matrix,scale='row',cluster_rows=TRUE,cluster_cols=TRUE,show_rownames=FALSE,show_colnames=TRUE)
ggsave('Heatmap.pdf', heatmap)

The command that yields the error is
heatmap <- pheatmap(heatmap_matrix,scale='row',cluster_rows=TRUE,cluster_cols=TRUE,show_rownames=FALSE,show_colnames=TRUE).
The error message:

Error in seq.default(-m, m, length.out = n + 1) :
  'from' must be a finite number
In addition: Warning messages:
1: In min(x, na.rm = T) : no non-missing arguments to min; returning Inf
2: In max(x, na.rm = T) : no non-missing arguments to max; returning -Inf

I'm looking for assistance in correcting this command.
Here's a sample of the variable heatmap_matrix's content:

> heatmap_matrix[,]
 [1] 4125 3416 3417 3418 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555
 [16] 3556 3557 4442 4443 4444 3867 3150 3151 3152 2141  339  340  341  342  343
 [31]  344  345 3116 3563 3564 3565   19   20   21 2979 4531 4532 3209 3210 3211
 [46] 2125  191 2158 2461 3295 3296 2126 2127 2128 4282 4571 4572 4020 2210 4261

If any other information is needed, I'll be happy to provide it.
Thanks!

Heatmap RNA-seqanalysis heatmaps DESeq2 • 654 views
ADD COMMENT
0
Entering edit mode
Basti ▴ 780
@7d45153c
Last seen 1 day ago
France

It indicates you have infinite values in your matrix, you should trace back when these values occur (maybe you can provide a reproducible example if you want to us to check why this is happening)

ADD COMMENT

Login before adding your answer.

Traffic: 580 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