YeoLab / bento-tools

A Python toolkit for subcellular analysis of spatial transcriptomics data
https://bento-tools.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
70 stars 6 forks source link

AttributeError: module 'bento' has no attribute 'io' #164

Open zhoutianrui-tongji opened 3 weeks ago

zhoutianrui-tongji commented 3 weeks ago
image

sdata SpatialData object ├── Images │ └── 'morphology_focus': DataTree[cyx] (5, 34119, 39776), (5, 17059, 19888), (5, 8529, 9944), (5, 4264, 4972), (5, 2132, 2486) ├── Labels │ ├── 'cell_labels': DataTree[yx] (34119, 39776), (17059, 19888), (8529, 9944), (4264, 4972), (2132, 2486) │ └── 'nucleus_labels': DataTree[yx] (34119, 39776), (17059, 19888), (8529, 9944), (4264, 4972), (2132, 2486) ├── Points │ └── 'transcripts': DataFrame with shape: (, 13) (3D points) ├── Shapes │ ├── 'cell_boundaries': GeoDataFrame shape: (1989, 2) (2D shapes) │ └── 'cell_circles': GeoDataFrame shape: (1989, 2) (2D shapes) └── Tables └── 'table': AnnData (1989, 4624) with coordinate systems: ▸ 'global', with elements: morphology_focus (Images), cell_labels (Labels), nucleus_labels (Labels), transcripts (Points), cell_boundaries (Shapes), cell_circles (Shapes) 1 %load_ext autoreload 2 %autoreload 2 3 import bento as bt 4 import spatialdata as sd 5 import matplotlib.pyplot as plt

1 sdata = bt.io.prep(sdata)

AttributeError Traceback (most recent call last) Cell In[5], line 1 ----> 1 sdata = bt.io.prep(sdata)

AttributeError: module 'bento' has no attribute 'io'

pip show bento-tools Name: bento-tools Version: 2.1.3 Summary: A toolkit for subcellular analysis of spatial transcriptomics data Home-page: Author: Author-email: ckmah clarence.k.mah@gmail.com License: Location: /data/home/zhoutianrui/anaconda3/envs/bento/lib/python3.10/site-packages Editable project location: /data/home/zhoutianrui/Tools/bento-tools-master Requires: adjusttext, astropy, decoupler, emoji, ipywidgets, kneed, matplotlib-scalebar, minisom, pandas, rasterio, rtree, scikit-learn, scipy, seaborn, shapely, sparse, spatialdata, statsmodels, tensorly, tqdm, upsetplot, xgboost Required-by:

thanks!

ckmah commented 3 weeks ago

Hi @zhoutianrui-tongji that's very strange, this shouldn't be a problem. Here are two possible fixes for now. Let me know how it goes.

  1. uninstall and reinstall from pip
  2. install from local copy
    pip uninstall bento-tools
    git clone https://github.com/YeoLab/bento-tools.git
    cd bento-tools
    pip install -e .
zhoutianrui-tongji commented 3 weeks ago

This is useful, thank you!