squidpy
squidpy copied to clipboard
About introducing the data to Squidpy
... To begin with, how we should introduce the data to start the analysis? In the tutorial, it's mentioned that loading data is like this:
img = sq.datasets.visium_hne_image()
adata = sq.datasets.visium_hne_adata()
Now, for the image, I think it is clear what is the input but for the adata, should we use "filtered_feature_bc_matrix.h5"? Because I used it and got an error.
I used this code:
adata = sq.read.visium(path, counts_file='filtered_feature_bc_matrix.h5',
library_id=None, load_images=True, source_image_path= "../Data_Analysis/")
And then followed by:
sc.pp.normalize_total(adata)
sc.pp.log1p(adata)
sc.tl.umap(adata)
sc.tl.leiden(adata)
And finally:
adata
This is what I get:
AnnData object with n_obs × n_vars = 3870 × 17943
obs: 'in_tissue', 'array_row', 'array_col', 'leiden'
var: 'gene_ids', 'feature_types', 'genome'
uns: 'spatial', 'log1p', 'pca', 'neighbors', 'umap', 'leiden'
obsm: 'spatial', 'X_pca', 'X_umap'
varm: 'PCs'
obsp: 'distances', 'connectivities'
But when I want to it, there is an error:
sc.pl.spatial(adata,'leiden',spot_size=1)
TypeError Traceback (most recent call last)
/var/folders/1m/217nxw_53mg35gpt1pm70hdh0000gn/T/ipykernel_4901/1744331117.py in <module>
----> 1 sc.pl.spatial(adata,'leiden',spot_size=1)
TypeError: spatial() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
@giovp
Hi @Pedramto89 , you should use the Squidpy plotting functions (sq.pl.spatial_scatter in your case), here's an example, not the Scanpy one; lmk if this helps.
@michalk8 Sorry for the late response. Did not work. I again got a huge error.
@Pedramto89 you need to provide more details, please.
For reading spatial omics data, please now refer to spatialdata-io.