Commit 4b728760 authored by Web Admin's avatar Web Admin
Browse files

fix cache and DBentry problems

parent cd90eeb4
......@@ -424,6 +424,7 @@ sub fetch_all_by_Slice_constraint {
}
#for speed the remapping to slice may be done at the time of object creation
warn( "$constraint" );
my $features =
$self->generic_fetch($constraint, $logic_name, $mapper, $slice);
......
......@@ -103,7 +103,7 @@ sub fetch_by_chr_name{
$self->{'_chr_name_cache'} = {};
}
unless($self->{'_chr_name_cache'}->{$chr_name}) {
unless($self->{'_chr_name_cache'}->{lc($chr_name)}) {
my $sth;
$sth = $self->prepare( "SELECT chromosome_id, name, length
......@@ -116,7 +116,7 @@ sub fetch_by_chr_name{
$self->_create_object_from_arrayref( $a );
}
return $self->{'_chr_name_cache'}->{$chr_name};
return $self->{'_chr_name_cache'}->{lc($chr_name)};
}
......@@ -162,7 +162,7 @@ sub _create_object_from_arrayref {
-chr_name => $a->[1], -length => $a->[2]
);
return $self->{'_chr_cache' }->{$a->[0]} =
$self->{'_chr_name_cache'}->{$a->[1]} = $chr ;
$self->{'_chr_name_cache'}->{lc($a->[1])} = $chr ;
}
sub store{
......
......@@ -250,6 +250,7 @@ sub fetch_by_chr_band {
my $type = $self->db->assembly_type();
warn( "XX>" ,$chr, "--", $band );
my $sth = $self->db->prepare("
select min(k.chr_start), max(k.chr_end)
from chromosome as c, karyotype as k
......@@ -258,6 +259,7 @@ sub fetch_by_chr_band {
$sth->execute( $chr, "$band%" );
my ( $slice_start, $slice_end) = $sth->fetchrow_array;
warn( $chr, "--", $band );
unless( defined($slice_start) ) {
my $sth = $self->db->prepare("
select min(k.chr_start), max(k.chr_end)
......
......@@ -481,6 +481,36 @@ sub update {
}
=head2 fetch_all_by_DBEntry
Arg [1] : in $external_id
the external identifier for the transcript to be obtained
Example : @trans = @{$trans_adaptor->fetch_all_by_DBEntry($ext_id)}
Description: retrieves a list of transcripts with an external database
idenitifier $external_id
Returntype : listref of Bio::EnsEMBL::DBSQL::Transcript in contig coordinates
Exceptions : none
Caller : ?
=cut
sub fetch_all_by_DBEntry {
my $self = shift;
my $external_id = shift;
my @trans = ();
my $entryAdaptor = $self->db->get_DBEntryAdaptor();
my @ids = $entryAdaptor->transcriptids_by_extids($external_id);
foreach my $trans_id ( @ids ) {
my $trans = $self->fetch_by_dbID( $trans_id );
if( $trans ) {
push( @trans, $trans );
}
}
return \@trans;
}
1;
......
......@@ -198,4 +198,35 @@ sub remove {
$translation->dbID( undef ); #don't think this line works
}
=head2 fetch_all_by_DBEntry
Arg [1] : in $external_id
the external identifier for the translation to be obtained
Example : @trans = @{$trans_adaptor->fetch_all_by_DBEntry($ext_id)}
Description: retrieves a list of translation with an external database
idenitifier $external_id
Returntype : listref of Bio::EnsEMBL::DBSQL::Translation in contig coordinates
Exceptions : none
Caller : ?
=cut
sub fetch_all_by_DBEntry {
my $self = shift;
my $external_id = shift;
my @trans = ();
my $entryAdaptor = $self->db->get_DBEntryAdaptor();
my @ids = $entryAdaptor->translationids_by_extids($external_id);
foreach my $trans_id ( @ids ) {
my $trans = $self->fetch_by_dbID( $trans_id );
warn $trans_id;
if( $trans ) {
push( @trans, $trans );
}
}
return \@trans;
}
1;
{
'port' => 3306,
'port' => 3307,
'driver' => 'mysql',
'user' => 'ensadmin',
'pass' => 'ensembl',
'host' => 'ecs1c',
'host' => 'ecs3d',
'zip' => 'test_genome.zip',
#add a line with the dbname and module
......
......@@ -266,7 +266,7 @@ sub load_databases {
next;
}
$db->do( "load data local infile '$txt_file' into table $tablename" );
$db->do( "load data infile '$txt_file' into table $tablename" );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment