Determining cluster order for colouring
See original GitHub issueHey!
I am attempting to visualise velocity on top of a seurat generated clusters, displayed as a UMAP, which has worked, however I am having difficulty syncing the colours between what I’ve made in Seurat, with the scvelo output.
My approach was to extract the colours from seurat, and use them as the palette variable (as below). However the clusters in the output are coloured in the wrong order (I imagine the order may have been lost when merging the loom files?). I’ve looked through my adata’s metadata but can’t find a cluster order that matches the output.
How do I extract the cluster order that scvelo uses for colouring so I can re-order my palette variable accordingly?
Thanks!
ident_colours = ['#F8766D','#E18A00','#BE9C00','#8CAB00','#24B700','#00BE70','#00C1AB','#00BBDA','#00ACFC','#8B93FF','#D575FE','#F962DD','#FF65AC']
scv.pl.velocity_embedding_stream(adata, basis = "X_umap_cell_embeddings", color = "ClusterName", palette = ident_colours)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Color palette extraction with K-means clustering
Build K-Means clustering model using Python from Scratch. Use your model to find dominant colors from UI mobile design screenshots.
Read more >Color Separation in an Image using KMeans Clustering using ...
Color Separation in an image is a process of separating colors in the image. This process is done through the KMeans Clustering Algorithm....
Read more >Step 2: Initial clustering
The color clustering in recolorize usually starts with an initial ... We can identify green, red, blue, black, and white pixels in both...
Read more >Cluster Color-Magnitude Diagrams and the Age of Stars
47 Tuc M45
Star Number Magnitude Color (B‑V) Star Number Magnitude Color (B‑V)
10012 19.6 0.76 133 14.4 1.28
10170 20.6 0.98 165 7.6 0.12
Read more >Complete-Link Cluster Analysis by Graph Coloring - JSTOR
Determine the most "natural" number of clusters. Similarity or dissimilarity between ... color -1) of the vertices in reverse order of their coloring....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorted! Somewhere in the processing seurat’s ordering has been changed, just had to manually reorder the colours to match. Thank you for the assistance!
You can access the ordered cluster labels and corresponding color codes with
adata.obs['ClusterName'].cat.categories
andadata.uns['ClusterName_colors']
, assuming that you have the clusters stored inadata.obs['ClusterName']
.