/usr/share/perl5/Bio/FeatureIO/chado.pm is in libchado-perl 1.23-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | package Bio::FeatureIO::chado;
use strict;
use base qw(Bio::FeatureIO);
use Bio::SeqIO;
use Bio::Chado::LoadDBI;
use Data::Dumper;
sub _initialize {
my($self,%arg) = @_;
$self->SUPER::_initialize(%arg);
$self->feature_count(0);
$self->organism($arg{-organism} || 'Human');
$self->cachesize($arg{-cachesize} || 1000);
}
sub next_feature {
shift->throw('this class only writes to database');
}
sub write_feature {
my($self,$feature) = shift;
}
=head2 cache
Title : cache
Usage : $obj->cache($newval)
Function: cache an object for commit to db. when number of
items in cache exceeds cachesize(), objects are flushed
Example :
Returns : value of cache (a scalar)
Args : on set, new value (a scalar or undef, optional)
=cut
sub cache{
my $self = shift;
my $val = shift;
push @{ $self->{'cache'} }, $val if ref($val);
if(scalar @{ $self->{'cache'} } > $self->cachesize){
$_->dbi_commit foreach @{ $self->{'cache'} };
@{ $self->{'cache'} } = ();
}
}
=head2 cachesize
Title : cachesize
Usage : $obj->cachesize($newval)
Function: number of features to cache before flushing to db
Example :
Returns : value of cachesize (a scalar)
Args : on set, new value (a scalar or undef, optional)
=cut
sub cachesize{
my $self = shift;
return $self->{'cachesize'} = shift if @_;
return $self->{'cachesize'};
}
=head2 organism
Title : organism
Usage : $obj->organism($newval)
Function: organism of features being loaded
Example :
Returns : value of organism (a scalar)
Args : on set, new value (a scalar or undef, optional)
=cut
sub organism{
my $self = shift;
return $self->{'organism'} = shift if @_;
return $self->{'organism'};
}
1;
|