Skip to content

Dotplot color annotation #2194

Open

Description

@Hrovatin
  • [ x] Additional function parameters / changed functionality / changed defaults?
  • New analysis tool: A simple analysis tool you have been using and are missing in sc.tools?
  • [ x] New plotting function: A kind of plot you would like to seein sc.pl?
  • External tools: Do you know an existing package that should go into sc.external.*?
  • Other?

Add color annotation to dotplot, e.g. same as row_colors and col_colors in seaborn heatmap.

Activity

  1. ivirshup commented on Mar 29, 2022

    @ivirshup
    Member

    Sounds reasonable. Could be like how add_labels or add_dendrogram works currently?

  2. Hrovatin commented on Mar 29, 2022

    @Hrovatin
    ContributorAuthor

    Maybe like add_totals?

  3. Hrovatin commented on Apr 1, 2022

    @Hrovatin
    ContributorAuthor

    @ivirshup Do you have an idea how this could be implemented - I am not even sure about the fig structure of the current dotplot and had problems finding the right plotting function

  4. ivirshup commented on Apr 5, 2022

    @ivirshup
    Member

    I think these plots are well overdue for a refactor.

    It would make sense to me if the kind of marginal plots were abstracted out into their own classes. Maybe like MarginalBar, MarginalDendrogram, MarginalLabels.

    But if you have any thoughts about how you think it could be done, or want to talk it over I'd be happy to do that.

  5. stephenkraemer commented on Jun 1, 2022

    @stephenkraemer

    I just saw on zulip that some of the functions in codaplot could be helpful here, sorry for the late reply. I'll post some more details on what is available in the package here tomorrow :)

  6. stephenkraemer commented on Jun 2, 2022

    @stephenkraemer

    From what I can gather, one goal here is to refactor the dotplot function and give it a complex heatmap layout, with a central heatmap using circle patches with a color and size aesthetic (= the dotplot) and one or more annotation heatmaps for rows and columns, which could be categorical or quantitative each.

    Potentially relevant features in codaplot are

    • co.cross_plot is one high level possibility to construct complex heatmaps with the 'central data heatmap + annotation heatmaps' layout. Among other things, it can automatically cluster columns or rows based on the central data heatmap and apply the clustering to the annotation heatmaps. It can also plot dendrograms. This is an experimental function with some quirks, I did want to improve the concept soon-ish.

    • co.heatmap is the base heatmap plotting function in codaplot. It provides a simple way to plot categorical heatmaps and add spacers within heatmaps. Both tasks are not trivial with matplotlib base plot functions. This would be helpful for adding categorical annotation heatmaps, even if you don't want to use co.cross_plot as it is right now.

    • i have an alternative function to co.heatmap in my snippets library which is capable of creating heatmaps using rectangle or circle patches with size and color aesthetics, but i havent added it to codaplot yet. You can always create circle patch heatmaps with standard scatterplots, but this has drawbacks when you want to be able to add spacers within the plot or when you want full control of the circle patch sizes (so that they fit perfectly within the row at maximum size). From what I understand such a patch based function would be helpful, right?

      I would be happy to contribute some base functionality for this issue by adding improvements to codaplot, ie provide the circle patch heatmap function and a better complex heatmap function than the currently available co.cross_plot. I do plan on maintaining codaplot for the foreseeable future and have been using it for my own projects for quite a while now. At the moment it's a relatively small library (when you subtract the experimental modules) and could be quickly refactored into a single scanpy module if something happens and I find myself unable to maintain and expand the library over the next years.

    Does using codaplot for this issue sound at all interesting to you?

  7. Hrovatin commented on Jun 2, 2022

    @Hrovatin
    ContributorAuthor

    For me sounds interesting, especially if you add circle pathes. But I guess @ivirshup should say if this should be added as scanpy dependency potentially.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions