CenterForMedicalGeneticsGhent / WisecondorX

WisecondorX — An evolved WISECONDOR
Other
94 stars 41 forks source link

TypeError: ufunc 'isnan' not supported for the input types... ? #122

Closed mhmtgenc closed 2 months ago

mhmtgenc commented 3 months ago

I get this error and don't really know how to overcome this; " TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'"

WisecondorX predict V350244378_L02_58.npz /data/storeData/project/1_Projects/NIPT/Analiz/niptref_20240730.npz V350244378_L02_58_2 --bed --plot [INFO - 2024-07-30 14:08:01]: Starting CNA prediction [INFO - 2024-07-30 14:08:01]: Importing data ... [INFO - 2024-07-30 14:08:01]: Normalizing autosomes ... [INFO - 2024-07-30 14:08:11]: Normalizing gonosomes ... [INFO - 2024-07-30 14:08:14]: Executing circular binary segmentation ... Warning message: package ‘DNAcopy’ was built under R version 4.0.3 Traceback (most recent call last): File "/home/MegaBOLT/miniconda3/bin/WisecondorX", line 10, in sys.exit(main()) File "/home/MegaBOLT/miniconda3/lib/python3.8/site-packages/wisecondorX/main.py", line 410, in main args.func(args) File "/home/MegaBOLT/miniconda3/lib/python3.8/site-packages/wisecondorX/main.py", line 240, in tool_test results['results_c'] = exec_cbs(rem_input, results) File "/home/MegaBOLT/miniconda3/lib/python3.8/site-packages/wisecondorX/predict_tools.py", line 247, in exec_cbs segment_z = get_z_score(results_c, results) File "/home/MegaBOLT/miniconda3/lib/python3.8/site-packages/wisecondorX/overall_tools.py", line 98, in get_z_score null_segments = [np.ma.average(np.ma.masked_array(x, np.isnan(x)), weights=segment_w) for x in np.transpose(segment_nr)] File "/home/MegaBOLT/miniconda3/lib/python3.8/site-packages/wisecondorX/overall_tools.py", line 98, in null_segments = [np.ma.average(np.ma.masked_array(x, np.isnan(x)), weights=segment_w) for x in np.transpose(segment_nr)] TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

I have NIPT sample and just created reference npz with over 300 sample both male and female.

Thanks in advance.

koen-swaerts commented 3 months ago

Hi,

I got a similar error, which is probably related:

WisecondorX predict M1.npz refset/ref_M/reference_M_b25000.npz M1_predict_M --bed --plot --gender M --seed 123 [INFO - 2024-07-30 14:26:01]: Starting CNA prediction [INFO - 2024-07-30 14:26:01]: Importing data ... [INFO - 2024-07-30 14:26:02]: Normalizing autosomes ... [INFO - 2024-07-30 14:26:37]: Normalizing gonosomes ... [INFO - 2024-07-30 14:26:47]: Executing circular binary segmentation ... Traceback (most recent call last): File "/conda/envs/wisecondor/bin/WisecondorX", line 10, in sys.exit(main()) File "/conda/envs/wisecondor/lib/python3.9/site-packages/wisecondorx/main.py", line 487, in main args.func(args) File "/conda/envs/wisecondor/lib/python3.9/site-packages/wisecondorx/main.py", line 275, in tool_test results["results_c"] = exec_cbs(rem_input, results) File "/conda/envs/wisecondor/lib/python3.9/site-packages/wisecondorx/predict_tools.py", line 258, in exec_cbs segment_z = get_z_score(results_c, results) File "/conda/envs/wisecondor/lib/python3.9/site-packages/wisecondorx/overall_tools.py", line 106, in get_z_score null_segments = [ File "/conda/envs/wisecondor/lib/python3.9/site-packages/wisecondorx/overall_tools.py", line 107, in np.ma.average(np.ma.masked_array(x, np.isnan(x)), weights=segment_w) TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

I'm using wisecondorx as CNVseq tool (samples of 5x coverage).

Thanks

koen-swaerts commented 3 months ago

I tried a lot of combo's to make it work, currently only downgrading to 1.2.5 seems to work for me (below the conda yml of my environment).

name: wisecondor channels:

koen-swaerts commented 2 months ago

This issue on 1.2.7 is fixed in https://github.com/CenterForMedicalGeneticsGhent/WisecondorX/pull/123 @matthdsm can we close this now?

matthdsm commented 2 months ago

Fixed in v1.2.8, thanks to @koen-swaerts

mhmtgenc commented 2 months ago

Thank you @koen-swaerts

koen-swaerts commented 2 months ago

@mhmtgenc if you got an error now, use the correct versions of the tools with the installation: conda install -y -c bioconda -c conda-forge wisecondorx=1.2.8 r-jsonlite=1.8.8 bioconductor-dnacopy=1.76.0 scipy=1.13.0 scikit-learn=1.4.2 pysam=0.22.0 numpy=1.26.4 matplotlib=3.8.4 pandas=2.2.2