Scroll to navigation

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


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


  use Bio::MAGE::XMLUtils;
  my $writer = Bio::MAGE::XML::Writer->new(@args);
  # attributes to modify where the output is written
  # set the output filehandle
  my $fh = \*STDOUT;
  # whether to write data cubes externally (default == FALSE)
  # which directory to write external data cubes (default == /tmp)
  # whether the to interpret the C<cube> as data or a file
  # path (default == FALSE)
  # attributes to modify the output format
  # which format is the external data file
  # to change the level of indent for each new tag (defaul == 2)
  # to change the beginning indent level (defaul == 0)
  # set to true to not format attributes (default == FALSE)
  # how many extra spaces attributes should be indented past start
  # tag end (default == 1)
  # whether to write all sub-tags on the same line (default == undef)
  # attributes to modify the the document
  # to change the encoding (default == ISO-8859-1)
  # to set the public id (default == undef)
  # to change the system id (default == MAGE-ML.dtd)
  # check to see that objects set more than just identifier (default == TRUE)
  # attributes to handle identifiers
  # whether to create identifiers if not specified (default == FALSE)
  # code reference to be invoked for creating new identifiers


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


"write()" prints the objects contained in $MAGE_object as MAGE-ML to the file handle used by the writer.


  The following methods must all be invoked using an instance of Bio::MAGE::XML::Writer;
This attribute controls the current level of indentation while writing a document. It should not be manipulated by users, unless for some reason you wanted to set the starting indent level to something other than zero.

Default Value: 0 (zero)

This attribute controls the the number of spaces that added to the indent for every new level of elements.

Default Value: 2

This attribute controls whether attribute values should be pretty-printed. If true, attributes will not pretty-printed, but will instead be written out all on one line.

Default Value: false

Controls how many spaces past the end start tag that attributes should be indented. This example shows an "attr_inden" of 1:

      <Reporter identifier="Reporter:X Units Per Pixel"
                name="X Units Per Pixel">

The following illustrates and "attr_indent" of -2:

      <Person firstName="John"
           identifier="Person:John Smith"
           name="John Smith"

Default Value: 1

This attribute is not very useful at the moment. In the future it may be used to specify tags that should have their contents all on a single line.

Currently it controls whether or not to write a newline after each elements start tag, with no method to decide to write or not to write based on the name of the tag.

Default Value: false

This is the value that value be written out as the encoding attribute for the XML Declaration of the output MAGE-ML document:

  <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>

Default Value: ISO-8859-1

If defined, this value will be written out as the value of the PUBLIC attribute of the DOCTYPE tag in the output MAGE-ML document.

Default Value: undef

If defined, this value will be written out as the value of the SYSTEM attribute of the DOCTYPE tag in the output MAGE-ML document:


Default Value: MAGE-ML.dtd

This attribute stores a code reference that will be invoked to create a new identifier for any object that does not already have one defined. This will happen only if the "generate_new_identifiers" attribute is set to true.

Default Value: \&identifier_generation

If this attribute is set to true, the code reference store in the "generate_identifier" attribute will be invoked to create a new identifier for any object that does not already have one defined.

Default Value: false

This is the file handle to which the MAGE-ML document will be written.

Default Value: undef

If defined, this will cause all BioAssayData objects to write themselves out using the DataExternal format.

Default Value: false

$format is either 'tab delimited' or 'space delimited'

Default Value: 'tab delimited'

The "fh" attribute only controls where the main MAGE-ML document is written. If the "external_data" attribute is set, the writer will also create a separate external data file for each data cube.

The "external_data_dir" controls what director those files are written to.

Default Value: /tmp

Sometimes, you already have your data written to an external file, and you simply want to reuse the file without any extra overhead. The "cube_holds_path" attribute controls indicates that you are storing the path to the external file in the "cube" attribute of the "BioDataCube" objects.

Default Value: false

If true, all objects that define an "identifier" attribute and no other attributes will only be included as <*_ref> elements.

NOTE: Currently no checking of association values is made, only attributes. So if you want to ensure that an Identifiable object is written, make sure that you set the "name" attribute as well as the "identifier" attribute.

Default Value: true


Hey! The above document had some coding errors, which are explained below:

'=item' outside of any '=over'
You forgot a '=back' before '=head1'
=over without closing =back
2020-12-01 perl v5.32.0