InterMine::Item::Document - a module for writing InterMine-Items-XML files
use InterMine::Model; use InterMine::Item::Document; my ($model_file, $output_file) = @ARGV; my $model = InterMine::Model->new(file => $model_file); my $doc = InterMine::Item::Document->new( model => $model, output => $output_file, # defaults to STDOUT auto_write => 1, # automatically write each item as it is made ); my $organism = $doc->add_item( "Organism", "taxonId" => 7227 ); my $pub1 = $doc->add_item( "Publication", "pubMedId" => 11700288, ); my $pub2 = $doc->make_item( "Publication", "pubMedId" => 16496002, ); $doc->add_item( 'Gene', 'identifier' => "CG10811", 'organism' => $organism, 'publications' => [$pub1, $pub2], ); $doc->close; # writes the end tags - only needed when auto_write is on
This module allows you to make and write out InterMine-Items-XML for integrating data into InterMine databases
FlyMine <support@flymine.org>
<support@flymine.org>
Please report any bugs or feature requests to support@flymine.org.
support@flymine.org
You can find documentation for this module with the perldoc command.
perldoc InterMine::ItemFactory
You can also look for information at:
FlyMine
http://www.flymine.org
Documentation
http://www.intermine.org/wiki/ItemsAPIPerl
Copyright 2006,2007,2008 FlyMine, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
return a factory that can be used to create Item objects.
$document = new InterMine::Item::Document(model => $model);
Args:
Function : Return the writer for this document
Function : add the given key value pairs to the default fields list that will be appplied to every item made. If a default field is not valid for a particular item, it will not be set.
Function : get the current default fields Returns : a hash in list context, or a hash-reference in scalar context
Function : write all unwritten items to the xml output. This is called automatically on item creation if auto_write is set.
Function : close the document by writing any unwritten items and closing the items tag.
Title : make_item Usage : $item = $doc->make_item("Gene", [%attributes]); Function: return a new Item object of the given type while not storing it Args : the classname of the new Item Any attributes for the item
Title : add_item Usage : $item = $doc->add_item("Gene"); Function: return a new Item object of the given type, while storing it in an internal record for writing out later Args : the classname of the new Item Any attributes for the item
To install InterMine::Item, copy and paste the appropriate command in to your terminal.
cpanm
cpanm InterMine::Item
CPAN shell
perl -MCPAN -e shell install InterMine::Item
For more information on module installation, please visit the detailed CPAN module installation guide.