BioPerl

 view release on metacpan or  search on metacpan

Bio/OntologyIO.pm  view on Meta::CPAN

sub term_factory{
    my $self = shift;

    return $self->{'term_factory'} = shift if @_;
    return $self->{'term_factory'};
}

=head1 Private Methods

  Some of these are actually 'protected' in OO speak, which means you
  may or will want to utilize them in a derived ontology parser, but
  you should not call them from outside.

=cut

=head2 _load_format_module

 Title   : _load_format_module
 Usage   : *INTERNAL OntologyIO stuff*
 Function: Loads up (like use) a module at run time on demand
 Example :
 Returns :
 Args    :

=cut

sub _load_format_module {
    my ($self, $format) = @_;
    my $module = "Bio::OntologyIO::" . $format;
    my $ok;

    eval {
        $ok = $self->_load_module($module);
    };
    if ( $@ ) {
        print STDERR <<END;
$self: $format cannot be found
Exception $@
For more information about the OntologyIO system please see the docs.
This includes ways of checking for formats at compile time, not run time
END
    }
    return $ok;
}

sub DESTROY {
    my $self = shift;

    $self->close();
}

sub _map_format {
    my $self = shift;
    my $format = shift;
    my $mod;

    if($format) {
        $mod = $format_driver_map{lc($format)};
        $mod = lc($format) unless $mod;
    } else {
        $self->throw("unable to guess ontology format, specify -format");
    }
    return $mod;
}

sub unescape {
  my( $self, $ref ) = @_;
  $ref =~ s/&lt\\;/\</g;
  $ref =~ s/&gt\\;/\>/g;
  $ref =~ s/&pct\\;/\%/g;
  $ref =~ s/\\n/\n/g;
  $ref =~ s/\\t/\t/g;
  return $ref;
}

1;



( run in 2.047 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )