broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
557 stars 164 forks source link

group color change? #482

Open Levin928 opened 1 year ago

Levin928 commented 1 year ago

Dear Professor, May I know how to change the color of the observations/references in the output figure? Thank you very much!

GeorgescuC commented 1 year ago

Hi @Levin928 ,

Which colors are you interested in changing? For the heatmap's colors you can provide a custom_color_palette option when calling plot_cnv() in the format color.palette(c("darkblue", "white", "darkred"), c(2, 2)). There is also a color_safe_palette option you can set to TRUE to use a provided color blindness safe palette.

For the colors of chromosomes and groups of cells on the sides of the heatmap, you would need to change the internal infercnv:::get_group_color_palette() method defined at the very top of R/inferCNV_heatmap.R to return a different palette function.

Regards, Christophe.

Levin928 commented 1 year ago

Thank you for your reply. In fact, I want to change the color of grouped cells in observations (highlighted in the attached figure).

Thanks again!

发件人: GeorgescuC @.> 发送时间: 2022年11月30日星期三 上午2:02 收件人: broadinstitute/infercnv @.> 抄送: Levin928 @.>; Mention @.> 主题: Re: [broadinstitute/infercnv] group color change? (Issue #482)

Hi @Levin928 https://github.com/Levin928 ,

Which colors are you interested in changing? For the heatmap's colors you can provide a custom_color_palette option when calling plot_cnv() in the format color.palette(c("darkblue", "white", "darkred"), c(2, 2)). There is also a color_safe_palette option you can set to TRUE to use a provided color blindness safe palette.

For the colors of chromosomes and groups of cells on the sides of the heatmap, you would need to change the internal infercnv:::get_group_color_palette() method defined at the very top of R/inferCNV_heatmap.R to return a different palette function.

Regards, Christophe.

― Reply to this email directly, view it on GitHub https://github.com/broadinstitute/infercnv/issues/482#issuecomment-13310805 10 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AU37OZZIOGL4DONOZ4ESYLTWK ZAJTANCNFSM6AAAAAASOVXXFY . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AU37OZ4HRP5AAJPMMRL5ZJ3WKZAJTA5CNFS M6AAAAAASOVXXF2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS PK2WT4.gif Message ID: @. @.> >

GeorgescuC commented 1 year ago

Hi @Levin928 ,

I cannot find any attached figure. There is no direct way to modify the colors used for the 2 colors bars on the left side of the observation heatmap through options, but you can either replace the internal method that generates those colors, or download the source code and make some small changes. The colors are controlled by the variable row_groupings defined in the internal method infercnv:::.plot_cnv_observations(), and generated by the internal method call of infercnv:::get_group_color_palette()(n), with n being the number of colors needed (1 per annotation/group).

You can:

Regards, Christophe.

Levin928 commented 1 year ago

OK, Thank you for your answer! ^_^

发件人: GeorgescuC @.> 发送时间: 2022年12月1日星期四 下午12:15 收件人: broadinstitute/infercnv @.> 抄送: Levin928 @.>; Mention @.> 主题: Re: [broadinstitute/infercnv] group color change? (Issue #482)

Hi @Levin928 https://github.com/Levin928 ,

I cannot find any attached figure. There is no direct way to modify the colors used for the 2 colors bars on the left side of the observation heatmap through options, but you can either replace the internal method that generates those colors, or download the source code and make some small changes. The colors are controlled by the variable row_groupings defined in the internal method infercnv:::.plot_cnv_observations(), and generated by the internal method call of infercnv:::get_group_color_palette()(n), with n being the number of colors needed (1 per annotation/group).

You can:

get_group_color_palette <- function(){ return(colorRampPalette(RColorBrewer::brewer.pal(12,"Set3"))) }

Regards, Christophe.

― Reply to this email directly, view it on GitHub https://github.com/broadinstitute/infercnv/issues/482#issuecomment-13331445 42 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AU37OZ3RPAJOIDIG4DGFPCLWL AQ5DANCNFSM6AAAAAASOVXXFY . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AU37OZ3HLITR7LHWHINWMI3WLAQ5DA5CNFS M6AAAAAASOVXXF2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS POYV54.gif Message ID: @. @.> >