neherlab / treetime

Maximum likelihood inference of time stamped phylogenies and ancestral reconstruction
MIT License
228 stars 56 forks source link

ERROR: only integer scalar arrays can be converted to a scalar index #286

Open avantonder opened 2 days ago

avantonder commented 2 days ago

Hi,

I've been generating the following error using an older version of TreeTime and the latest version:

/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py:493: RuntimeWarning: invalid value encountered in divide
  int_y/=int_y[-1]
/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/node_interpolator.py:343: RuntimeWarning: divide by zero encountered in divide
  np.array(100*(dx[1:-2]+dx[2:-1])/min_fwhm, dtype=int)), 10)
/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/node_interpolator.py:343: RuntimeWarning: invalid value encountered in cast
  np.array(100*(dx[1:-2]+dx[2:-1])/min_fwhm, dtype=int)), 10)
Traceback (most recent call last):
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/treetime.py", line 57, in run
    return self._run(**kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/treetime.py", line 238, in _run
    self.make_time_tree(**tt_kwargs)
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py", line 376, in make_time_tree
    self._ml_t_joint()
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py", line 491, in _ml_t_joint
    y = subtree_distribution.prob_relative(subtree_distribution.x)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/distribution.py", line 370, in prob_relative
    return np.exp(-1 * (self.__call__(x)-self.peak_val))
                        ^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/distribution.py", line 292, in __call__
    tmp_x = x[valid_idxs]
            ~^^^^^^^^^^^^
TypeError: only integer scalar arrays can be converted to a scalar index

ERROR: only integer scalar arrays can be converted to a scalar index 

ERROR in TreeTime.run: An error occurred which was not properly handled in TreeTime. If this error persists, please let us know by filing a new issue including the original command and the error above at: https://github.com/neherlab/treetime/issues 

Attempting to parse dates...
    Using column 'accession' as name. This needs match the taxon names in the tree!!
    Using column 'date' as date.

0.00    -TreeAnc: set-up

822.04  ###TreeTime.run: INITIAL ROUND

The command I used is as follows:

treetime --tree MTBC0_ancient_no_ref_191124_rooted.treefile \
        --dates dates.tsv \
        --name-column accession \
        --date-column date \
        --aln MTBC0_ancient_no_ref_191124.aln \
        --outdir treetime_ancient \
        --report-ambiguous \
        --time-marginal only-final \
        --clock-rate 1.136364e-07 \
        --clock-std-dev 0.00003 \
        --keep-root \
        --relax 1.0 0
ivan-aksamentov commented 1 day ago

Hi @avantonder, by chance are you able to share the (minimal) data files you are using here? This would help us to reproduce and debug the issue locally. Thanks!