None available.
sub process
{ my $self = shift;
print "Writing InterPro\n" if($self->verbose);
my( $ipro_count, $xref_count, $oxref_count, $goxref_count ) = (0,0,0,0);
my $object_xref_id;
my $sth = $self->xref->dbc->prepare("select max(object_xref_id) from object_xref");
$sth->execute();
$sth->bind_columns(\$object_xref_id);
$sth->fetch();
$sth->finish;
$object_xref_id++;
my $add_object_xref_sth = $self->xref->dbc->prepare('insert into object_xref (object_xref_id, ensembl_id,ensembl_object_type, xref_id, linkage_type, ox_status ) values (?, ?, ?, ?, ?, "DUMP_OUT")');
local $add_object_xref_sth->{RaiseError}; local $add_object_xref_sth->{PrintError};
my $add_go_xref_sth = $self->xref->dbc->prepare('insert into go_xref (object_xref_id, linkage_type) values (?, ?)');
my $core_sql = "SELECT hit_name, translation_id FROM protein_feature" ;
my $core_sth = $self->core->dbc->prepare($core_sql);
$core_sth->execute();
my %domain_to_translation = ();
my ($domain, $translation);
$core_sth->bind_columns(\$domain,\$ translation);
while ($core_sth->fetch()) {
$domain_to_translation{$domain} ||= [];
push @{$domain_to_translation{$domain}}, $translation;
}
$sth = $self->xref->dbc->prepare("
SELECT ip.interpro, ip.pfam, x2.xref_id, x2.source_id,
dx.linkage_annotation
FROM interpro ip, xref x
LEFT JOIN dependent_xref dx ON x.xref_id=dx.master_xref_id
LEFT JOIN xref x2 ON dx.dependent_xref_id=x2.xref_id
WHERE ip.interpro = x.accession");
my $rv = $sth->execute();
my %added;
my $dup=0;
while( my $row = $sth->fetchrow_arrayref() ){
my ( $interpro, $pfam, $dx_xref_id, $dx_source_id, $go_linkage ) = @$row;
if( $dx_xref_id ){
foreach my $ensembl_id( @{$domain_to_translation{$pfam}||[]} ){
$add_object_xref_sth->execute($object_xref_id, $ensembl_id, 'Translation', $dx_xref_id, 'DEPENDENT');
if($add_object_xref_sth->err){
my $err = $add_object_xref_sth->errstr;
if($err =~ /Duplicate/){
$dup++;
next;
}
else{
die "Problem adding object xref for interpro data\n";
}
}
$added{$dx_source_id}++;
$oxref_count++;
if($go_linkage){
$add_go_xref_sth->execute($object_xref_id, $go_linkage );
$goxref_count ++;
}
$object_xref_id++;
}
}
}
$sth->finish();
print "\n".$dup." already existed\n\n" if($self->verbose);
print(" Wrote $ipro_count interpro table entries\n") if($self->verbose);
print(" including $oxref_count object xrefs,\n ") if($self->verbose);
print(" and $goxref_count go xrefs\n") if($self->verbose);
}
1; } |