Leiden clustering gives me different results when I run it


I am analyzing some data using scanpy. I am following the following steps: QC, PCA, harmony integration, UMAP, leiden clustering, and finding the markers.
However, every time I run the whole notebook I get different amount of clusters for the same resolution at leiden clustering. How can I make sure that I get consistent results? The clusters do look similar.
Could the problem be at the harmony or leiden step?

Thank you

Hello! In my experience this was caused by the harmony results (Results not reproducible · Issue #24 · slowkow/harmonypy · GitHub). If I used the same harmony embeddings from a prior run, I obtained visually identical leiden and umap results. Hope that helps!