alexyermanos / Platypus

R package for the analysis of single-cell immune repertoires
GNU General Public License v3.0
36 stars 16 forks source link

Changing colour scheme to analyze VDJ #41

Open zoqaiyum opened 1 year ago

zoqaiyum commented 1 year ago

Hello,

I have been able to change the colour scheme of plots for gene expression analysis. But I am unable to customize colours in the plots for VDJ repertoire analysis (for example the bar plots or the stacked bar plots). Could I please get some guidance on how to do this?

Many thanks!

tudorcotet commented 1 year ago

Hi,

Unfortunately, there are still some mismatches between different Platypus functions. As such, some allow you to input a custom color scheme as a named vector, while others do not. You cannot add a custom color scheme in the VDJ_clonal_expansion function yet, but we plan to change that and standardize the functions in the next update.

You can use the VDJ_clonal_expansion_abundances function instead, which outputs bar plots similar to VDJ_clonal_expansion and has a parameter for a custom color list. This function is a wrapper of the more general VDJ_abundances for counting feature occurrences and accounting for cells with an aberrant number of cells. For example, you can obtain expansion bar plots colored by isotype by calling:

colors <- c("IGHG1"="lightgreen",
            "IGHG2A"="green",
            "IGHG2B"="green3",
            "IGHG2C"="green4",
            "IGHG3"="darkgreen",
            "IGHM"="black",
            "IGHA"="red",
            "IGHD"="blue",
            "IGHE"="purple")

VDJ_clonal_expansion_abundances(VDJ,
                               features = 'VDJ_cgene',
                               max.clonotypes = 20,
                               count.level = 'absolute',
                               specific.feat.colors = colors)

Hope this solves your issue!

zoqaiyum commented 1 year ago

Hi @tudorcotet

This was helpful, however I do not see a grouping feature in VDJ_clonal_expansion_abundances. I want to see these abundances by a specific group (such as disease type) instead of individually for each patient. I looked at the specifics of VDJ_clonal_expansion_abundances using the help function, but unfortunately there is nothing along the lines of "group.by=" which is there when I run VDJ_Vgene_usage_stacked_barplot.

Would you have any suggestions?

Thanks in advance!