Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Simplify plotting #1109

Closed
wants to merge 3 commits into from
Closed

Conversation

ivirshup
Copy link
Member

@flying-sheep This is generally the kind of simplification I was hoping we could do with plotting.
It's not much, and is more about the dotplot, heatmap, etc. plotting methods. Also, the test errors I was running into are still happening.

Another example would using a function to choose representations of X the same way for each function. Something like:

def _choose_obs_rep(adata, *, use_raw=False, layer=None, obsm=None, obsp=None):
     """
     Choose array aligned with obs annotation.
     """
     is_layer = layer is not None
     is_raw = use_raw is not False
     is_obsm = obsm is not None
     is_obsp = obsp is not None
     choices_made = sum((is_layer, is_raw, is_obsm, is_obsp))
     assert choices_made <= 1
     if choices_made == 0:
         return adata.X
     elif is_layer:
         return adata.layers[layer]
     elif use_raw:
         return adata.raw.X
     elif is_obsm:
         return adata.obsm[obsm]
     elif is_obsp:
         return adata.obsp[obsp]
     else:
         assert False, (
             "That was unexpected. Please report this bug at:\n\n\t"
             " https://github.com/theislab/scanpy/issues"
         )

@flying-sheep
Copy link
Member

flying-sheep commented Mar 17, 2020

Closing in favor of #1116, where I integrated the commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants