DESeq2 pheatmap by genefilter in R
1
0
Entering edit mode
5.4 years ago
babasaraki ▴ 50

Hello,

Please can anyone help figure out where I am wrong here. I was trying to plot heatmap from RNA-seq data that I analysed using DESeq2. I want to filter out TopVarGenes from the list of DEGs obtained but whenever I type the following code:

library("genefilter")
topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20)
mat  <- assay(rld)[ topVarGenes, ]
mat  <- mat - rowMeans(mat)
anno <- as.data.frame(coldata(rld)[, c("condition")])
pheatmap(mat, annotation_col = anno)

It returns with the following errors

Error in check.length("fill") : 'gpar' element 'fill' must not be length 0

Where have I missed it then?.

Thank you.

RNA-Seq R DESeq2 • 3.9k views
ADD COMMENT
0
Entering edit mode

Please add the results of head(mat), str(mat), head(anno),str(anno)`.

ADD REPLY
0
Entering edit mode

Thank you Dr. Friederike for offering to help. The following are the results as requested.

> head(mat)
                EJ28Pi_R1 EJ28Pi_R2 EJ28Pi_R3   EJ28_R1   EJ28_R2
ENSG00000122641  1.593920  1.872062  1.709366 -1.657337 -1.815461
ENSG00000090530  1.646580  1.761958  1.461047 -1.642301 -1.700673
ENSG00000131746 -1.645689 -1.613268 -1.574523  1.721455  1.637066
ENSG00000213923  1.470650  1.266374  1.458262 -1.249898 -1.603691
ENSG00000176788  1.482282  1.413570  1.292155 -1.350256 -1.431742
ENSG00000112195 -1.431602 -1.390391 -1.342384  1.621111  1.280154
                  EJ28_R3
ENSG00000122641 -1.702549
ENSG00000090530 -1.526612
ENSG00000131746  1.474959
ENSG00000213923 -1.341698
ENSG00000176788 -1.406008
ENSG00000112195  1.263112

> str(mat)
 num [1:20, 1:6] 1.59 1.65 -1.65 1.47 1.48 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:20] "ENSG00000122641" "ENSG00000090530" "ENSG00000131746" "ENSG00000213923" ...
  ..$ : chr [1:6] "EJ28Pi_R1" "EJ28Pi_R2" "EJ28Pi_R3" "EJ28_R1" ...


 colData(rld)[, c("condition")]
1                         EJ28Pi
2                         EJ28Pi
3                         EJ28Pi
4                           EJ28
5                           EJ28
6                           EJ28

> str(anno)
'data.frame':   6 obs. of  1 variable:
 $ colData(rld)[, c("condition")]: Factor w/ 2 levels "EJ28","EJ28Pi": 2 2 2 1 1 1
>
ADD REPLY
1
Entering edit mode

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized. SUBMIT ANSWER is for new answers to original question.

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

ADD REPLY
0
Entering edit mode

Sure, will correct that in the future. Was my mistake though being I am new to using this platform. Thank you for the brief tutoring/touring around with me.

ADD REPLY
1
Entering edit mode
5.4 years ago

my first guess would be that the error is due to lack of row.names for the anno object. annotation_col expects a data.frame, where the content defines the groups of interest (e.g. the condition), and the row.names correspond to the individual sample names (i.e. the colnames of your matrix).

Try whether row.names(anno) <- colnames(rld) helps.

ADD COMMENT
0
Entering edit mode

Thank you so much Dr. Friederike. I am glad that the heatmap pop up after trying the code you provided above. Thank you once again.

ADD REPLY

Login before adding your answer.

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