PEtab-dev / PEtab

PEtab - an SBML and TSV based data format for parameter estimation problems in systems biology
https://petab.readthedocs.io
MIT License
59 stars 12 forks source link

Delimiter issues in empty lines: tab-only line produces regex error with petablint #466

Closed PaulJonasJost closed 4 years ago

PaulJonasJost commented 4 years ago

When checking whether a tab-delimited file is correctly formatted with petablint, having a tab in an empty line produces the following slightly misleading error. Code: petablint -p Example.tsv

Error: File "/home/Name/anaconda3/bin/petablint", line 8, in <module>
    sys.exit(main())
  File "/home/Name/anaconda3/lib/python3.8/site-packages/petab/petablint.py", line 164, in main
    ret = petab.lint.lint_problem(problem)
  File "/home/Name/anaconda3/lib/python3.8/site-packages/petab/lint.py", line 718, in lint_problem
    check_parameter_df(problem.parameter_df, problem.sbml_model,
  File "/home/Name/anaconda3/lib/python3.8/site-packages/petab/lint.py", line 179, in check_parameter_df
    check_ids(df.index.values, kind='parameter')
  File "/home/Name/anaconda3/lib/python3.8/site-packages/petab/lint.py", line 851, in check_ids
    if not is_valid_identifier(_id):
  File "/home/Name/anaconda3/lib/python3.8/site-packages/petab/lint.py", line 836, in is_valid_identifier
    return re.match(r'^[a-zA-Z_]\w*$', x) is not None
  File "/home/Name/anaconda3/lib/python3.8/re.py", line 191, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

Example.zip

dweindl commented 4 years ago

Closed in v0.1.9