LeonSong1995 / gsMap

MIT License
18 stars 2 forks source link

An issue when perform gsmap quick_mode #3

Closed Crazzy-Rabbit closed 1 week ago

Crazzy-Rabbit commented 1 week ago

Hi Liyang Thanks for you providing this tools which provide us with new insights combings GWAS data and spaital transcriptome data. A very nice job! But when we run the option gsmap quick_mode, it generate an issue, I don't think it's a data error. My command line and error as follow:

ST_sample="/public/share/wchirdzhq2022/Wulab_share/gsMap/gsMap_example_data/ST/E16.5_E1S1.MOSTA.h5ad"
ST_name="E16.5_E1S1.MOSTA"
gsMap_resource="/public/share/wchirdzhq2022/Wulab_share/gsMap"
homo="/public/share/wchirdzhq2022/Wulab_share/gsMap/homologs/mouse_human_homologs.txt"
workdir="/public/home/shilulu/new_run/all_meta/gsMap/Mouse_Embryo"
gwas="/public/home/shilulu/new_run/all_meta/gsMap/METAL.sumstats.gz"
gsmap quick_mode \
    --workdir ${workdir} \
    --homolog_file ${homo} \
    --sample_name ${ST_name} \
    --gsMap_resource_dir ${gsMap_resource} \
    --hdf5_path ${ST_sample} \
    --annotation 'annotation' \
    --data_layer 'count' \
    --sumstats_file ${gwas} \
    --trait_name ARHL
[2024-11-01 10:31:33,490] INFO | gsMap - Running run_find_latent_representations...
Using the following arguments for FindLatentRepresentationsConfig:
{   'annotation': 'annotation',
    'convergence_threshold': 0.0001,
    'data_layer': 'count',
    'epochs': 300,
    'feat_hidden1': 256,
    'feat_hidden2': 128,
    'gat_hidden1': 64,
    'gat_hidden2': 30,
    'gat_lr': 0.001,
    'hierarchically': False,
    'input_hdf5_path': '/public/share/wchirdzhq2022/Wulab_share/gsMap/gsMap_example_data/ST/E16.5_E1S1.MOSTA.h5ad',
    'n_comps': 300,
    'n_neighbors': 11,
    'p_drop': 0.1,
    'sample_name': 'E16.5_E1S1.MOSTA',
    'weighted_adj': False,
    'workdir': '/public/home/shilulu/project_hearing-loss/new_run/all_meta/gsMap/Mouse_Embryo'}
[2024-11-01 10:33:20,175] INFO | gsMap - ------Find latent representations for annotation...
[2024-11-01 10:33:20,564] INFO | gsMap.find_latent_representation - Using CPU for computations.
[2024-11-01 10:33:20,565] INFO | gsMap.find_latent_representation - Loading ST data of E16.5_E1S1.MOSTA...
[2024-11-01 10:33:27,416] INFO | gsMap.find_latent_representation - The ST data contains 121767 cells, 28204 genes.
[2024-11-01 10:33:28,091] INFO | gsMap.find_latent_representation - Preprocessing data...
[2024-11-01 10:33:33,310] INFO | gsMap.find_latent_representation - Using data layer: count...
[2024-11-01 10:33:45,489] INFO | gsMap.find_latent_representation - Dealing with count data...
Traceback (most recent call last):
  File "/public/home/shilulu/anaconda3/envs/gsMap/bin/gsmap", line 8, in <module>
    sys.exit(main())
  File "/public/home/shilulu/software/gsMap/src/gsMap/main.py", line 10, in main
    args.func(
  File "/public/home/shilulu/software/gsMap/src/gsMap/config.py", line 42, in wrapper
    func(*args, **kwargs)
  File "/public/home/shilulu/software/gsMap/src/gsMap/config.py", line 744, in run_find_latent_representation_from_cli
    run_find_latent_representation(config)
  File "/public/home/shilulu/software/gsMap/src/gsMap/find_latent_representation.py", line 120, in run_find_latent_representation
    adata = preprocess_data(adata, args)
  File "/public/home/shilulu/software/gsMap/src/gsMap/find_latent_representation.py", line 51, in preprocess_data
    sc.pp.highly_variable_genes(adata,flavor="seurat_v3",n_top_genes=params.feat_cell)
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/legacy_api_wrap/__init__.py", line 80, in fn_compatible
    return fn(*args_all, **kw)
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scanpy/preprocessing/_highly_variable_genes.py", line 658, in highly_variable_genes
    return _highly_variable_genes_seurat_v3(
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scanpy/preprocessing/_highly_variable_genes.py", line 66, in _highly_variable_genes_seurat_v3
    from skmisc.loess import loess
File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/skmisc/loess/__init__.py", line 51, in <module>
    from ._loess import (
  File "_loess.pyx", line 1, in init _loess
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Thank you very much for your help!

Kind regards, lulu

LeonSong1995 commented 1 week ago

Hi Lulu,

This error may be due to the highly_variable_genes function in Scanpy. The issue arises because pandas has a loose dependency on numpy, defined as "any version newer than a certain release." When numpy 2.0.0 was released on June 16, 2024, it became incompatible with your version of pandas. To resolve this, downgrade numpy to version 1.26.4 and try running gsMap again.

Best, Liyang

Crazzy-Rabbit commented 1 week ago

Hi Liyang,

Thanks for your prompt reply, when I downgrade numpy to version 1.26.4, below error will be generated

================================================================================
[2024-11-01 12:26:15,301] INFO | gsMap - Running run_find_latent_representations...
Traceback (most recent call last):
  File "/public/home/shilulu/anaconda3/envs/gsMap/bin/gsmap", line 8, in <module>
    sys.exit(main())
  File "/public/home/shilulu/software/gsMap/src/gsMap/main.py", line 10, in main
    args.func(
  File "/public/home/shilulu/software/gsMap/src/gsMap/config.py", line 42, in wrapper
    func(*args, **kwargs)
  File "/public/home/shilulu/software/gsMap/src/gsMap/config.py", line 742, in run_find_latent_representation_from_cli
    from gsMap.find_latent_representation import run_find_latent_representation
  File "/public/home/shilulu/software/gsMap/src/gsMap/find_latent_representation.py", line 4, in <module>
    import scanpy as sc
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scanpy/__init__.py", line 20, in <module>
    from ._utils import check_versions
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scanpy/_utils/__init__.py", line 30, in <module>
    from sklearn.utils import check_random_state
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/__init__.py", line 84, in <module>
    from .base import clone
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/base.py", line 19, in <module>
    from .utils._estimator_html_repr import _HTMLDocumentationLinkMixin, estimator_html_repr
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/__init__.py", line 11, in <module>
    from ._chunking import gen_batches, gen_even_slices
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/_chunking.py", line 8, in <module>
    from ._param_validation import Interval, validate_params
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/_param_validation.py", line 14, in <module>
    from .validation import _is_arraylike_not_scalar
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/validation.py", line 26, in <module>
    from ..utils._array_api import _asarray_with_order, _is_numpy_namespace, get_namespace
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/_array_api.py", line 11, in <module>
    from .fixes import parse_version
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 21, in <module>
    import scipy.stats
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/stats/__init__.py", line 606, in <module>
    from ._stats_py import *
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/stats/_stats_py.py", line 49, in <module>
    from . import distributions
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/stats/distributions.py", line 11, in <module>
    from . import _discrete_distns
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/stats/_discrete_distns.py", line 10, in <module>
    from scipy.interpolate import interp1d
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/interpolate/__init__.py", line 167, in <module>
    from ._interpolate import *
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py", line 14, in <module>
    from . import _fitpack_py
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/interpolate/_fitpack_py.py", line 8, in <module>
    from ._fitpack_impl import bisplrep, bisplev, dblint  # noqa: F401
  File "/public/home/shilulu/anaconda3/envs/gsMap/lib/python3.9/site-packages/scipy/interpolate/_fitpack_impl.py", line 103, in <module>
    'iwrk': array([], dfitpack_int), 'u': array([], float),
TypeError

By the way, the environment of gsMap was create using conda as follow:

conda create -n gsMap python==3.9
conda activate gsMap
git clone https://github.com/LeonSong1995/gsMap.git
cd gsMap
pip install -e .

Kind regards, lulu

LeonSong1995 commented 1 week ago

We have updated the dependencies. Please create a new Conda environment and reinstall it

conda create -n gsMap python==3.9
conda activate gsMap
git clone https://github.com/LeonSong1995/gsMap.git
cd gsMap
pip install -e .
Crazzy-Rabbit commented 1 week ago

Cool. The issue already resolved.

Thanks, lulu