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

Two-argument feature and classic clustree labels #23

Closed
BioSok opened this issue Jan 22, 2019 · 5 comments
Closed

Two-argument feature and classic clustree labels #23

BioSok opened this issue Jan 22, 2019 · 5 comments

Comments

@BioSok
Copy link

BioSok commented Jan 22, 2019

Hi,
Great work on the package! I was wondering whether the following two features are available for the clusstree visualisation:

  1. Attach a two-argument function to a node characteristic. E.g. use node_alpha + node_alpha_aggr to have the transparency represent something like percentage of patients(one of the columns) in a cluster. This would need both cluster size and number of patients of the cluster.

  2. Can there be labels on the nodes on the classic visusalization (not the overlays)?

Thanks a lot in advance, once again the package is awesome.

@lazappi
Copy link
Owner

lazappi commented Jan 22, 2019

HI @BioSok

Glad you find clustree useful!

If I am understanding you correctly I think you can do 1. by writing the correct aggregation function. Here is an example using the iris data using the Species column instead of patients "setosa" as the class we are interested in (instead of patient samples):

library(clustree)

pct_setosa <- function(x) {
    sum(x == "setosa") / length(x)
}

clustree(iris_clusts, prefix = "K", node_alpha = "Species",
         node_alpha_aggr = "pct_setosa")

This will set the node alpha to the percentage of samples in each cluster that have Species equal to "setosa". Is that similar to what you want?

For 2. it should be possible to add labels, what kind of information would you want to put on them? The nodes already have cluster labels so I assume you want to add something else?

@BioSok
Copy link
Author

BioSok commented Jan 24, 2019

Hi @lazappi,

Thanks for your fast reply.

Indeed your suggestion for 1. worked (I should have thought it myself). I guess I also wanted to know whether I can utilise data from two columns in the aggregation function.

As for 2., indeed I was wondering whether I can add(or replace) a label other than the cluster identity.

@lazappi
Copy link
Owner

lazappi commented Jan 24, 2019

Glad that option worked for question 1! You are right that at the moment it's only possible to use a single variable for the aggregation but that might be something that's worth looking into.

I'll have a look at making it possible to customise the node labels. I'm hoping to have a new clustree release in the next couple of weeks so I might be able to have it ready for that.

@BioSok
Copy link
Author

BioSok commented Jan 29, 2019

Thanks for your time, that would be really useful!

@lazappi
Copy link
Owner

lazappi commented Feb 17, 2019

I have added an option for additional custom node labels in 7e444c6. You can install that version from GitHub now or it will be in the next CRAN release, hopefully soon.

I want to make it possible to use multiple metadata columns for aesthetics but I think the best way to do that will require a fairly significant rewrite and change to the interface and I don't quite have the time to do that at the moment. I have opened an issue here (#26) with some of my ideas about how that could work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants