Question: topvariance genes from deseq2 output and heatmap
0
gravatar for krushnach80
2.2 years ago by
krushnach80610
krushnach80610 wrote:

I found this code i m not sure what it is doing

rld <- rlog(dds, blind=F)

topVarGenes <- order(-rowVars(assay(rld)))[0:500]
mat <- assay(rld)[ topVarGenes, ]
mat<- mat - rowMeans(mat)

what exactly it is doing , is this one order(-rowVars(assay(rld)))[0:500] if anyone could explain it ?

question update I want to keep the topVarGenes in the matrix and pass that to heatmap to plot the same but im getting this error

heatmap.2(assay(rld)[mat, ], scale="row", trace="none", dendrogram="column", margins=c(5, 10), col=colorRampPalette(rev(brewer.pal(9, "RdBu")))(255))

 Error in assay(rld)[mat,] : only 0's may be mixed with negative subscripts

how do i pass the mat and get the heatmap .

rna-seq R • 1.6k views
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by krushnach80610
2

I will post my comment on the update here:

you could try run

heatmap.2(mat, ...)

directly after

mat <- assay(rld)[ topVarGenes, ]
mat <- mat - rowMeans(mat)
ADD REPLYlink modified 2.2 years ago • written 2.2 years ago by e.rempel780

well yes i did that now i could run...i was making the mistake of running this heatmap.2(assay(rld)

ADD REPLYlink written 2.2 years ago by krushnach80610
5
gravatar for e.rempel
2.2 years ago by
e.rempel780
Germany, Heidelberg, COS
e.rempel780 wrote:

HI,

this line takes the top 500 genes with the highest variance. Per default, order is sorting in increasing order, thus the author of the code uses the minus sign (but she should have used just order(..., decreasing = T)

ADD COMMENTlink written 2.2 years ago by e.rempel780

the minus sign is for increasing order ,?

ADD REPLYlink written 2.2 years ago by krushnach80610

I understood the issue, now i have updated the question im not able to get through it ...any suggestion ?

ADD REPLYlink written 2.2 years ago by krushnach80610
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: 1807 users visited in the last hour