Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with AttributeError: 'NoneType' object has no attribute 'classes' #99

Open
Tracked by #98
matentzn opened this issue Oct 2, 2022 · 6 comments · Fixed by #101
Open
Tracked by #98

Help with AttributeError: 'NoneType' object has no attribute 'classes' #99

matentzn opened this issue Oct 2, 2022 · 6 comments · Fixed by #101

Comments

@matentzn
Copy link
Contributor

matentzn commented Oct 2, 2022

In a fresh (empty) virtual environment am trying:

pip install -U pip
pip install -U schema-automator

Strangely some dependency conflict precludes installation of 1.3.5 linkml.

pip list | grep link
linkml                        1.3.0
linkml-dataops                0.1.0
linkml-runtime                1.3.2

Now when I run (see here):

make target/omop_5.yaml
schemauto generalize-tsvs --schema-name omop_vocabulary local/CONCEPT_RELATIONSHIP_HEAD.csv local/CONCEPT_ANCESTOR.csv local/CONCEPT_CLASS.csv local/CONCEPT_SYNONYM.csv local/CONCEPT.csv local/DOMAIN.csv local/DRUG_STRENGTH.csv local/RELATIONSHIP.csv local/VOCABULARY.csv > target/omop_5.yaml
Traceback (most recent call last):
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/bin/schemauto", line 8, in <module>
    sys.exit(main())
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/schema_automator/cli.py", line 139, in generalize_tsvs
    schema = ie.convert_multiple(tsvfiles, schema_name=schema_name)
  File "/Users/matentzn/.pyenv/versions/3.10.4/envs/linkml/lib/python3.10/site-packages/schema_automator/generalizers/csv_data_generalizer.py", line 218, in convert_multiple
    logging.info(f'Classes={list(s.classes.keys())}')
AttributeError: 'NoneType' object has no attribute 'classes'
make: *** [target/omop_5.yaml] Error 1

I am able to run generalize-tsv on a smaller dataset w/o problems. Any idea what could be wrong?

@matentzn
Copy link
Contributor Author

matentzn commented Oct 3, 2022

I think I found the source of the problem:

While this works in generalize-tsv, generalize-tsvs flakes out if you provide an empty table.

@cmungall
Copy link
Member

cmungall commented Oct 3, 2022

What's the preferred behavior here:

  1. Throw an informative Error
  2. Ignore the empty table
  3. Create a class with no slots

I favor 1 as default, with an option to do 2

I can't think of a scenario where 3 is desired for generalization

@matentzn
Copy link
Contributor Author

matentzn commented Oct 4, 2022

I agree with your preference. I do think 1 default and 3 is also an option if the table has columns, since you can add slots with string range for these?

cmungall pushed a commit that referenced this issue Oct 4, 2022
* Update .gitignore

* fix wrong indentation
@matentzn
Copy link
Contributor Author

I will reopen this for some tiny reason:

  • What if the table has columns, but no rows? Does your judgement above still hold?

@matentzn matentzn reopened this Nov 20, 2022
@matentzn
Copy link
Contributor Author

(Close immediately if it does)

@cmungall
Copy link
Member

cmungall commented Nov 21, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants