| GOBO documentation | view source | Contained in the GOBO distribution. |
Skip the rest of this stanza and go to the next
input: self, optional hashref of stanza types to parse
if the hashref is specified, will continue to skip stanzas until the stanza type matches one of those in the hash ref
GOBO::Parsers::OBOParser
my $parser = new GOBO::Parsers::OBOParser(file => "t/data/cell.obo"); $parser->parse; print $parser->graph; my $writer = new GOBO::Writers::OBOWriter; $writer->graph($parser->graph); $writer->write();
An GOBO::Parsers::Parser that parses OBO Files.
The goal is to be obof1.3 compliant:
http://www.geneontology.org/GO.format.obo-1_3.shtml
however, obof1.2 and obof1.0 are also supported
These are converted to GOBO::TermNode objects
These are converted to GOBO::RelationNode objects
These are converted to GOBO::InstanceNode objects
is_a and relationship tags are converted to GOBO::LinkStatement objects and added to the graph
The default behaviour of the parser is to parse everything it comes across. Customized parsing can be achieved by giving the parser a hash ref of options encoding the parsing preferences:
$parser->set_options($options);
To set parser options, use the following structures:
Body parsing instructions should be contained in the options hash with the key 'body':
$options->{body} = ...
## parsing or ignore tags
# parse only tag_1, tag_2 and tag_3 from $stanza_type stanzas $options->{body}{parse_only}{$stanza_type} = [ 'tag_1', 'tag_2', 'tag_3' ],
# ignore 'tag_4', 'tag_5', 'tag_6' from $stanza_type stanzas $options->{body}{ignore}{$stanza_type} = [ 'tag_4', 'tag_5', 'tag_6' ],
## parsing or ignoring stanzas
# parse only stanzas where the type matches the key $stanza_type $options->{body}{parse_only}{ $stanza_type } = '*'
# ignore stanzas where the type matches the key $stanza_type $options->{body}{ignore}{ $stanza_type } = '*'
# ignore all information in the body $options->{body}{ignore} = '*';
There is no need to specify $options->{body}{parse_only} = '*' : this is the default behaviour. There is also no need to specify both 'ignore' and 'parse_only'.
# parse everything from the header; parse only instance stanzas and the id, name and namespace tags from term stanzas $parser->set_options({ body => { parse_only => { term => [ qw(id name namespace) ] }, instance => '*' } });
# ignore the header; parse everything in the body $parser->set_options({ header => { ignore => '*' } });
# parse the date from the header; ignore instance and annotation stanzas $parser->set_options({ header => { parse_only => [ 'date' ] }, body => { ignore => { instance => '*', annotation => '*' }, }, });
| GOBO documentation | view source | Contained in the GOBO distribution. |