ROBOT

- - - - - - - - - -
view on github
getting started
common errors
chaining commands
global options
makefile
- - - - - - - - - -
annotate
convert
diff
explain
extract
filter
materialize
merge
mirror
query
reason
reduce
relax
remove
rename
repair
report
template
unmerge
validate
verify
- - - - - - - - - -
ROBOT is licensed under the
BSD 3-Clause License.
Theme by orderedlist

Filter

The filter command allows you to create a new ontology from a source ontology by copying only the selected axioms. The remove command is the opposite of filter, allowing you to remove selected axioms. filter accepts the same options as remove and processes them in the same order. See remove for details on configuring the options.

Each axiom refers to one or more entities: classes, object properties, annotation properties, etc. By default, filter will copy axioms from the input ontology for which all the entities are in the specified set. To be more relaxed and copy axioms that contain one or more entities from the specified set, use --trim false. This will usually leave some “dangling references” to entities that were not in the specified set.

This operation maintains structural integrity; lineage is maintained, and gaps will be filled where classes have been excluded. If you wish to not preserve the hierarchy, include --preserve-structure false.

Annotations

The filter command also includes a special --select "annotations" option. If this is included, all annotations on filtered terms will be copied, regardless of if those properties are in the set of terms or not.

The following command will only return OBI:0000070 with just a label annotation:

robot filter --input obi.owl --term OBI:0000070 --term rdfs:label

Alternatively, if you want OBI:0000070 with all annotations:

robot filter --input obi.owl --term OBI:0000070 --select annotations

Examples

Copy a class (‘organ’) and all its descendants, with all annotations:

robot filter --input uberon_module.owl\
 --term UBERON:0000062\
 --select "annotations self descendants"\
 --output results/filter_class.owl

Copy all of OBI except descendants of ‘assay’ (remove is preferred):

robot filter --input uberon_module.owl\
 --term UBERON:0000062\
 --select annotations\
 --select descendants\
 --select complement\
 --output results/remove_class.owl

Copy a subset of classes based on an annotation property (maintains hierarchy):

robot filter --input uberon_module.owl\
 --prefix "core: http://purl.obolibrary.org/obo/uberon/core#"\
 --select "oboInOwl:inSubset=core:uberon_slim"\
 --select annotations\
 --output results/uberon_slim.owl

Copy a class, all axioms that a class appears in, annotations on all classes used, and the ontology annotations:

robot filter --input uberon_module.owl\
 --term UBERON:0000062\
 --select "ontology annotations"\
 --trim false\
 --output results/uberon_annotated.owl