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

How to customise the X-axis order in heat_freq and color in chord_freq #151

Open
mainharryHR opened this issue May 9, 2024 · 5 comments

Comments

@mainharryHR
Copy link

mainharryHR commented May 9, 2024

Dear Liana team and users,
Thanks for great package for being easy to use.
After subsetting the data based on the conditions, I want to plot the heatmap with desired order of X-axis by using this code :
TcellNotrunc <- TcellNoAggregate %>% filter(aggregate_rank <= 0.01) TcellNotrunc$target <- factor(TcellNotrunc$target, levels = desired_order_of_categories) heat_freq(TcellNotrunc)

But it is not working. Any suggestions to customised the order of heatmap?

In chord_freq, it seems the colors are assigned differently between three conditions. How should we customise the color?

Many thanks
Harry

@mainharryHR mainharryHR changed the title X-axis order in heat_freq How to customise the X-axis order in heat_freq and color in chord_freq May 9, 2024
@dbdimitrov
Copy link
Collaborator

dbdimitrov commented May 14, 2024

Hi @mainharryHR,

Thanks for using it :)

Not 100% sure what your data looks like - is it a filtered dataframe to only one cell type? I assume there might be an issue if you have only one cell type?

Daniel

@mainharryHR
Copy link
Author

mainharryHR commented May 21, 2024

Hi @mainharryHR,

Thanks for using it :)

Not 100% sure what your data looks like - is it a filtered dataframe to only one cell type? I assume there might be an issue if you have only one cell type?

Daniel

Thank you for the reply. I have many cells types. How should I define the order of cell types on X-axix for heatmap? Cause I am not happy with the current order. Thanks.
Screenshot 2024-05-21 at 12 18 48

@dbdimitrov
Copy link
Collaborator

dbdimitrov commented May 21, 2024

Ahhh, I see. I believe ComplexHeatmap (what I use in the background) shoud allow you to order according to the categories (levels) of your cell types.

This might require that I change the function a bit - I can do that, but it will likely take me some time to get back to it.

Otherwise you could modify the function such that:

liana_heatmap <- function(mat,

you pass, labels (the preferred order of your cell types) to rowAnnotation and columnAnnotation, according to this issue:
jokergoo/ComplexHeatmap#296

@mainharryHR
Copy link
Author

mainharryHR commented May 21, 2024

Ahhh, I see. I believe ComplexHeatmap (what I use in the background) shoud allow you to order according to the categories (levels) of your cell types.

This might require that I change the function a bit - I can do that, but it will likely take me some time to get back to it.

Otherwise you could modify the function such that:

liana_heatmap <- function(mat,

you pass, labels (the preferred order of your cell types) to rowAnnotation and columnAnnotation, according to this issue: jokergoo/ComplexHeatmap#296

Great. Thank you for the advance. It seems several people have same issues. It might be good if you adjust the argument with this function (order of axis), it will be great. I am new for R, I am not very sure I can modify the function. :)

Have great day for the great package.

Best,
Harry

@mainharryHR
Copy link
Author

mainharryHR commented May 23, 2024

Dear Team,
I have been struggling again for the order. I am still not able to figure it out. Could someone to modify the following code? Many thanks.
`desired_order_of_categories <- c(
"B naïve", "B Memory", "IgG",
"IgA1", "IgA2","IgA3"
)

#BcellsCRCtrunc$target <- factor(BcellsCRCtrunc$target, levels = c("desired_order_of_categories"))

BcellsControltrunc <- BcellsControlAggregate %>%

filter(aggregate_rank <= 0.01) # note that these pvals are already corrected

heat_freq(BcellsControltrunc)`

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