So I was struggling with this: Creating a dendrogram with a large dataset (20,000 by 20,000 gene-gene correlation matrix): https://www.biostars.org/p/477332

Now I think I found a good solution, taking a "meaningful" sample of the dataset, and then create a dendrogram-heatmap of the gene-gene correlation matrix generated from the sample.

I have got this far:

    cluster3.seurat.obj <- CreateSeuratObject(counts = cluster3.raw.data, project = "cluster3", min.cells = 3, min.features = 200)
    
    cluster3.seurat.obj <- NormalizeData(cluster3.seurat.obj, normalization.method = "LogNormalize", scale.factor = 10000)
    cluster3.seurat.obj <- FindVariableFeatures(cluster3.seurat.obj, selection.method = "vst", nfeatures = 2000)

Now I am wondering, how do I extract a data frame or matrix of this Seurat object with the built in function or would I have to do it in a "homemade"-R-way?

I'm hoping it's something as simple as doing this:

    cluster3.cells.variable.features <- as.matrix(GetAssayData(cluster3.seurat.obj, slot = "data")[, WhichCells(cluster3.seurat.obj)][, FetchData(cluster3.seurat.obj, var.features)])

I was playing around with it, but couldn't get it...

Any help would be appreciated.

Very Respectfully,
Pratik
You just want a matrix of counts of the variable features? 

    var_genes <- VariableFeatures(cluster3.seurat.obj)
    seurat_df <- GetAssayData(cluster3.seurat.obj)[var_genes,]
