Skip to content

Highlighting key genes in matrixplot/heatmap #1235

Closed

Description

@prabhakaranm

Is there way to highlight key genes in the sc.pl.heatmap or sc.pl.matrixplot instead of producing overlapping tick labels when plotting a huge number of genes say 1000? Could we obtain the axes and set tick labels to invisible for specific index?

I understand one way is to expand the figure size but what if only genes of interest could be highlighted alongside showing there are more genes expressed in a particular group.

In R, complexheatmap tool there is this function anno_mark() for this purpose. So looking for something similar.
Thanks

Activity

  1. fidelram commented on May 20, 2020

    @fidelram
    Collaborator

    In principle you can get the 'ax' and set the new labels. But there is a problem with this that I need to fix first.

  2. fidelram commented on Jun 25, 2020

    @fidelram
    Collaborator

    I just made an update in the PR #1210 that will solve the issue. Now you can do:

    adata = sc.datasets.pbmc68k_reduced()
    # make a heatmap with all the 765 genes in the dataset, highlight each 50th gene
    ax_dict = sc.pl.heatmap(adata, adata.var_names, groupby='louvain', show=False, show_gene_labels=True, figsize=(7,4))
    ax_dict['heatmap_ax'].set_xticks(range(len(adata.var_names))[::50])
    ax_dict['heatmap_ax'].set_xticklabels(adata.var_names[::50])               

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions