Comments (2)
Just found that it was implemented in Palo
from conos.
graph_cl <- sccore::getClusterGraph(con_v1$graph, groups=ann_by_level$annotation$l6, method="paga")
nns_per_clust <- as.matrix(graph_cl) %>% apply(1, order, decreasing=T) #%>% .[1:2,]
sims_per_clust <- 1:ncol(nns_per_clust) %>% lapply(function(i) graph_cl[nns_per_clust[, i], i]) %>%
setNames(colnames(nns_per_clust)) %>% lapply(function(x) x[x > 0])
color_set <- (RColorBrewer::brewer.pal(9, "Set1") %>% colorRampPalette())(100)
color_set_dists <- col2rgb(color_set) %>% apply(2, convertColor, "sRGB", "Lab") %>% t() %>%
dist(method="minkowski", p=1) %>% as.matrix() %>% set_rownames(color_set) %>% set_colnames(color_set)
cl_colors <- rep(NA, length(sims_per_clust)) %>% setNames(names(sims_per_clust)) %>%
factor(levels=color_set)
col_queue <- names(cl_colors)[1]
while(length(col_queue) > 0) {
n <- col_queue[1]
# n
cur.sims <- sims_per_clust[[n]]
cur.neighbs <- names(cur.sims)
col_queue <- c(col_queue[-1], cur.neighbs[is.na(cl_colors[cur.neighbs])] %>% .[!(.%in% col_queue[-1])])
if (all(is.na(cl_colors[cur.neighbs]))) {
cl_colors[[n]] <- table(cl_colors) %>% which.max() %>% names()
next
}
cur.assigned.neighbs <- cl_colors[cur.neighbs] %>% .[!is.na(.)]
cl_colors[[n]] <- apply(color_set_dists[cur.assigned.neighbs,,drop=F] * cur.sims[names(cur.assigned.neighbs)], 2, median) %>%
which.max() %>% names()
}
cl_colors %<>% as.character() %>% setNames(names(cl_colors))
Works somehow, but needs penalty for assigning distant clusters to exactly the same color
from conos.
Related Issues (20)
- Passing Leiden or Walktrap clusters to plotDEheatmap HOT 5
- Redundant Suggests after transfer to sccore HOT 1
- Wrong legend while using custom palette HOT 3
- Downsample from each cluster HOT 3
- Cell subsetting error HOT 4
- docker build fails HOT 1
- 'adjustedRand not in load table' HOT 6
- conos install error igraph.so not found HOT 16
- getDifferentialGenes for selected groups? HOT 6
- shared NN variant of $buildGraph HOT 5
- findSubcommunities HOT 7
- Rstudio session crash when making Conos object (LeidenAlg cluster estimation) HOT 11
- Running Conos functions across multiple nodes/computers HOT 1
- How to get predicted cell types? HOT 2
- why I can't find the "velocityInfoConos" function in conos(v1.4.6)? HOT 5
- largeVis embedding does not utilize n.cores argument HOT 5
- Feeding output from getPerCellTypeDE into Heatmap HOT 2
- Integration of multi-modal data based on a joint space
- Prepare for upcoming Seurat v5 release HOT 1
- Attaching metadata from Seurat Objects HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conos.