0

Does anybody know how to create a dendrogram for an integrated Seurat object. I can do it for a non-integrated object, but when I try:

immune.combined <- BuildClusterTree(object = immune.combined, slot = "data")

I see the error:

Error in hclust(d = data.dist) : NA/NaN/Inf in foreign function call (arg 10)
Matt
  • 7,255
  • 2
  • 12
  • 34
4DtyU
  • 1
  • 1
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 13 '20 at 22:19
  • I can't share my own data, but a reproducible example can be found https://satijalab.org/seurat/v3.1/immune_alignment.html as a SatijaLab vignette. Analysis can be reproduced by running the code listed in the vignette through the "Perform an integrated analysis", so that the 'immune.combined' object has been formed. Then run: immune.combined <- BuildClusterTree(object = immune.combined, slot = "data") – 4DtyU Jul 14 '20 at 14:50

1 Answers1

0

If you followed the normal Seurat workflow, at some point you will have changed the default assay to "RNA". Looking at the source for BuildClusterTree, it uses the most variable features from the chosen assay (var.features in the Large Seurat object under your chosen assay). For the integrated workflow, you only calculated these values for the "integrated" assay, not the RNA assay. You therefore need to do the analysis on the integrated assay. That would imply something like this:

sampleIntegrated <- BuildClusterTree(sampleIntegrated,assay="integrated")

For some reason that does not work, and the same error is produced. If you first explicitly set the default assay to integrated, however, it works:

DefaultAssay(sampleIntegrated) <- "integrated"
sampleIntegrated <- BuildClusterTree(sampleIntegrated,assay="integrated")

You can then use your visualization method of choice. For example, using the ggtree package and Tool from Seurat:

library(ggtree)
myPhyTree <- Tool(object=sampleIntegrated, slot = "BuildClusterTree")
ggtree(myPhyTree)+geom_tiplab()+theme_tree()+xlim(NA,400)