Man pages sections > man3 > Bio::MAGE::XML::Reader

Bio::MAGE::XML::Reader - a module for exporting MAGE-ML

MAGE::XML::Reader(3pm) User Contributed Perl Documentation MAGE::XML::Reader(3pm)

NAME

Bio::MAGE::XML::Reader - a module for exporting MAGE-ML

SYNOPSIS

  use Bio::MAGE::XML::Reader;
  my $reader = Bio::MAGE::XML::Reader->new(handler=>$handler,
                                         sax1=>$sax1,
                                         verbose=>$verbose,
                                         log_file=>\*STDERR,
                                        );
  # set the sax1 attribute
  $reader->sax1($bool);
  # get the current value
  $value = $reader->sax1();
  # set the content/document handler - this method is provided for completeness
  # the value should be set in the call to the constructor to be effective
  $reader->handler($HANDLER);
  # get the current handler
  $handler = $reader->handler();
  # set the attribute
  $reader->verbose($integer);
  # get the current value
  $value = $reader->verbose();
  # set the attribute
  $reader->log_file($filename);
  # get the current value
  $value = $reader->log_file();
  # whether to read data cubes externally (default == FALSE)
  $writer->external_data($bool);
  my $fh = \*STDOUT;
  my $mage = $reader->read($file_name);

DESCRIPTION

Methods for transforming information from a MAGE-OM objects into MAGE-ML.

ATTRIBUTE METHODS

These methods have a polymorphic setter/getter method that sets an attribute which affects the parsing of MAGE-ML. If given a value, the method will save the value to the attribute, if invoked with no argument it will return the current value of the attribute.
These attributes can all be set in the call to the constructor using the named parameter style.
sax1
This attribute determines whether a SAX1 parser and DocumentHandler or a SAX2XMLReader and a ContentHandler will be used for parsing. The default is to use a SAX2 parser.
handler
If an application needs a custom handler it can set this attribute in the call to the constructor. It is advised that the object use inherit either from Bio::MAGE::XML::Handler::ContentHandler (if using SAX2) or Bio::MAGE::DocumentHandler if using SAX1. In particular, whatever class is used, it needs to implement the following methods:
verbose
 
called with the integer parameter that specifies the desired level of output
log_file
 
called with the file handle to which ouput should be sent
init
 
called during the constructor for any needed work

parser

 Title   : parser
 Usage   : $obj->parser($newval)
 Function: 
 Example : 
 Returns : value of parser (a scalar)
 Args    : on set, new value (a scalar or undef, optional)
verbose
This attribute determines the desired level of output during the parse. The default is no output. A positive value increases the amount of information.
log_file
This attribute specifies a file handle to which parse output will be directed. It is only needed if verbose is positive.
external_data($bool)
If defined, this will cause all BioAssayData objects to read themselves out using the DataExternal format.
 
Default Value: false
resolve_identifiers
This attribute specifies whether the reader should attempt to track unhandled identifiers in the document, and then resolve them when parsing is over. This can be a huge performance hit if you know that all identifiers wil not resolve.
 
Default Value: false

INSTANCE METHODS

$self->read($file_name)
This method will open the MAGE-ML file specified by $file_name and if the "handler" attribute is not set, it will create either a SAX2 parser or a SAX1 parser (depending on the value of the C <sax1> attribute) and parse the file.
 
"read()" can read from STDIN by specifying '-' as the filename. This enables you to handle compressed XML files:
 
  gzip -dc file.xml.gz | read.pl [options]
    

POD ERRORS

Hey! The above document had some coding errors, which are explained below:
Around line 172:
You forgot a '=back' before '=head2'
Around line 190:
'=item' outside of any '=over'
2006-08-23 perl v5.18.1