Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs about ov.space.svg #117

Closed
DBinary opened this issue Jul 25, 2024 · 1 comment
Closed

Bugs about ov.space.svg #117

DBinary opened this issue Jul 25, 2024 · 1 comment

Comments

@DBinary
Copy link
Contributor

DBinary commented Jul 25, 2024

For the tutorials of space related analysis, such as mapping, spaceflow and stagate. There is a bug with default parameters and inputs.

Code:

adata = sc.datasets.visium_sge(sample_id="V1_Human_Lymph_Node")
adata.obs['sample'] = list(adata.uns['spatial'].keys())[0]
adata.var_names_make_unique()

sc.pp.calculate_qc_metrics(adata, inplace=True)
adata = adata[:,adata.var['total_counts']>100]
adata=ov.space.svg(adata,mode='prost',n_svgs=3000,target_sum=1e4,platform="visium",)
adata.raw = adata
adata = adata[:, adata.var.space_variable_features]
adata_sp=adata.copy()
adata_sp

Bug:

----> 3 adata=ov.space.svg(adata,mode='prost',n_svgs=3000,target_sum=1e4,platform="visium",)
      4 adata

File /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/omicverse/space/_svg.py:10, in svg(adata, mode, n_svgs, target_sum, platform, mt_startwith)
      8     adata.layers['counts'] = adata.X.copy()
      9 # Calculate PI
---> 10 adata = prepare_for_PI(adata, platform=platform)
     11 adata = cal_PI(adata, platform=platform)
     12 print('PI calculation is done!')

File /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/omicverse/externel/PROST/calculate_PI.py:26, in prepare_for_PI(adata, grid_size, percentage, platform)
     24 if np.min(locates) == 0:
     25     locates += 1
---> 26 _, image_idx = make_image(postcount[0], locates, platform, get_image_idx = True, grid_size=grid_size)
     27 adata = adata[:, selected_gene_idxs]
     28 sc.pp.filter_genes(adata, min_cells=3)

File /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/omicverse/externel/PROST/utils.py:159, in make_image(genecount, locates, platform, get_image_idx, grid_size, interpolation_method)
    157     image_idx_1d = np.ones(np.max(image_idx_2d[:])).astype(int)
    158     if get_image_idx:
--> 159         image_idx_1d = get_image_idx_1D(image_idx_2d)
    161     return image, image_idx_1d
    162 #--------------------------------------------------------------------------
    163 else:

File /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/numba/core/dispatcher.py:423, in _DispatcherBase._compile_for_args(self, *args, **kws)
    419         msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
    420                f"by the following argument(s):\n{args_str}\n")
    421         e.patch_message(msg)
--> 423     error_rewrite(e, 'typing')
    424 except errors.UnsupportedError as e:
    425     # Something unsupported is present in the user code, add help info
    426     error_rewrite(e, 'unsupported_error')

File /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/numba/core/dispatcher.py:364, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
    362     raise e
    363 else:
--> 364     raise e.with_traceback(None)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of BoundFunction(array.astype for array(float64, 1d, C)) with parameters (Function(<class 'int'>))

During: resolving callee type: BoundFunction(array.astype for array(float64, 1d, C))
During: typing of call at /opt/miniforge/envs/omicverse/lib/python3.10/site-packages/omicverse/externel/PROST/utils.py (100)


File "../../../../../../../opt/miniforge/envs/omicverse/lib/python3.10/site-packages/omicverse/externel/PROST/utils.py", line 100:
def get_image_idx_1D(image_idx_2d):
    <source elided>
    print("\nCalculating image index 1D:")
    image_idx_1d = np.ones(np.max(image_idx_2d[:])).astype(int)
    ^

Environment:

Package                   Version
------------------------- ------------------
absl-py                   2.1.0
adjustText                1.2.0
aiohttp                   3.9.5
aiosignal                 1.3.1
anndata                   0.10.8
annotated-types           0.7.0
annoy                     1.17.3
anyio                     4.4.0
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
array_api_compat          1.7.1
arrow                     1.3.0
ase                       3.23.0
astor                     0.8.1
asttokens                 2.4.1
async-lru                 2.0.4
async-timeout             4.0.3
attrs                     23.2.0
autograd                  1.6.2
autograd-gamma            0.5.0
Babel                     2.15.0
backoff                   2.2.1
beautifulsoup4            4.12.3
bleach                    6.1.0
blessed                   1.19.1
blinker                   1.8.2
boltons                   24.0.0
boto3                     1.34.147
botocore                  1.34.147
Brotli                    1.1.0
build                     1.2.1
CacheControl              0.14.0
cached-property           1.5.2
captum                    0.6.0
certifi                   2024.7.4
cffi                      1.16.0
charset-normalizer        3.3.2
chex                      0.1.83
cleo                      2.1.0
click                     8.1.7
cloudpickle               3.0.0
colorama                  0.4.6
colorcet                  3.1.0
comm                      0.2.2
contextlib2               21.6.0
contourpy                 1.2.1
crashtest                 0.4.1
croniter                  1.4.1
cryptography              43.0.0
cycler                    0.12.1
dask                      2024.7.1
datashader                0.16.3
dateutils                 0.6.12
debugpy                   1.8.2
decorator                 5.1.1
deepdiff                  7.0.1
defusedxml                0.7.1
dill                      0.3.8
distlib                   0.3.8
dm-tree                   0.1.8
dnspython                 2.6.1
docrep                    0.3.2
dulwich                   0.21.7
einops                    0.8.0
email_validator           2.2.0
et-xmlfile                1.1.0
etils                     1.7.0
exceptiongroup            1.2.2
executing                 2.0.1
faiss                     1.7.4
fastapi                   0.111.1
fastapi-cli               0.0.4
fastjsonschema            2.20.0
filelock                  3.15.4
Flask                     3.0.3
flax                      0.8.5
fonttools                 4.53.1
formulaic                 1.0.2
fqdn                      1.5.1
frozenlist                1.4.1
fsspec                    2024.6.1
future                    1.0.0
gdown                     5.2.0
get-annotations           0.1.2
gmpy2                     2.1.5
graphlib-backport         1.0.3
grpcio                    1.62.2
h11                       0.14.0
h2                        4.1.0
h5py                      3.11.0
hnswlib                   0.7.0
hpack                     4.0.0
httpcore                  1.0.5
httpx                     0.27.0
hyperframe                6.0.1
idna                      3.7
igraph                    0.11.6
imagecodecs               2024.6.1
imageio                   2.34.2
importlib_metadata        8.1.0
importlib_resources       6.4.0
inquirer                  3.1.4
installer                 0.7.0
interface-meta            1.3.0
ipykernel                 6.29.5
ipython                   8.26.0
ipywidgets                8.1.3
isodate                   0.6.1
isoduration               20.11.0
itsdangerous              2.2.0
jaraco.classes            3.4.0
jax                       0.4.28
jaxlib                    0.4.28.dev20240710
jaxopt                    0.8.3
jedi                      0.19.1
jeepney                   0.8.0
Jinja2                    3.1.4
jmespath                  1.0.1
joblib                    1.4.2
json5                     0.9.25
jsonpointer               3.0.0
jsonschema                4.23.0
jsonschema-specifications 2023.12.1
jupyter                   1.0.0
jupyter_client            8.6.2
jupyter-console           6.6.3
jupyter_core              5.7.2
jupyter-events            0.10.0
jupyter-lsp               2.2.5
jupyter_server            2.14.2
jupyter_server_terminals  0.5.3
jupyterlab                4.2.4
jupyterlab_pygments       0.3.0
jupyterlab_server         2.27.3
jupyterlab_widgets        3.0.11
keyring                   24.3.1
kiwisolver                1.4.5
lazy_loader               0.4
legacy-api-wrap           1.4
leidenalg                 0.10.2
lifelines                 0.27.8
lightning                 2.0.9.post0
lightning_cloud           0.5.70
lightning-utilities       0.11.6
llvmlite                  0.43.0
locket                    1.0.0
Markdown                  3.6
markdown-it-py            3.0.0
MarkupSafe                2.1.5
matplotlib                3.6.3
matplotlib-inline         0.1.7
mdurl                     0.1.2
mellon                    1.4.3
mistune                   3.0.2
ml-collections            0.1.1
ml-dtypes                 0.4.0
more-itertools            10.3.0
mpmath                    1.3.0
msgpack                   1.0.8
mudata                    0.2.4
multidict                 6.0.5
multipledispatch          0.6.0
multiprocess              0.70.16
munkres                   1.1.4
natsort                   8.4.0
nbclient                  0.10.0
nbconvert                 7.16.4
nbformat                  5.10.4
nest_asyncio              1.6.0
networkx                  3.3
notebook                  7.2.1
notebook_shim             0.2.4
numba                     0.60.0
numpy                     1.23.5
numpyro                   0.15.1
omicverse                 1.6.5
openpyxl                  3.1.4
opt-einsum                3.3.0
optax                     0.2.2
orbax-checkpoint          0.4.4
ordered-set               4.1.0
orjson                    3.10.6
overrides                 7.7.0
packaging                 24.1
pandas                    1.5.3
pandocfilters             1.5.1
param                     2.1.1
parso                     0.8.4
partd                     1.4.2
patsy                     0.5.6
pexpect                   4.9.0
pickleshare               0.7.5
pillow                    10.4.0
pip                       24.0
pkginfo                   1.11.1
platformdirs              4.2.2
plotly                    5.23.0
poetry                    1.8.3
poetry-core               1.9.0
poetry-plugin-export      1.8.0
progressbar2              4.4.2
prometheus_client         0.20.0
prompt_toolkit            3.0.47
protobuf                  4.25.3
psutil                    6.0.0
ptyprocess                0.7.0
pure_eval                 0.2.3
pycparser                 2.22
pyct                      0.5.0
pydantic                  2.1.1
pydantic_core             2.4.0
pydeseq2                  0.4.10
pygam                     0.9.1
Pygments                  2.18.0
PyJWT                     2.8.0
pynndescent               0.5.13
pynvml                    11.5.3
pyparsing                 3.1.2
pyproject_hooks           1.1.0
pyro-api                  0.1.2
pyro-ppl                  1.9.1+0a67ddc
PySocks                   1.7.1
python-dateutil           2.9.0
python-editor             1.0.4
python-json-logger        2.0.7
python-multipart          0.0.9
python-utils              3.8.2
pytorch-lightning         2.3.3
pytz                      2024.1
PyWavelets                1.6.0
PyYAML                    6.0.1
pyzmq                     26.0.3
qtconsole                 5.5.2
QtPy                      2.4.1
rapidfuzz                 3.9.4
rdflib                    7.0.0
readchar                  4.1.0.dev3
referencing               0.35.1
requests                  2.32.3
requests-toolbelt         1.0.0
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rich                      13.7.1
rpds-py                   0.19.1
s3transfer                0.10.2
scanpy                    1.10.2
scikit-image              0.24.0
scikit-learn              1.5.1
scikit-misc               0.1.4
SciPy                     1.11.4
scvi-tools                1.1.5
seaborn                   0.13.2
SecretStorage             3.3.3
Send2Trash                1.8.3
session-info              1.0.0
setuptools                71.0.4
shellingham               1.5.4
six                       1.16.0
sniffio                   1.3.1
soupsieve                 2.5
sparse                    0.15.4
stack-data                0.6.2
starlette                 0.37.2
starsessions              1.3.0
statsmodels               0.14.2
stdlib-list               0.10.0
sympy                     1.13.0
tenacity                  8.5.0
tensorboard               2.17.0
tensorboard-data-server   0.7.0
tensorstore               0.1.62
termcolor                 2.4.0
terminado                 0.18.1
texttable                 1.7.0
threadpoolctl             3.5.0
tifffile                  2024.7.24
tinycss2                  1.3.0
tomli                     2.0.1
tomlkit                   0.13.0
toolz                     0.12.1
torch                     2.2.2
torch_cluster             1.6.3
torch_geometric           2.5.2
torch_scatter             2.1.2
torchaudio                2.2.2
torchmetrics              1.4.0.post0
torchvision               0.17.2
tornado                   6.4.1
tqdm                      4.66.4
traitlets                 5.14.3
trimesh                   4.4.3
triton                    3.0.0
trove-classifiers         2024.7.2
typer                     0.12.3
typer-slim                0.12.3
types-python-dateutil     2.9.0.20240316
typing_extensions         4.12.2
umap-learn                0.5.6
unicodedata2              15.1.0
uri-template              1.3.0
urllib3                   2.2.2
uvicorn                   0.30.3
virtualenv                20.26.3
wcwidth                   0.2.13
webcolors                 24.6.0
webencodings              0.5.1
websocket-client          1.8.0
websockets                12.0
Werkzeug                  3.0.3
wheel                     0.43.0
widgetsnbextension        4.0.11
wrapt                     1.16.0
xarray                    2024.3.0
yarl                      1.9.4
zipp                      3.19.2
zstandard                 0.23.0

Starlitnightly added a commit that referenced this issue Aug 5, 2024
Added `COMMOT` to calculate the cell-cell interaction of spatial RNA-seq.
@Starlitnightly
Copy link
Owner

Starlitnightly commented Aug 5, 2024

This error have been fixed in new commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants