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 .