Bio-DB-SeqFeature
view release on metacpan or search on metacpan
lib/Bio/DB/SeqFeature/Store/Loader.pm view on Meta::CPAN
sub msg {
my $self = shift;
my @msg = @_;
return unless $self->verbose;
print STDERR @msg;
}
=item loaded_ids
my $ids = $loader->loaded_ids;
my $id_cnt = @$ids;
After performing a load, this returns an array ref containing all the
feature primary ids that were created during the load.
=cut
sub loaded_ids {
my $self = shift;
my @ids = values %{$self->{load_data}{Local2GlobalID}}
if $self->{load_data};
return \@ids;
}
=item local_ids
my $ids = $self->local_ids;
my $id_cnt = @$ids;
After performing a load, this returns an array ref containing all the
load file IDs that were contained within the file just loaded.
=cut
sub local_ids {
my $self = shift;
my @ids = keys %{$self->{load_data}{Local2GlobalID}}
if $self->{load_data};
return \@ids;
}
=item time
my $time = $loader->time
This method returns the current time in seconds, using Time::HiRes if available.
=cut
sub time {
return Time::HiRes::time() if Time::HiRes->can('time');
return time();
}
=item unescape
my $unescaped = GFF3Loader::unescape($escaped)
This is an internal utility. It is the same as CGI::Util::unescape,
but doesn't change pluses into spaces and ignores unicode escapes.
=cut
sub unescape {
my $self = shift;
my $todecode = shift;
$todecode =~ s/%([0-9a-fA-F]{2})/chr hex($1)/ge;
return $todecode;
}
sub DESTROY {
my $self = shift;
# Close filehandles, so temporal files can be properly deleted
my $store = $self->store;
if ( $store->isa('Bio::DB::SeqFeature::Store::memory')
or $store->isa('Bio::DB::SeqFeature::Store::berkeleydb3')
) {
$store->private_fasta_file->close;
if ($store->{fasta_db} && !$self->{no_close_fasta}) {
while (my ($file, $fh) = each %{ $store->{fasta_db}->{fhcache} }) {
$fh->close;
}
$store->{fasta_db}->_close_index($store->{fasta_db}->{offsets});
}
}
elsif ($store->isa('Bio::DB::SeqFeature::Store::DBI::SQLite')) {
if (%DBI::installed_drh) {
DBI->disconnect_all;
%DBI::installed_drh = ();
}
undef $store->{dbh};
}
if (my $ld = $self->{temp_load}) {
unlink $ld;
}
}
1;
__END__
=back
=head1 BUGS
This is an early version, so there are certainly some bugs. Please
use the BioPerl bug tracking system to report bugs.
=head1 SEE ALSO
L<bioperl>,
L<Bio::DB::SeqFeature::Store>,
L<Bio::DB::SeqFeature::Segment>,
L<Bio::DB::SeqFeature::NormalizedFeature>,
L<Bio::DB::SeqFeature::Store::GFF3Loader>,
L<Bio::DB::SeqFeature::Store::DBI::mysql>,
L<Bio::DB::SeqFeature::Store::berkeleydb>
=head1 AUTHOR
( run in 0.750 second using v1.01-cache-2.11-cpan-39bf76dae61 )