Bio-MAGETAB

 view release on metacpan or  search on metacpan

lib/Bio/MAGETAB/Util/Reader/IDF.pm  view on Meta::CPAN

    );

    my $sdrfs = $self->_create_sdrfs();

    my $data = $self->get_text_store()->{'investigation'};
    
    my $investigation;
    if ( $investigation = $self->get_magetab_object() ) {
        while ( my ( $key, $value ) = each %{ $data } ) {
            my $setter = "set_$key";
            $investigation->$setter( $value ) if defined $value;
        }
    }
    else {
        $investigation = $self->get_builder()->find_or_create_investigation({
            %{ $data },
        });
        $self->set_magetab_object( $investigation );
    }

    $investigation->set_contacts            ( $people              ) if @$people;
    $investigation->set_protocols           ( $protocols           ) if @$protocols;
    $investigation->set_publications        ( $publications        ) if @$publications;
    $investigation->set_factors             ( $factors             ) if @$factors;
    $investigation->set_termSources         ( $term_sources        ) if @$term_sources;
    $investigation->set_designTypes         ( $design_types        ) if @$design_types;
    $investigation->set_normalizationTypes  ( $normalization_types ) if @$normalization_types;
    $investigation->set_replicateTypes      ( $replicate_types     ) if @$replicate_types;
    $investigation->set_qualityControlTypes ( $qc_types            ) if @$qc_types;
    $investigation->set_sdrfs               ( $sdrfs               ) if @$sdrfs;

    my $comments = $self->_create_comments();
    $investigation->set_comments( $comments );
    $self->get_builder()->update( $investigation );

    return $investigation;
}

# Make the classes immutable. In theory this speeds up object
# instantiation for a small compilation time cost.
__PACKAGE__->meta->make_immutable();

no Moose;

=head1 NAME

Bio::MAGETAB::Util::Reader::IDF - IDF parser class.

=head1 SYNOPSIS

 use Bio::MAGETAB::Util::Reader::IDF;
 my $parser = Bio::MAGETAB::Util::Reader::IDF->new({
     uri => $idf_filename,
 });
 my $investigation = $parser->parse();

=head1 DESCRIPTION

This class is used to parse IDF files. It can be used on its own, but
more often you will want to use the main Bio::MAGETAB::Util::Reader
class which handles extended parsing options more transparently.

=head1 ATTRIBUTES

See the L<TagValueFile|Bio::MAGETAB::Util::Reader::TagValueFile> class for superclass attributes.

=over 2

=item magetab_object

A Bio::MAGETAB::Investigation object. This can either be set upon
instantiation, or a new object will be created for you. It can be
retrieved at any time using C<get_magetab_object>.

=item document_version

A string representing the MAGE-TAB version used in the parsed
document. This is populated by the parse() method.

=back

=head1 METHODS

=over 2

=item parse

Parse the IDF pointed to by C<$self-E<gt>get_uri()>. Returns the
Bio::MAGETAB::Investigation object updated with the IDF contents.

=back

=head1 SEE ALSO

L<Bio::MAGETAB::Util::Reader::TagValueFile>
L<Bio::MAGETAB::Util::Reader::Tabfile>
L<Bio::MAGETAB::Util::Reader>
L<Bio::MAGETAB::Investigation>

=head1 AUTHOR

Tim F. Rayner <tfrayner@gmail.com>

=head1 LICENSE

This library is released under version 2 of the GNU General Public
License (GPL).

=cut

1;



( run in 0.497 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )