Help with error in jobid: 7

Hi all,

I’m trying to run a practice build with the goal of eventually creating some focal builds of the Massachusetts and New England (USA) area. The “getting started” and “example” builds ran just fine on my system. I downloaded a batch of ~200 recent Massachusetts sequences from GISAID and created an accompanying metadata file to practice with.

I’m having some trouble understanding what exactly may be the cause of this error:

Error in rule adjust_metadata_regions:
jobid: 7
output: results/north-america_usa_ma/metadata_adjusted.tsv
log: logs/adjust_metadata_regions_north-america_usa_ma.txt (check log file(s) for error message)
shell:

    python3 scripts/adjust_regional_meta.py             --region 'North America'             --metadata data/metadata.tsv             --output results/north-america_usa_ma/metadata_adjusted.tsv 2>&1 | tee logs/adjust_metadata_regions_north-america_usa_ma.txt
    
    (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Logfile logs/adjust_metadata_regions_north-america_usa_ma.txt:
Adjusting metadata for focal region North America
Traceback (most recent call last):
File “scripts/adjust_regional_meta.py”, line 38, in
metadata.insert(12, ‘focal’, True)
File “/opt/miniconda3/envs/nextstrain/lib/python3.6/site-packages/pandas/core/frame.py”, line 3628, in insert
self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
File “/opt/miniconda3/envs/nextstrain/lib/python3.6/site-packages/pandas/core/internals/managers.py”, line 1215, in insert
self._blklocs = np.insert(self._blklocs, loc, 0)
File “<array_function internals>”, line 6, in insert
File “/opt/miniconda3/envs/nextstrain/lib/python3.6/site-packages/numpy/lib/function_base.py”, line 4560, in insert
“size %i” % (obj, axis, N))
IndexError: index 12 is out of bounds for axis 0 with size 8

[Sat Jan 30 16:27:59 2021]
Finished job 28.
2 of 28 steps (7%) done
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message

Any help is appreciated. Thanks!

Not a python expert here…

I assume that the error originates from ncov/adjust_regional_meta.py at master · nextstrain/ncov · GitHub at line #38 which looks like a fixed column insert at position 12. If your metadata file has only 4 columns (allowed according to Preparing your data — Nextstrain documentation ) your script will crash here.