What kind of object does `scanpy.external.pp.magic` return?

Here is my adata after sc.external.pp.magic(adata):

AnnData object with n_obs × n_vars = 4980 × 17641
    obs: 'n_genes', 'percent_mito', 'n_counts', 'louvain'
    var: 'gene_symbols', 'feature_types', 'n_cells', 'highly_variable', 'means', 'dispersions', 'dispersions_norm'
    uns: 'hvg', 'log1p', 'louvain', 'louvain_colors', 'neighbors', 'pca', 'umap'
    obsm: 'X_pca', 'X_umap'
    varm: 'PCs'
    obsp: 'connectivities', 'distances'

It seemed that my adata was the same as itself before magic. We know that magic in seurat would return a new assay in a seurat object., so I wondered how to find the magicked results in my adata.

The results are stored in adata.X (overwrites what was there before), while the original anndata gets moved to adata.raw. I agree this is probably not an optimal design and the docstring could be more clear. Tagging @ivirshup

1 Like

@jiangpuxuan, would you be up for making a PR clarifying the docstring?

I would be glad for this work.

However, I am quite new to both Python and scanpy, so I am afraid of making mistakes in writing the PR.

No worries about that. I think this should just be a documentation fix, so I wouldn’t worry to much about code changes.

Out of interest, why are you using the magic method?

Because I found that TSCAN worked better with MAGIC_RNA , so I try to use magic in scanpy-scvelo pipeline.