Error plotting the markers in sc.pl.rank_genes_groups_dotplot
Hello everyone
I have spatial transcriptome data which was processed in seurat package and saved as loom format for the downstream anaylysis in scanpy. Everything works fine until marker analysis. For the dot plot visiulization, using sc.pl.rank_genes_groups_dotplot in python but it gives error :
adata = sc.read_loom('b_SCT.loom')
#Section 1
adata.var_names_make_unique()
adata.obs['integrated_snn_res.0.3']=adata.obs['integrated_snn_res.0.3'].astype('category')
sc.settings.set_figure_params(dpi = 80)
sc.tl.rank_genes_groups(adata, 'integrated_snn_res.0.3', method='t-test', key_added = "t-test")
sc.pl.rank_genes_groups(adata, n_genes=25, sharey=False, key = "t-test")
sc.settings.set_figure_params(dpi = 80)
sc.tl.rank_genes_groups(adata, 'integrated_snn_res.0.3', method='wilcoxon', key_added = "wilcoxon")
sc.pl.rank_genes_groups(adata, n_genes=25, sharey=False, key="wilcoxon")
sc.pl.rank_genes_groups_dotplot(adata, n_genes=5, key="wilcoxon", groupby="integrated_snn_res.0.3")
TypeError: sequence item 0: expected str instance, int found
I would appreciate all the suggestion to fix this issue.
Thanks in advance
• 1,322 views
•
link
1 answer
If anyone comes on this issue, the reason is that cluster categories are integers and sc.pl.rank_genes_groups_dotplot is doing a join on labels at some point which obviously crash.
adata.obs['integrated_snn_res.0.3'] = adata.obs['integrated_snn_res.0.3'].astype(str).astype("category")
sc.tl.rank_genes_groups(adata, 'integrated_snn_res.0.3', method='t-test', key_added = "t-test")
sc.pl.rank_genes_groups_dotplot(adata, n_genes=5, key="wilcoxon", groupby="integrated_snn_res.0.3")
adata.obs['integrated_snn_res.0.3'] = adata.obs['integrated_snn_res.0.3'].astype(int).astype("category")
• 0 views
•
link
Log in to answer this question.