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

Make code that retrieves values from obs/X/layer/raw of the different modalities a public function #98

Open
grst opened this issue Mar 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@grst
Copy link
Contributor

grst commented Mar 29, 2023

Is your feature request related to a problem? Please describe.
In scirpy, I have a custom extension of "pl.embedding" that plots clonotype networks. Similar to the pl.embedding functions in muon and scanpy, nodes can be colored by either variables from obs, or by genes stored in X/raw/layers.

Muon provides a mechanism (which is currently somewhat broken, see #96) to retrieve values from either of the slots by specifying keys such as "gex:CD8A", "gex:sample", "patient" together with the parameters use_raw, and layer.

To achieve the same, I duplicated a lot of code from mu.pl.embedding into scirpy.

To avoid this, it would be helpful to have this as a public function in muon, e.g.

def get(
    mdata: MuData,
    variable: str,
    *,
    use_raw: bool = False,
    layer: Optional[str] = None
) -> pd.Series

Alternatives
Maybe this should even be a method in MuData?

MuData.get("gex:CD8A")

Additional context
With scirpy v0.13, scirpy introduces support for MuData. Previously everything was in a single AnnData object, therefore this wasn't a problem before.

@grst grst added the enhancement New feature or request label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant