Import ontology file to an ontology_DAG object
import_obo(
file,
relation_type = character(0),
inherit_relations = TRUE,
verbose = simona_opt$verbose,
...
)
import_owl(
file,
relation_type = character(0),
inherit_relations = TRUE,
verbose = simona_opt$verbose,
...
)
import_ontology(
file,
robot_jar = simona_opt$robot_jar,
JAVA_ARGS = "",
verbose = simona_opt$verbose,
...
)
import_ttl(file, relation_type = "part_of", verbose = simona_opt$verbose, ...)
Path of the ontology file or an URL.
Semantic relation types to include. Note is_a
relation is always included.
Relations may also be structured as a DAG. It controls whether to merge with a relations's offspring relations.
Whether to print messages.
Pass to create_ontology_DAG()
.
The path of the robot.jar
file. It can be downloaded from https://github.com/ontodev/robot/releases.
Internally, the file is converted to the obo format and parsed by import_obo()
. The value of robot_jar
can be
set as a global option simona_opt$robot_jar = ...
.
Options for java
. For example you can set -Xmx20G
if you want to increase the memory to 20G for java.
An ontology_DAG
object.
Public bio-ontologies can be obtained from Ontology Foundry or BioPortal.
The import_obo()
function parses the ontology file in .obo
format. To parse other formats, external tool robot.jar
is required.
import_owl()
only recognizes <owl:Class>
and <owl:ObjectProperty>
. If the .owl file does not contain these tags,
please use import_ontology()
directly.
robot.jar
can automatically recognize the following formats:
json
: OBO Graphs JSON
obo
: OBO Format
ofn
: OWL Functional
omn
: Manchester
owl
: RDF/XML
owx
: OWL/XML
ttl
: Turtle
The description of the ROBOT tool is at http://robot.obolibrary.org/convert.
import_ttl()
is a simple parser for the .ttl
format files. It only recognizes
terms that have the owl:Class
object. The "is_a" relation is recognized by the predicate rdfs:subClassOf
or an ontology-specific predicate that contains .*/isa
. Other relation types are defined with
the predicate owl:ObjectProperty
. The format is parsed by a Perl script system.file("scripts", "parse_ttl.pl", package = "simona")
.
# \donttest{
# The plant ontology: http://obofoundry.org/ontology/po.html
import_obo("https://raw.githubusercontent.com/Planteome/plant-ontology/master/po.obo")
#> Parsing [Typedef] sections in the obo file [13/13]
#> Parsing [Term] sections in the obo file [1000/1791]
#> Parsing [Term] sections in the obo file [1791/1791]
#> remove 134 obsolete terms
#> There are more than one root:
#> PO:0009012, PO:0025131
#> A super root (~~all~~) is added.
#> An ontology_DAG object:
#> Source: po, releases/2024-04-17
#> 1658 terms / 1778 relations
#> Root: ~~all~~
#> Terms: PO:0000001, PO:0000002, PO:0000003, PO:0000004, ...
#> Max depth: 11
#> Avg number of parents: 1.07
#> Avg number of children: 1.06
#> Aspect ratio: 39:1 (based on the longest distance from root)
#> 38.2:1 (based on the shortest distance from root)
#> Relations: is_a
#>
#> With the following columns in the metadata data frame:
#> id, short_id, name, namespace, definition
# }
# \donttest{
import_owl("http://purl.obolibrary.org/obo/po.owl")
#> Parsing 13 <owl:ObjectProperty> ...
#> Parsing 1996 <owl:Class> ...
#> Parsing 81 <rdf:Description> ...
#> remove 337 obsolete terms
#> There are more than one root:
#> PO:0009012, PO:0025131
#> A super root (~~all~~) is added.
#> An ontology_DAG object:
#> Source: Plant Ontology, http://purl.obolibrary.org/obo/po/releases/2024-04-17/po.owl
#> 1658 terms / 1778 relations
#> Root: ~~all~~
#> Terms: PO:0000001, PO:0000002, PO:0000003, PO:0000004, ...
#> Max depth: 11
#> Avg number of parents: 1.07
#> Avg number of children: 1.06
#> Aspect ratio: 39:1 (based on the longest distance from root)
#> 38.2:1 (based on the shortest distance from root)
#> Relations: is_a
#>
#> With the following columns in the metadata data frame:
#> id, short_id, name, namespace, definition
# }
# \dontrun{
# The plant ontology: http://obofoundry.org/ontology/po.html
dag = import_ontology("http://purl.obolibrary.org/obo/po.owl", robot_jar = ...)
#> Error in eval(expr, envir, enclos): '...' used in an incorrect context
# }
# \donttest{
# file is from https://bioportal.bioontology.org/ontologies/MSTDE
import_ttl("https://jokergoo.github.io/simona/MSTDE.ttl")
#> Downloading https://jokergoo.github.io/simona/MSTDE.ttl...
#> Parsing .ttl file...
#> Constructing the DAG_ontology object...
#> There are more than one root:
#> http://purl.bioontology.org/ontology/MSTDE/MT010001,
#> http://purl.bioontology.org/ontology/MSTDE/MT020001,
#> http://purl.bioontology.org/ontology/MSTDE/MT030001,
#> http://purl.bioontology.org/ontology/MSTDE/MT050008,
#> http://purl.bioontology.org/ontology/MSTDE/MT050027,
#> and other 272 terms ...
#> A super root (~~all~~) is added.
#> An ontology_DAG object:
#> Source: file183a02fffee32_MSTDE.ttl
#> 1411 terms / 1415 relations
#> Root: ~~all~~
#> Terms: http://purl.bioontology.org/ontology/MSTDE/MT010001,
#> http://purl.bioontology.org/ontology/MSTDE/MT010002,
#> http://purl.bioontology.org/ontology/MSTDE/MT010003,
#> http://purl.bioontology.org/ontology/MSTDE/MT010004, ...
#> Max depth: 6
#> Avg number of parents: 1.00
#> Avg number of children: 1.00
#> Aspect ratio: 161.4:1 (based on the longest distance from root)
#> 162:1 (based on the shortest distance from root)
#> Relations: is_a, part_of
#>
#> With the following columns in the metadata data frame:
#> id, name, short_id, definition
# }