jianhuupenn / TESLA

Deciphering tumor ecosystems at super-resolution from spatial transcriptomics with TESLA
MIT License
42 stars 10 forks source link

Enhanced anndata contains only NaN values for gene expression #10

Open nrosewick opened 8 months ago

nrosewick commented 8 months ago

I followed the tutorial using in-house 10X Visium data. I used filtered_feature_bc_matrix.h5, tissue_positions.csv and tissue_hires_image.png as input for Tesla. Countour detection works well using cnt=tesla.cv2_detect_contour(img, apertureSize=5,L2gradient = True) .

I proceed to the imputation

enhanced_exp_adata=tesla.imputation(img=img, raw=counts, cnt=cnt, genes=counts.var.index.tolist(), shape="none", res=res, s=1, k=2, num_nbs=10)

and when I check the enhanced_exp_adata.X all values are nan

Any idea how to solve this ?

Thank you

jianhuupenn commented 8 months ago

Thanks for your interest in TESLA. I would recommend you double-check if you are using the correct image, which matches the pixel_x and pixel_y coordinates. If the coordinates do not match, you will get "nan" for the colour values, and the enhanced expression becomes "nan".

I have helped other people solve the same problem on GitHub: https://github.com/jianhuupenn/SpaGCN/issues/7#issuecomment-962761985

nrosewick commented 8 months ago

Thank you for your prompt reply.

It was indeed an issue with the matching between pixel_x, y and array_x, y. I had to use the scalefactor provided by 10X spaceranger to have good match for pixels. Nevertheless will TESLA work smoothly with the tissue_hires_image.png generated by 10X spaceranger ( a downsampling image of the input file given to spaceranger).

Thank you