BayraktarLab / cell2location

Comprehensive mapping of tissue cell architecture via integrated single cell and spatial transcriptomics (cell2location model)
https://cell2location.readthedocs.io/en/latest/
Apache License 2.0
324 stars 58 forks source link

Error running 'Estimate cell-type specific expression of every gene in the spatial data (needed for NCEM)' #244

Closed ChristinaSteyn closed 1 year ago

ChristinaSteyn commented 1 year ago

Hi there, Thank you so much for your great tool!

I am trying to run this code on my data:

expected_dict = mod.module.model.compute_expected_per_cell_type(
    mod.samples["post_sample_q05"], mod.adata_manager
)

and getting the following error: AttributeError: 'Cell2location' object has no attribute 'samples'

I will definitely provide more info if necessary but I was just wondering if there is something obvious I may have done wrong? I see that the mod object does have the following mod.sample2df_obs, mod.sample2df_vars, and mod.sample_posterior but none of these are subscriptable.

Your assistance would be very much appreciated :)

vitkl commented 1 year ago

I recommend checking previous issues about this topic https://github.com/BayraktarLab/cell2location/issues/195#issuecomment-1217202426