Giter Site home page Giter Site logo

Comments (14)

puethe avatar puethe commented on August 19, 2024 1

Thanks! That's very helpful and works for me.

Since the 'term' and 'typedef' stanzas are structurally very similar, at least in obo, I personally probably would have created a base class from which both the 'Term' class and a similar 'Typedef' class inherit. That would allow catching the remaining properties of the typedefs, such as comments, definitions etc.

None of this, however, is crucial for me now, and might also just be my personal use case. So just go ahead and make a release if you like. Thanks again!

from pronto.

althonos avatar althonos commented on August 19, 2024

Actually they are extracted from OBO files, and used to instantiate new relationships. They are not however accessible from the Ontology they were extracted from, which would be a nice feature.

from pronto.

althonos avatar althonos commented on August 19, 2024

As a test:

>>> import pronto
>>> mondo = pronto.Ontology('http://purl.obolibrary.org/obo/mondo.obo')
>>> mondo['MONDO:0000065'].relations
{Relationship('disease_arises_from_feature'): [<MONDO:0005015: diabetes mellitus (disease)>],
 Relationship('is_a'): [<MONDO:0005385 {source="DC:0000281"}: >,
                        <MONDO:0020573: genetic predisposition to disease>]}

(disease_arises_from_feature is typedefed in the mondo.obo file).

from pronto.

vlmir avatar vlmir commented on August 19, 2024

from pronto.

althonos avatar althonos commented on August 19, 2024

Hi Vladimir,
I was talking about this, but I didn't think about the exported OBO, and indeed it will contain no typedefs, which is a problem.

What I think I'll do is adding a typedefs attribute to Ontology instances, containing only the typedefs defined in the ontology file. I will then be able to serialized only the referenced typedefs when exporting.

I don't think this will be too complicated to do, so I'll try to work on it this week-end.

from pronto.

vlmir avatar vlmir commented on August 19, 2024

from pronto.

althonos avatar althonos commented on August 19, 2024

It parses them but do not hold them in ontology objects, only as Relationship instances.

The Turtle parser will probably take more time since I'm not familiar with the format or the available parser libraries.

Exporting ontologies to JSON is already possible, though, using the Ontology.json property ! 😉 Although it's more of a dump of the internal data representation, and does not follow a specific JSON ontology format (such as obojson).

from pronto.

vlmir avatar vlmir commented on August 19, 2024

from pronto.

althonos avatar althonos commented on August 19, 2024

It's listed on the Ontology reference (http://pronto.readthedocs.io/en/latest/pronto/pronto.Ontology.html#pronto.Ontology.json), but the documentation is not explanatory at all 😊

Basically the JSON should contain all terms referenced by accession, as well as metadata.

from pronto.

vlmir avatar vlmir commented on August 19, 2024

from pronto.

puethe avatar puethe commented on August 19, 2024

Hi there,
I just stumbled over the same issue. Have you managed to have a look at it yet?
I'm using Pronto to import data from ontology files into a database and basically can't establish relationships between terms before adding the corresponding typedefs to the database.
If you don't have the time, I can also offer to have a look at it myself and open a pull request. Let me know.
Cheers,
Christoph

from pronto.

althonos avatar althonos commented on August 19, 2024

@puethe: I added a typedef attribute to Ontology instances, and added a obo property to the Relationship class so now exporting an ontology to obo format will export the [Typedef] stanzas, and you'll be able to access the typedefs declared in an ontology.

Could you test the master branch a bit to tell me if you need anything before I make a release ?

from pronto.

althonos avatar althonos commented on August 19, 2024

@puethe : I really wish I had more time to put into this library ! 😉

from pronto.

althonos avatar althonos commented on August 19, 2024

Fixed in release 0.11.0.

from pronto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.