Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument to reverse tree #59

Open
lazappi opened this issue Aug 5, 2020 · 1 comment
Open

Add argument to reverse tree #59

lazappi opened this issue Aug 5, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@lazappi
Copy link
Owner

lazappi commented Aug 5, 2020

Currently clustree() and clustree_overlay() assume that higher values of the resolution variable will result in more clusters but this is not always the case and sometimes the reverse is true. For example:

image

We can reverse the appearance of the arrows by setting the edge_arrow_ends argument but this only changes the plot, not how things like the in proportion are calculated. The new argument should completely reverse the order of resolutions. This should be relatively simple to do by making sure sorting in done in the opposite order when required.

@lazappi lazappi added the enhancement New feature or request label Aug 5, 2020
@lazappi lazappi added this to New features in clustree v1.0.0 Dec 28, 2020
@NadineBestard
Copy link

If someone is looking for a workaround for this, waiting for the enhancement, here I suggest one that worked for me:

# save resolutions of interest with labels in decreasing order 
# now these new numbers will be used to compute the tree
sce$cluster_sorted_0 <- sce$cluster_k150
sce$cluster_sorted_1 <- sce$cluster_k120
sce$cluster_sorted_2 <- sce$cluster_k100
sce$cluster_sorted_3 <- sce$cluster_k80

# reassign each label to original value when plotting
tree_reverse <- clustree(sce, prefix = "cluster_sorted_") +
  scale_color_discrete(name="cluster_k", labels=c("150","120","100","80"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
clustree v1.0.0
New features
Development

No branches or pull requests

2 participants