Heatmap with error message: `x' must be a numeric matrix
2
0
Entering edit mode
Biologist ▴ 120
@biologist-9801
Last seen 4.7 years ago

Hi everyone,

I am trying to do a heatmap, but I can't see what I am doing wrong. I get the error message: `x' must be a numeric matrix.

library(limma)
library(Biobase)

setwd("/export/work/geneSTdataset")

expr.rma <- read.table("tmp_exonRMA.txt",dec = ",")

minimalSet <- new("ExpressionSet", exprs = as.matrix(expr.rma))

vv <- minimalSet[1:44797,1:6]

exprs(vv)
heatmap(exprs(vv))

Error: 

Error in heatmap(exprs(vv)) : 'x' must be a numeric matrix
r heatmap numericmatrix • 21k views
ADD COMMENT
2
Entering edit mode
Assa Yeroslaviz ★ 1.5k
@assa-yeroslaviz-1597
Last seen 8 days ago
Germany

Why do you want to change it to an expressionSet, just to re-format it into a matrix?

Why not do it directly?

library(readr)

data <- read_tsv("tmp.txt") # read the exprs.rma object you gave as an example 

heatmap(as.matrix(data[,3:8])) # I assume you don't want to plot the ID columns (1:2)

this works.

 

 

ADD COMMENT
0
Entering edit mode
b.nota ▴ 370
@bnota-7379
Last seen 4.2 years ago
Netherlands

try

heatmap(as.matrix(exprs(vv)))

ADD COMMENT
0
Entering edit mode

Yes, I tried that too before. But it didnt work.

ADD REPLY
0
Entering edit mode

I have the following data in text file:

UNIT_ID    UnitName    X_8__HuGene_2_0_st_.mdp_LEVEL    E__HuGene_2_0_st_.mdp_LEVEL    GG7__HuGene_2_0_st_.mdp_LEVEL    J__HuGene_2_0_st_.mdp_LEVEL    O__HuGene_2_0_st_.mdp_LEVEL    T__HuGene_2_0_st_.mdp_LEVEL
0    17127159    353.568    335.295    221.717    815.654    684.85    803.736
1    17127161    11.0842    7.01459    7.33511    11.2121    12.6268    10.3683
2    17127163    221.647    226.774    136.274    431.32    392.533    704.743
3    17127165    5.02182    3.41172    4.12834    6.90306    4.91183    5.65681
4    17127167    393.915    433.671    228.328    1083.58    695.285    830.416
5    17127169    7.38325    6.0512    4.32289    6.09091    4.60186    5.88536
6    17127171    497.88    424.125    281.876    1349.68    772.386    920.554
7    17127173    10.9418    5.62108    5.58565    6.4397    4.55153    6.67684

ADD REPLY
0
Entering edit mode

Can you show me?:

head(vv)

ADD REPLY
0
Entering edit mode
ExpressionSet (storageMode: lockedEnvironment)
assayData: 1 features, 6 samples 
  element names: exprs 
protocolData: none
phenoData: none
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  
ADD REPLY
0
Entering edit mode

what do you get when you do

str(exprs(vv))

Are you sure it has a matrix structure?

ADD REPLY
0
Entering edit mode

It looks like you only have one feature in your assayData

ADD REPLY
0
Entering edit mode
chr [1:44797, 1:6] "UNIT_ID" "0" "1" "2" "3" "4" "5" "6" "7" ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:44797] "1" "2" "3" "4" ...
  ..$ : chr [1:6] "V1" "V2" "V3" "V4" ...

Yes, I have only one feature. So, how to get a heatmap now? 

ADD REPLY
0
Entering edit mode

Get more features!

ADD REPLY

Login before adding your answer.

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