The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

GO::IO::ObanOwl;

SYNOPSIS

my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
my $term = $apph->get_term({acc=>00003677});
#### ">-" is STDOUT
my $out = new FileHandle(">-");
my $xml_out = GO::IO::XML->new(-output=>$out);
$xml_out->start_document();
$xml_out->draw_term($term);
$xml_out->end_document();

OR:

my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
my $term = $apph->get_node_graph(-acc=>00003677, -depth=>2);
my $out = new FileHandle(">-");
my $xml_out = GO::IO::XML(-output=>$out);
$xml_out->start_document();
$xml_out->draw_node_graph($term, 3677);
$xml_out->end_document();

DESCRIPTION

Utility class to dump GO terms as xml. Currently you just call start_ducument, then draw_term for each term, then end_document.

If there's a need I'll add draw_node_graph, draw_node_list, etc.

new

Usage - my $xml_out = GO::IO::XML->new(-output=>$out);
Returns - None
Args - Output FileHandle

Initializes the writer object. To write to standard out, do:

my $out = new FileHandle(">-"); my $xml_out = new GO::IO::XML(-output=>$out);

xml_header

Usage - $xml_out->xml_header;
Returns - None
Args - None

start_document prints the "Content-type: text/xml" statement. If creating a cgi script, you should call this before start_document.

start_document

Usage - $xml_out->start_document(-timestamp=>$time);
Returns - None
Args - optional: timestamp string, pre-formatted

start_ducument takes care of the fiddly bits like xml declarations, namespaces, etc. It draws the initial tags and leaves the document ready to add go:term nodes.

end_document

Usage - $xml_out->end_document();

Call this when done.

draw_node_graph

Usage - $xml_out->draw_node_graph(-graph=>$graph);
Returns - None
Args -graph=>$node_graph,
-focus=>$acc, ## optional
-show_associations=>"yes" or "no" ## optional

draw_term

Usage - $xml_out->draw_term();
Returns - None
Args -term=>$term,
-graph=>$graph,
-is_focus=>"yes" or "no", ## optional
-show_associations=>"yes" or "no", ## optional
-show_terms=>"yes" or "no", ## optional, just draws associations

sub characters

This is simply a wrapper to XML::Writer->characters
which strips out any non-ascii characters.

sub dataElement

This is simply a wrapper to XML::Writer->dataElement
which strips out any non-ascii characters.