Skip to content

Deprecated alias np.bool #20

Description

@kbseah

When using the select_transcripts option in the isotools.Gene.sashimi_plot function, I encountered the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[425], line 1
----> 1 isoseq[dst.gene].sashimi_plot(samples=['O_A_T','O_P_T','T_A_T','T_P_T'],select_transcripts= list(dst.trA + dst.trB))

File [~/miniforge3/envs/isotools2/lib/python3.12/site-packages/isotools/_gene_plots.py:371](http://localhost:8888/lab/tree/pbisoseq-smk/nb/~/miniforge3/envs/isotools2/lib/python3.12/site-packages/isotools/_gene_plots.py#line=370), in sashimi_plot(self, samples, title, ax, junctions_of_interest, x_range, select_transcripts, y_range, log_y, jparams, exon_color, min_cov_th, high_cov_th, text_width, arc_type, text_height)
    369 except TypeError:
    370     select_transcripts = (select_transcripts,)
--> 371 mask = np.ones(node_matrix.shape[0], np.bool)
    372 mask[select_transcripts] = False
    373 node_matrix[mask, :] = 0

File [~/miniforge3/envs/isotools2/lib/python3.12/site-packages/numpy/__init__.py:324](http://localhost:8888/lab/tree/pbisoseq-smk/nb/~/miniforge3/envs/isotools2/lib/python3.12/site-packages/numpy/__init__.py#line=323), in __getattr__(attr)
    319     warnings.warn(
    320         f"In the future `np.{attr}` will be defined as the "
    321         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    323 if attr in __former_attrs__:
--> 324     raise AttributeError(__former_attrs__[attr])
    326 if attr == 'testing':
    327     import numpy.testing as testing

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` 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

The error message references the following line of code:

mask = np.ones(node_matrix.shape[0], np.bool)

Probably np.bool can be replaced with bool?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions