pronto icon indicating copy to clipboard operation
pronto copied to clipboard

How to delete terms in ontology?

Open saiden89 opened this issue 3 years ago • 2 comments

Hi, I've read the documentation quite extensively, yet I haven't found any method or function to delete a term from an ontology. For example:

from pronto import Ontology
go = Ontology("http://purl.obolibrary.org/obo/go.obo")

If I try

del go['GO:0000001']

I get:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-29-441de0cde0ef> in <module>
----> 1 del go['GO:0000001']

TypeError: 'Ontology' object does not support item deletion

Is there any way to achieve item deletion?

saiden89 avatar May 31 '21 17:05 saiden89

Short story: there is none for now.

Basically, there are plenty of places where a term can be referenced, and a deletion routine should either make sure these references don't exist anymore, or delete them as well. I've been postponing this because until now my impression was that pronto was mostly used to perform read-only access to ontologies, but I can add it to the roadmap for the next release if that's something you'd need!

althonos avatar Jun 05 '21 15:06 althonos

I imagined something like this, but I asked just to be sure. For the moment I've solved the problem using owlready2, even if sometimes is randomly unreliable in destroying entities It wouldn't hurt to have such a functionality in a future release, but there is no need to rush. Thank you for the explanation, and kudos for the library!

saiden89 avatar Jun 08 '21 19:06 saiden89