PMBio/mudatasets

mds.load("pbmc10k_multiome") does not add files to uns

Zethson opened this issue · 2 comments

Hey,

attempting to follow the https://muon-tutorials.readthedocs.io/en/latest/single-cell-rna-atac/pbmc10k/2-Chromatin-Accessibility-Processing.html tutorial. Instead of downloading the data manually & preprocessing it like in the tutorial chapter before, I am getting the data with mudatasets like:

mdata = mds.load("pbmc10k_multiome")

The MuData object then looks like (might already be some scanpy filtering here, but not important):

MuData object with n_obs × n_vars = 11909 × 144978
  var:	'feature_types', 'gene_ids', 'genome', 'interval'
  2 modalities
    rna:	11909 x 36601
      var:	'gene_ids', 'feature_types', 'genome', 'interval'
    atac:	10069 x 106086
      obs:	'n_genes_by_counts', 'total_counts', 'NS'
      var:	'gene_ids', 'feature_types', 'genome', 'interval', 'n_cells_by_counts', 'mean_counts', 'pct_dropout_by_counts', 'total_counts'

However, with ac.pl.fragment_histogram(atac, region='chr1:1-2000000') I then run into:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_404935/4071406051.py in <module>
----> 1 ac.pl.fragment_histogram(atac, region='chr1:1-2000000')

~/miniconda3/envs/bp2/lib/python3.9/site-packages/muon/_atac/plot.py in fragment_histogram(data, region, groupby, barcodes)
    339         raise TypeError("Expected AnnData or MuData object with 'atac' modality")
    340 
--> 341     fragment_path = adata.uns["files"]["fragments"]
    342     fragments = tools.fetch_regions_to_df(fragment_path=fragment_path, features=region)
    343 

~/miniconda3/envs/bp2/lib/python3.9/site-packages/anndata/compat/_overloaded_dict.py in __getitem__(self, key)
     98             return self.overloaded[key].get()
     99         else:
--> 100             return self.data[key]
    101 
    102     def __setitem__(self, key, value):

KeyError: 'files'

IMO this is either an issues with the served MuData object here or an unflexible implementation of fragment_histogram

What is the best solution here, @gtca ?

Thank you!

Oh wait, maybe I need one of with_info=True, full=True...

Yeah, that was indeed the issue. Sorry, me being naive :)