DESeq2 pheatmap returns Error in check.length("fill") : 'gpar' element 'fill' must not be length 0
1
2
Entering edit mode
5.7 years ago

Hi,

I am attempting to make some heat maps with some RNA-Seq data. I used Salmon for my quantification and followed this link to import my data into R so I can use Deseq2. So I am just going through the Deseq2 little tutorial here. I am trying to follow their instruction on how to create some heat maps. I believe my issue is with the row names. Someone asked a similar question to mine here but the issue was never resolved. So in that post, it was suggest that the row names were set to the default 1,2,3,4,5,6,7,8, which is true. This is the result I get when I run rownames(df)

[1] "1" "2" "3" "4" "5" "6" "7" "8"

So I trued to change the column names by running the following

rownames(df) <- c("adp1","adp2","adp3","adp4","fed1","fed2","fed3","fed4")
dds@colData@rownames <- c("adp1","adp2","adp3","adp4","fed1","fed2","fed3","fed4")

However, I am still getting the same error

select <- order(rowMeans(counts(dds,normalized=TRUE)),
                decreasing=TRUE)[1:20]
df <- as.data.frame(colData(dds)[,c("condition")])
pheatmap(assay(ntd)[select,], cluster_rows=FALSE, show_rownames=FALSE,
         cluster_cols=FALSE, annotation_col=df)

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

think my attempts to change the row names were point less? I think the issues goes way back to important my Salmon data into R? I could be mistaken but when I went through their import tutorial, the samples were labeled as sample1, sample2, sample3, etc.

Any help would be amazing!

RNA-Seq R software error • 6.2k views
ADD COMMENT
0
Entering edit mode

dds@colData@rownames

The only place in R I've seen @s used like that are in S4 objects - What is this dds object? Is it a custom S4 object?

EDIT: Never mind, apparently Bioconductor uses a lot of S4 objects.

ADD REPLY
0
Entering edit mode

I was really thrown off by that as well. It took me awhile how to figure out how to change the rownames in dds

ADD REPLY
7
Entering edit mode
5.7 years ago

You can just do this:

cdata <- colData(dds)

pheatmap(assay(ntd),
    cluster_rows = FALSE,
    show_rownames = FALSE,
    cluster_cols = FALSE,
    annotation_col = as.data.frame(cdata))

...or:

pheatmap(assay(ntd),
    cluster_rows = FALSE,
    show_rownames = FALSE,
    cluster_cols = FALSE,
    annotation_col = as.data.frame(cdata[,"condition"], row.names=rownames(cdata)))

You do not even have to create the df object.

Kevin

Edit (October 24, 2018: the key is that the rownames of the object passed to annotation_col have to match the colnames of the object being clustered (here, assay(ntd))

ADD COMMENT
0
Entering edit mode

Amazing! Both of those worked like a charm. I apologize, I didn't realize I forgot to add a couple lines of regarding [select,] but you figured it out. I was able to mesh the two so the plots aren't massive. Thanks so much for taking the time to help me! I really really appreciate the help Kevin! Thanks!!!

ADD REPLY
0
Entering edit mode

No problem Sir

ADD REPLY
0
Entering edit mode

If colData(dds) takes a while to process, you're better off storing it in a variable before use, no? Why call the accessor multiple times if any computation is involved?

ADD REPLY
0
Entering edit mode

The CPU time to process colData() is negligible, however, I have edited the original answer to tidy the coding.

ADD REPLY

Login before adding your answer.

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