You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simpler gene annotations in plotting functions #646
We typically have some marker information in the form of an Excel sheet, pandas DataFrame, and eventually a Python dictionary. Using these as gene annotations in various plotting functions (not pl.rank_genes_groups_* family but the others) is a very common task and it looks awesome thanks to @fidelram's var_group_* parameters.
It would be even more fantastic to be able to pass simple dict (e.g. the ones we already use in Malte's marker_gene_overlap) to plotting functions where var_group_positions and var_group_labels are populated automatically.
One caveat is that there might be genes covered by multiple keys, but this is similar to supplying overlapping var_group_positions in current api, which can exit with an error.
I already have a function for that but it's absolutely super ugly. I can send a PR after tidying it up, but if anyone else wants to do it, it's perfectly fine.
Cool... I haven't used the new plots yet. Looks very handy. Your wrapper is an automated use of var_group_X to label marker genes of particular clusters in these plots?
I should dig on a function that I have somewhere that translates a dict into the proper input for the plotting functions. This is a use case that I frequently find.
I think that a good solution would be to check if the var names is a dict, in which case the var_labels and var_positions are automatically set. Or do you have any other idea? I don’t know if this will make the documentation too complicated.
At the moment I am travelling, but next week I can look into this.
I know this is a bit specific, but the current sc.pl.rank_genes_groups() and sc.pl.rank_genes_groups_violin() have a 'gene_symbols' argument to allow display based on other columns in .var. For example, if I have this in Var:
Var columns:
gene_symbol
index
ENSMUSG00000000001 Gnai3
ENSMUSG00000000028 Cdc45
ENSMUSG00000000031 H19
ENSMUSG00000000037 Scml2
ENSMUSG00000000049 Apoh
I can just pass 'gene_symbol' as the column I want to be used for any/all displays instead of the ensembl ID all the time. It would be great if something like this were consistently available anywhere gene labels were needed in the plotting functions. Perhaps the common argument would be better called 'display_label' or something like that instead.
Cool... I haven't used the new plots yet. Looks very handy. Your wrapper is an automated use of var_group_X to label marker genes of particular clusters in these plots?
Activity
LuckyMD commentedon May 15, 2019
I do this all the time as well. Could you enlighten me as to the
var_group_*you are talking about? That sounds like it could be very helpful for me.gokceneraslan commentedon May 15, 2019
https://scanpy-tutorials.readthedocs.io/en/latest/visualizing-marker-genes.html#Stacked-violins
What I'm talking about is actually literature-driven marker equivalent of rank_genes_groups plots.
LuckyMD commentedon May 15, 2019
Cool... I haven't used the new plots yet. Looks very handy. Your wrapper is an automated use of
var_group_Xto label marker genes of particular clusters in these plots?fidelram commentedon May 15, 2019
jorvis commentedon May 16, 2019
I know this is a bit specific, but the current sc.pl.rank_genes_groups() and sc.pl.rank_genes_groups_violin() have a 'gene_symbols' argument to allow display based on other columns in .var. For example, if I have this in Var:
I can just pass 'gene_symbol' as the column I want to be used for any/all displays instead of the ensembl ID all the time. It would be great if something like this were consistently available anywhere gene labels were needed in the plotting functions. Perhaps the common argument would be better called 'display_label' or something like that instead.
LuckyMD commentedon May 16, 2019
I think
gene_symbolsis pretty widely spread by now, no? It's not everywhere yet, but I've seen it in a bunch of plotting functions recently.jorvis commentedon May 16, 2019
Quite possibly, I need to look. Just updated from 1.3.x to 1.4.3 this week.
gokceneraslan commentedon May 19, 2019
Just to clarify what I meant, current API:
My suggestion:
It's ok to keep var_group_* parameters I think, for backward compatibility.
Merge pull request #661 from fidelram/dict_param_to_plots
Merge pull request scverse#661 from fidelram/dict_param_to_plots