OWL::Simple::Parser
use OWL::Simple::Parser; # load Experimental Factor Ontology (http://www.ebi.ac.uk/efo/efo.owl) my $parser = OWL::Simple::Parser->new( owlfile => 'efo.owl', synonym_tag => 'efo:alternative_term', definition_tag => 'efo:definition' ); # parse file $parser->parse(); # iterate through all the classes for my $id (keys %{ $parser->class }){ my $OWLClass = $parser->class->{$id}; print $id . ' ' . $OWLClass->label . "\n"; # list synonyms for my $syn (@{ $OWLClass->synonyms }){ print "\tsynonym - $syn\n"; } # list definitions for my $def (@{ $OWLClass->definitions }){ print "\tdef - $def\n"; } # list parents for my $parent (@{ $OWLClass->subClassOf }){ print "\tsubClassOf - $parent\n"; } }
A simple OWL parser loading accessions, labels and synonyms and exposes them as a collection of OWL::Simple::Class objects.
This module wraps XML::Parser, which is a sequential event-driven XML parser that can potentially handle very large XML documents. The whole XML structure is never loaded into memory completely, only the bits of interest.
In the constructor specify the owlfile to be loaded and two optional tags - synonym_tag or definition_tag that define custom annotations in the ontology for synonyms and definitions respectively. Note both tags have to be fully specified exactly as in the OWL XML to be loaded, e.g. FULL_SYN for NCI Thesaurus or efo:alternative_term for EFO.
Number of classes loaded by the parser.
Number of synonyms loaded by the parser.
Version of the ontology extracted from the owl:versionInfo.
Hash collection of all the OWL::Simple::Class objects
Tomasz Adamusiak <tomasz@cpan.org>
Copyright (c) 2010-2011 European Bioinformatics Institute. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under lGPLv3.
This software is provided "as is" without warranty of any kind.
To install OWL::Simple::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OWL::Simple::Class
CPAN shell
perl -MCPAN -e shell install OWL::Simple::Class
For more information on module installation, please visit the detailed CPAN module installation guide.