xin-huang/dadi-cli

Issue with dadi-cli and the Numerics.py script

kchiou opened this issue · 1 comments

kchiou commented

I am getting an error with dadi-cli Plot. A sample command

dadi-cli Plot --fs NOR.CEN.22.neutral_regions.folded.final.fs \
	--demo-popt NOR.CEN.sym_mig.neutral.demo.params.InferDM.bestfits \
	--output ./test.pdf --model sym_mig

returns the error.

Traceback (most recent call last):
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/bin/dadi-cli", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi_cli/__main__.py", line 1869, in main
    args.runner(args)
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi_cli/__main__.py", line 994, in run_plot
    plot_fitted_demography(
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi_cli/Plot.py", line 98, in plot_fitted_demography
    model = func_ex(popt, ns, pts_l)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi/Numerics.py", line 374, in extrap_func
    result_l = list(map(partial_func, pts_l))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi/Numerics.py", line 122, in misid_func
    fs = func(*args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^
  File "/data/CEM/smacklab/libraries/python/.conda/envs/dadi-cli-gpu/lib/python3.11/site-packages/dadi/PortikModels/portik_models_2d.py", line 33, in sym_mig
    nu1, nu2, m, T = params
    ^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3)

Based on the traceback, I edited the script Numerics.py (this version). On line 121, I edited from args[0] = all_params[:-1] to args[0] = all_params, and this appeared to resolve the issue and produce the expected output. This is obviously non-ideal — I'm unsure what else I could be breaking through this fix!

I believe that without this fix, a similar error crops up with other functions (e.g., the bootstrap workflow) for our group in dadi-cli.

Hi @kchiou, when you get an error that the number of parameters is one less than expected, it is usually because dadi-cli assumes the misidentification parameter is a part of the model. If you didn't fit a misidentification parameter for the demographic inference, you'll want to include the --nomisid flag with your dadi-cli Plot command like you did the dadi-cli InferDM command.

If you did include the misidentification parameter for the demographic inference, it would be helpful to see the "NOR.CEN.sym_mig.neutral.demo.params.InferDM.bestfits" file.