chapmanb / bcbb

Incubator for useful bioinformatics code, primarily in Python and R
http://bcbio.wordpress.com
603 stars 243 forks source link

Bug in v.0.6.8 in `GFF.parse`: `AttributeError: 'NoneType' object has no attribute 'find'` #134

Closed corneliusroemer closed 2 years ago

corneliusroemer commented 2 years ago

Error only appears in v.0.6.8, not in v.0.6.7

I installed from bioconda on MacOS 12

Traceback (most recent call last):
  File "scripts/explicit_translation.py", line 57, in <module>
    features = read_gff(args.annotation)
  File "scripts/explicit_translation.py", line 17, in read_gff
    for rec in GFF.parse(in_handle):
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 780, in parse
    for rec in parser.parse_in_parts(gff_files, base_dict, limit_info,
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 329, in parse_in_parts
    cur_dict = self._results_to_features(cur_dict, results)
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 367, in _results_to_features
    (_, base) = self._add_toplevel_feature(base, feature)
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 570, in _add_toplevel_feature
    rec, base = self._get_rec(base, feature_dict)
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 535, in _get_rec
    match_id = self._get_matching_record_id(base, info_dict['rec_id'])
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/BCBio/GFF/GFFParser.py", line 409, in _get_matching_record_id
    elif find_id.find("|") > 0:
AttributeError: 'NoneType' object has no attribute 'find'

See this issue for details: https://github.com/neherlab/ncov-simple/issues/25

chapmanb commented 2 years ago

Thanks so much for the report and apologies about the issue with the new ID matching code. v0.6.9 should catch this case and hopefully resolve the issue. It's a bit worrisome that your records don't have identifiers but hopefully it will at least treat them correctly now. Please let us know if you hit other issues.