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

mudata object is updated after wrong selection of modality #31

Closed
bio-la opened this issue Dec 9, 2022 · 1 comment
Closed

mudata object is updated after wrong selection of modality #31

bio-la opened this issue Dec 9, 2022 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@bio-la
Copy link

bio-la commented Dec 9, 2022

Hi!
I noticed a bug when selecting a subset of genes in all layers of a mudata object created with the axes=-1 convention.
The subsetting works fine, but if i try to select one modality in the selected feature subset, it's not working ( i will open a functionality request too)
However after this error i can't subset the mudata object again - something gets updated in the object that prevents the normal functionality.
minimal example below.
thanks!

import scanpy as sc
import mudata as md
from mudata import MuData

import anndata as ad
import numpy as np
import pandas as pd
import warnings 
warnings.simplefilter(action='ignore', category=FutureWarning)

np.random.seed(1979)

import mudatasets as mds
mds.list_datasets()
mds.info('pbmc5k_citeseq')
pbmc5k=mds.load('pbmc5k_citeseq',files=['filtered_feature_bc_matrix.h5'])
pbmc5k
rna_raw = pbmc5k["rna"].copy()
rna_raw.var_names_make_unique()
rna_a = rna_raw[np.sort(np.random.choice(np.arange(300), 300, replace=False)),:].copy()

rna_b = rna_raw[np.sort(np.random.choice(np.arange(700), 500, replace=False)),:].copy()

mdata = MuData({"raw": rna_raw, "preproc_1": rna_a, "preproc_2": rna_b}, axis=-1)
mdata[:,mdata.var_names.str.startswith("MT-")]
mdata[:,mdata.var_names.str.startswith("MT-")]["preproc_1"]
mdata[:,mdata.var_names.str.startswith("MT-")]
@bio-la bio-la added the bug Something isn't working label Dec 9, 2022
@gtca gtca added this to the 0.2.2 milestone Jan 8, 2023
@gtca
Copy link
Collaborator

gtca commented May 26, 2023

I believe this is fixed together with #32 by 359d198.

@gtca gtca closed this as completed May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants