shuzhao-li-lab / asari

asari, metabolomics data preprocessing
Other
38 stars 9 forks source link

Error with `np.str` present in kiupu pkg due to version upgrade of numpy (> 1.24) #32

Closed gmhhope closed 1 year ago

gmhhope commented 1 year ago

The errors seem to complain about the issues with using np.str in kiupu model.py (https://github.com/shuzhao-li/khipu/blob/main/khipu/model.py)

Warning no match in isotope_pattern:  15.050514221191406
Unknown isotope match ~  (161.04485416412354, 'F5987')
Traceback (most recent call last):
  File "/usr/local/bin/asari", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/asari/main.py", line 109, in main
    __run_process__(parameters, args)
  File "/usr/local/lib/python3.10/site-packages/asari/main.py", line 40, in __run_process__
    process_project( list_input_files,  parameters )
  File "/usr/local/lib/python3.10/site-packages/asari/workflow.py", line 54, in process_project
    EE.export_all(anno=parameters["anno"])
  File "/usr/local/lib/python3.10/site-packages/asari/experiment.py", line 114, in export_all
    self.annotate()
  File "/usr/local/lib/python3.10/site-packages/asari/experiment.py", line 128, in annotate
    EED.build_from_list_peaks(
  File "/usr/local/lib/python3.10/site-packages/jms/dbStructures.py", line 300, in build_from_list_peaks
    self.dict_empCpds = ECCON.peaks_to_epdDict(
  File "/usr/local/lib/python3.10/site-packages/khipu/epdsConstructor.py", line 83, in peaks_to_epdDict
    khipu_list = graphs_to_khipu_list(
  File "/usr/local/lib/python3.10/site-packages/khipu/extended.py", line 245, in graphs_to_khipu_list
    KP.build_khipu(WeavorInstance, mz_tolerance_ppm)
  File "/usr/local/lib/python3.10/site-packages/khipu/model.py", line 362, in build_khipu
    self.neutral_mass, self.khipu_grid, self.feature_map = WeavorInstance.build_full_grid(
  File "/usr/local/lib/python3.10/site-packages/khipu/model.py", line 255, in build_full_grid
    grid = pd.DataFrame( np.empty((self._M, self._N), dtype=np.str),
  File "/usr/local/lib/python3.10/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'str'.
`np.str` was a deprecated alias for the builtin `str`. To avoid this error in existing code, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'std'?

Downgrade version back to lower version (e.g., numpy-1.22.2) solve the issue: pip install numpy==1.22.2