Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError running PAPI #6

Open
SimonaSecomandi opened this issue May 15, 2023 · 1 comment
Open

AssertionError running PAPI #6

SimonaSecomandi opened this issue May 15, 2023 · 1 comment

Comments

@SimonaSecomandi
Copy link

Hello,

I'm running PAPI on a custom tracts input file and I'm getting the following error:

Running inference in scipy-optimize mode
Traceback (most recent call last):
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 262, in <module>
    MAPestimate_scipy = estimate_MAP(d_tracts,typ=args.typ,err=args.err,tau=args.tau)
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 217, in estimate_MAP
    res = scipy.optimize.minimize(
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_minimize.py", line 617, in minimize
    return _minimize_lbfgsb(fun, x0, args, jac, bounds,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/lbfgsb.py", line 306, in _minimize_lbfgsb
    sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/optimize.py", line 261, in _prepare_scalar_function
    sf = ScalarFunction(fun, x0, args, grad, hess,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 76, in __init__
    self._update_fun()
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 166, in _update_fun
    self._update_fun_impl()
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 73, in update_fun
    self.f = fun_wrapped(self.x)
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 70, in fun_wrapped
    return fun(x, *args)
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 218, in <lambda>
    fun=lambda params, D: -lik_func(params,d_tracts,tau),
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 77, in lik_func
    l = md.computeLoglikelihood_binomial(D_flat,params[:2],alpha) + md.computeLoglikelihood_cnsPM(D_dicts,params)
  File "/projects/VONHOLDT/Simona/bin/papi/src/models.py", line 176, in computeLoglikelihood_cnsPM
    assert len(D) == 22
AssertionError

Command used:
python src/inference.py --inputfile ../3_PAPI_inputs/PAPI_input_tracts.txt -ind 1 --outfile ind1_papi_output --mode scipy-optimize --typ full -tau 7

Fist line of the input file (ind1):
ind1_tracts.txt

Could someone help me understanding what the error means?

Moreover, I have to specify the -tau even though it is written that will be automatically set as 7 is not specified, otherwise I get another error:

Running inference in scipy-optimize mode
Traceback (most recent call last):
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 262, in <module>
    MAPestimate_scipy = estimate_MAP(d_tracts,typ=args.typ,err=args.err,tau=args.tau)
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 217, in estimate_MAP
    res = scipy.optimize.minimize(
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_minimize.py", line 617, in minimize
    return _minimize_lbfgsb(fun, x0, args, jac, bounds,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/lbfgsb.py", line 306, in _minimize_lbfgsb
    sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/optimize.py", line 261, in _prepare_scalar_function
    sf = ScalarFunction(fun, x0, args, grad, hess,
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 76, in __init__
    self._update_fun()
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 166, in _update_fun
    self._update_fun_impl()
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 73, in update_fun
    self.f = fun_wrapped(self.x)
  File "/tigress/VONHOLDT/Simona/miniconda3/envs/papi/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 70, in fun_wrapped
    return fun(x, *args)
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 218, in <lambda>
    fun=lambda params, D: -lik_func(params,d_tracts,tau),
  File "/tigress/VONHOLDT/Simona/bin/papi/src/inference.py", line 76, in lik_func
    alpha=100/tau
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'

Many thanks!!

@SimonaSecomandi
Copy link
Author

Hi all, for the first error I figure it out the trigger was the wrong chromosome number. I am working with a bird species with 46 chromosomes. Putting assert len(D) == 46 in papi/src/models.py script solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant