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

More informative error when species is not in developmental stage ontology #632

Open
Hrovatin opened this issue Mar 5, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Hrovatin
Copy link
Contributor

Hrovatin commented Mar 5, 2022

Branch dev from 4. 3. 2021

I tried to make loader for a non-standard species and got error:

│ /mnt/znas/icb_zstore01/groups/ml01/code/karin.hrovatin/sfaira/sfaira/versions/metadata/maps.py:442 in prepare_ontology_map                                                                 │
│                                                                                                                                                                                            │
│   439 │   │   onto_cls = getattr(OCS, onto)                                                                                                                                                │
│   440 │   │   if isinstance(onto_cls, dict):                                                                                                                                               │
│   441 │   │   │   try:                                                                                                                                                                     │
│ ❱ 442 │   │   │   │   onto_cls = onto_cls[organism]                                                                                                                                        │
│   443 │   │   │   except AttributeError as e:                                                                                                                                              │
│   444 │   │   │   │   raise AttributeError(f"did not find requested organism {organism} in                                                                                                 │
│       ontology {onto}, "                                                                                                                                                                   │
│   445 │   │   │   │   │   │   │   │   │    f"choose from {onto_cls.keys()}.\n{e}")                                                                                                         │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'Microcebus murinus'

It took me a while to figure out from which ontology it comes as the error mesage that should have been reported from line 444 is for some reason trunctaed just to the KeyError. The error was due to my organism not being human or mouse and I specified developmental stage column. You have anotehr option "other" in this ontology (beside mm and hs), but I think this is mainly from Xenopus. Could you handle this by not erroring out (this is annoying as then the whole dataloader process must be made again) - instead you could output a warning that developmental stage will be ignored. Are there also some general developmental ontologies, like embryo/postnatal/adolescent/adult/old?

@davidsebfischer
Copy link
Contributor

  • Ok we are catching the wrong error here, should be KeyError, I will fix that to make error reporting better.

You are using an NCBItaxon ID, that is the right way, it just does not yet seem to be mapped to the "other" group in developmental stage, will go over that part of the code. I think you can still use UBERON for developmental stages for these other organism, they have a generalisable but broader ontology for how that looks like in multicellulars: https://www.ebi.ac.uk/ols/ontologies/uberon/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FUBERON_0000105. I do not think its Xenopus specific, it may have some fields for this organism but also has the more general ones like embryo, adult etc. In any case it is the only officially maintained ontology for this broader development purpose that I am aware of and we follow these ontologies as much as possible as this has a ton of advantages.

  • The usage of this ontology for any organism other than mouse or human is intended in sfaira, but broke here, will fix and update.

In any case you can plan to work with this UBERON ontology if you have developmental stages! Thanks for pointing this out! Make sure that this organism is covered in ENSEMBL by the way, otherwise this will incur another error later.

@davidsebfischer davidsebfischer self-assigned this Mar 6, 2022
@davidsebfischer davidsebfischer added the bug Something isn't working label Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants