Skip to content

I keep getting error when running spatialdm_local AttributeError: 'NoneType' object has no attribute 'to_adata' #28

@smk5g5

Description

@smk5g5

Hi,

I followed the spatial dm example but I keep getting errors when running spatialdm_local.
Below is the code I am running.

start = time.time()
sdm.spatialdm_local(adata, n_perm=1000, method='both', specified_ind=None, nproc=1)     # local spot selection
sdm.sig_spots(adata, method='permutation', fdr=False, threshold=0.1)     # significant local spots
print("%.3f seconds" %(time.time()-start))

And here is the error I am getting.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[47], line 2
      1 start = time.time()
----> 2 sdm.spatialdm_local(adata, n_perm=1000, method='both', specified_ind=None, nproc=1)     # local spot selection
      3 sdm.sig_spots(adata, method='permutation', fdr=False, threshold=0.1)     # significant local spots
      4 print("%.3f seconds" %(time.time()-start))

File /n/data1/mgh/neuro/petti/lab/Users/khan.saad/Conda_envs/python_3.10/lib/python3.10/site-packages/spatialdm/main.py:275, in spatialdm_local(adata, n_perm, method, specified_ind, nproc, scale_X)
    273 ## different approaches
    274 with threadpool_limits(limits=nproc, user_api='blas'):
--> 275     spot_selection_matrix(adata, ligand, receptor, ind, n_perm, method, scale_X)

File /n/data1/mgh/neuro/petti/lab/Users/khan.saad/Conda_envs/python_3.10/lib/python3.10/site-packages/spatialdm/utils.py:179, in spot_selection_matrix(adata, ligand, receptor, ind, n_perm, method, scale_X)
    176 def spot_selection_matrix(adata, ligand, receptor, ind, n_perm, method, scale_X=True):
    177     # local variables (only live in this function scope)
    178     # normalize raw counts
--> 179     raw_norm = adata.raw.to_adata()
    180     raw_norm.X = csr_matrix([norm_max(X) for X in raw_norm.X.T]).T
    181     import scanpy as sc

AttributeError: 'NoneType' object has no attribute 'to_adata'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions