question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Determining cluster order for colouring

See original GitHub issue

Hey!

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:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
GBeattiecommented, Nov 11, 2019

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!

1reaction
VolkerBergencommented, Nov 11, 2019

You can access the ordered cluster labels and corresponding color codes with adata.obs['ClusterName'].cat.categories and adata.uns['ClusterName_colors'], assuming that you have the clusters stored in adata.obs['ClusterName'].

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found