nextstrain/augur

augur ancestral - IndexError when using wrong (shorter) reference

Opened this issue · 0 comments

Current Behavior

When performing augur ancestral step, if the input --root-sequence is shorter than the alignment, an error is produced:

IndexError: boolean index did not match indexed array along dimension 0; dimension is 1982 but corresponding boolean dimension is 1983

Note the dimension (1982) is smaller than the boolean dimension (1983).

Expected behavior

An error produced due to mismatch between alignment and reference is the correct behavior. To help the user, the error could be improved.

How to reproduce

Run a standard augur pipeline align -> tree -> ancestral but replace the --root-sequence sequence to one that is shorter than the alignment.

Possible solution

Catch the IndexError: and provide a more useful error for the user. for example:

Dimensions of input alignment and root sequence do not match (1982/1983). 
This can be caused when the alignment and the root sequence are different. 
Check the reference used for `augur align` is the same when performing `augur ancestral`

Your environment: if running Nextstrain locally

  • Operating system: macos/ubuntu
  • Version: augur 25.3.0

Some related discussion here: #108 (comment)