Commit 080bd8ad authored by Steve Trevanion's avatar Steve Trevanion
Browse files

correct type of compara db handle, method to remove duplicate attrib values

parent a50b9e98
......@@ -720,7 +720,7 @@ sub get_database {
evega => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
otter => 'Bio::Otter::DBSQL::DBAdaptor',
vega => 'Bio::Otter::DBSQL::DBAdaptor',
compara => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
compara => 'Bio::EnsEMBL::Compara::DBSQL::DBAdaptor',
loutre => 'Bio::Vega::DBSQL::DBAdaptor',
throw("Unknown database: $database") unless $adaptors{$database};
......@@ -1896,4 +1896,29 @@ sub update_attribute {
return ['Updated',$r];
=head2 remove_duplicate_attribs
Arg[1] : db handle
Arg[2] : table
Example : $support->remove_duplicate_attribs($dbh,'gene');
Description : uses MySQL to remove duplicate entries from an attribute table
Return type : none
Caller : general
Status : stable
sub remove_duplicate_attribs {
my $self = shift;
my $dbh = shift;
my $table = shift;
$dbh->do(qq(create table nondup_${table}_attrib like ${table}_attrib));
$dbh->do(qq(insert into nondup_${table}_attrib (select ${table}_id, attrib_type_id, value from ${table}_attrib group by ${table}_id, attrib_type_id, value)));
$dbh->do(qq(delete from ${table}_attrib));
$dbh->do(qq(insert into ${table}_attrib (select ${table}_id, attrib_type_id, value from nondup_${table}_attrib)));
$dbh->do(qq(drop table nondup_${table}_attrib));
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