theislab / cellrank

CellRank: dynamics from multi-view single-cell data
https://cellrank.org
BSD 3-Clause "New" or "Revised" License
347 stars 46 forks source link

plot with different gene labels #581

Closed dawe closed 3 years ago

dawe commented 3 years ago

I have AnnData var names as EnsID, there's a adata.var['Symbol'] column for readability. It would be useful if alternate gene labels could then be passed to cr.pl functions, in particular cr.pl.heatmap() but also cr.pl.gene_trends()

Marius1311 commented 3 years ago

Hi @dawe, do you know how this is solved in scanpy? Would be nice if we can use a similar solution here.

dawe commented 3 years ago

AFAIK if a list of names other than adata.var_names is given to sc.pl.heatmap , you need to specify the column in adata.var that stores the values of the given list through the argument gene_symbols. So, to have symbols one has to call sc.pl.heatmap(adata, ['gs1', 'gs2',…], gene_symbols='Symbol') assuming adata.var has a column Symbol. I find scanpy solution a bit counterintuitive, IMHO a easier solution would be to call heamtap with actual var_names and let the plot function to get the appropriate names from the specified column: sc.pl.heatmap(adata, ['ens1', 'ens2',…], gene_symbols='Symbol'). If I have multiple columns I want to use for names in different plots I only have to change the key, whereas the current implementations forces me to pass a different list for each plot.

Marius1311 commented 3 years ago

@michalk8, could you draft an implementation for this?

Marius1311 commented 3 years ago

Hi @michalk8, what's the status here?

Marius1311 commented 3 years ago

@michalk8, any progress on this yet?

michalk8 commented 3 years ago

Currently, this is not on my priority list.

Marius1311 commented 3 years ago

@michalk8, let's either close this (can add to release schedule for a later release if important) or add to 1.5, I leave this to you.

michalk8 commented 3 years ago

@michalk8, let's either close this (can add to release schedule for a later release if important) or add to 1.5, I leave this to you.

I have context manager implemented in squidpy which switches between gene symbols stored elsewhere in adata.var, so I think I can just rehash that (as long as it's fine I make the gene symbols unique if they are not unique, otherwise, the implementatin is a bit problematic [we store the fitted models in a dict of dics, <lineage>: <gene>: ...]).

Marius1311 commented 3 years ago

That sounds like a good solution, let's go for that.

michalk8 commented 3 years ago

closed via #726 (parameter name is gene_symbols)