Question: DESeq2 pheatmap returns Error in check.length("fill") : 'gpar' element 'fill' must not be length 0
0
gravatar for williamsbrian5064
10 months ago by
williamsbrian5064170 wrote:

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 • 985 views
ADD COMMENTlink modified 10 months ago • written 10 months ago by williamsbrian5064170

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 REPLYlink modified 10 months ago • written 10 months ago by RamRS21k

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 REPLYlink written 10 months ago by williamsbrian5064170
6
gravatar for Kevin Blighe
10 months ago by
Kevin Blighe43k
Republic of Ireland
Kevin Blighe43k wrote:

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 COMMENTlink modified 4 months ago • written 10 months ago by Kevin Blighe43k

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 REPLYlink written 10 months ago by williamsbrian5064170

No problem Sir

ADD REPLYlink written 10 months ago by Kevin Blighe43k

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 REPLYlink written 10 months ago by RamRS21k

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

ADD REPLYlink modified 4 months ago • written 10 months ago by Kevin Blighe43k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1922 users visited in the last hour