lazappi / clustree

Visualise Clusterings at Different Resolutions
https://lazappi.github.io/clustree/
GNU General Public License v3.0
215 stars 15 forks source link

Clustree not accurate #89

Closed koksalburak closed 1 year ago

koksalburak commented 1 year ago

Hi,

I am using the clustree algorithm for clustering analysis, however, the results I am getting are not accurate and look very complex. When I select a resolution such as 0.25 and run the UMAP, the resulting clustering is vastly different from the suggested one, with only 16 clusters instead of 70+.

What should I do to resolve this issue? Thank you very much!

Clustree_Result.pdf

lazappi commented 1 year ago

Please provide the code you have used (and possibly a data.frame with the cluster labels if you can share that). Without that I can't tell if there might be a mistake somewhere or a problem in the function.

koksalburak commented 1 year ago

Here's the code that I used for the clustree. It works perfectly fine for my second object, but this one is problematic even though I use the same code for QC and data integration.

resolution.range <- seq (from = 0, to = 0.5, by = 0.015)
integrated_object <- FindNeighbors (integrated_object, dims = 1:50)
integrated_object <- FindClusters  (integrated_object, resolution = resolution.range, dims.use = 1:50)
pdf ("integrated_object_clustree.pdf", width = 15, height = 25)
clustree (integrated_object, prefix = "integrated_snn_res.")
dev.off  ()
lazappi commented 1 year ago

Have you looked at the columns in the object (does integrated_object[["integrated_snn_res.0.25"]] contain 70 clusters or 16)?

I can't think of a reason why clustree() would show a different number of clusters to what is in the object so it seems more likely something has been mixed up somewhere.

koksalburak commented 1 year ago

I've just checked it out, it has 70 clusters there. You're right, most probably something has been mixed up before clustree.

Okay it was my fault. I wrote

integrated_object <- FindNeighbors (integrated_object, dims = 50)

instead of

integrated_object <- FindNeighbors (integrated_object, dims = 1:50) Thank you so much for your help!