go-filter-subset.pl(1) extracts a subgraph from an ontology file


go-filter-subset.pl -id GO:0003767 go.obo
go-filter-subset.pl -id GO:0003767 -to png go.obo | xv -
go-filter-subset.pl -filter_code 'sub{shift->name =~ /transcr/}' go.obo


Exports a subset of an ontology from a file. The subset can be based on a specified set of IDs, a preset ``subset'' filter in the ontology file (eg a GO ``slim'' or subset), or a user-defined filter.

The subset can be exported in any format, including a graphical image


-id ID
ID to use as leaf node in subgraph. All ancestors of this ID are included in the exported graph (unless -partial is set)

Multiple IDs can be passed

  -id ID1 -id ID2 -id ID3 ....etc
-subset SUBSET_ID
Extracts a named subset from the ontology file. (only works with obo format files). For example, a specific GO slim

ONLY terms belonging to the subset are exported - the -partial option is automatically set

-namespace NAMESPACE
only terms in this namespace
-filter_code SUBROUTINE
advanced option

A subroutine with which the GO::Model::Term object is tested for inclusion in the subgraph (all ancestors are automatically included)

You should have an understanding of the go-perl object model before using this option


  go-filter-subset -filter_code 'sub {shift->namespace eq 'molecular_function'}' go.obo

(the same things can be achieved with the -namespace option)

If this is set, then only terms that match the user query are included. Parentage is set to the next recursive parent node in the filter

For example, with the -subset option: if X and Y belong to the subset, and Z does not, and X is_a Z is_a Y, then the exported graph withh have X is_a Y

If this switch is specified, then caching mode is turned on.

With caching mode, the first time you parse a file, then an additional file will be exported in a special format that is fast to parse. This file will have the same filename as the original file, except it will have the ``.cache'' suffix.

The next time you parse the file, this program will automatically check for the existence of the ``.cache'' file. If it exists, and is more recent than the file you specified, this is parsed instead. If it does not exist, it is rebuilt.