Problem with plotting spaceranger spatial matrices data

I have a problem with sc.pl.spatial() displaying empty figure.

Here is what I did:

So I have 3 outputs from spaceranger: barcodes.tsv.gz, features.tsv.gz, matrix.mtx.gz.
I import them using sc.read_10x_mtx() while passing the folder path.
Then I followed this tutorial: Import spatial data in AnnData and Squidpy β€” Squidpy main documentation
I got the coordinates that are the last 2 columns of the tissue_positions_list.csv file, which also comes after the run of spaceranger (The file is in spatial folder).

After following the tutorial above I get an empty figure like so, even though I added the coordinates to the obsm: 'spatial':
image

The sc.pl.umap() works fine by the way.

Help would be highly appreciated! Thanks!

Hi @rinadango ,

thank you for your interest in scverse! Let mne try to answer your question:

  1. try reading the data with squidpy.read.visium β€” Squidpy main documentation

  2. you might want to check this plotting function as well (but it won’t solve your problem) Plot scatter plot in spatial coordinates β€” Squidpy main documentation

So I have 3 outputs from spaceranger: barcodes.tsv.gz, features.tsv.gz, matrix.mtx.gz .

you’d also have to read the images and scalefactors in the spatial folder (also output of spaceranger) and put them in the right place in uns (as described in the tutorial you shared or by copying structure in e.g.

import squidpy as sq
adata = sq.datasets.visium_hne_adata()

HTH!

1 Like

Hello @giovp

As mentioned before I have the barcodes.tsv.gz, features.tsv.gz, matrix.mtx.gz and not the .h5 file. I tried to use the squidpy.read.visium() method but it did not work. I get an error asking for .h5.

Just to add, I also tried to plot other data that I know is fine by using the sc.pl.spatial(adata, color="leiden", spot_size=1) and it also gives me an empty plot.

Thanks!

hi @rinadango ,

apologies for late reply. The problem of reading non-h5 files in squidpy indeed persist, will open an issue on the repo.

Regarding plotting, can you try with the newest sq.pl.spatial_scatter ?

let me know!

1 Like

Hello,

thanks for the reply! I have managed to work out the issue in the end :smile:
The previous answer helped with some parts I had trouble with. Again thanks!

1 Like