YangLabHKUST / STitch3D

Construction of a 3D whole organism spatial atlas by joint modeling of multiple slices
https://stitch3d-tutorial.readthedocs.io/en/latest/index.html#
MIT License
50 stars 2 forks source link

unsupported operand type error in preprocessing #29

Open lillyzhan opened 2 months ago

lillyzhan commented 2 months ago

Dear professor, I am getting this TypeError: unsupported operand type(s) for &: 'str' and 'str' error in the function preprocessing in utils.py on the line 205. I tought that genes_shared should be a number but adata_st.var.index are list of strings. Could you help me fix the error or explain what the line of code genes_shared = adata_st.var.index & adata_st_new.var.index is meant to do? This error only appears in the windows system.

Thanks in advance. Lilly

gefeiwang commented 2 months ago

Hi Lilly,

The command (genes_shared = adata_st.var.index & adata_st_new.var.index) selects genes that are measured in both single-cell spatial transcriptomics data. The error message TypeError: unsupported operand type(s) for &: 'str' and 'str' is very likely to be caused by using a pandas version in which the intersection between two pandas.Index objects using '&' is not supported. May I know the pandas package version you are using?

Best, Gefei

lillyzhan commented 2 months ago

Hi Professor,

The pandas version is 2.0.3. Thanks for the explanation.

Best regards, Lilly

gefeiwang commented 2 months ago

Downgrading pandas to a version <=1.5.3 may help fix the error.