From ec038cbb7aff7ae3a103ea16381bee02856d0954 Mon Sep 17 00:00:00 2001
From: Glenn Proctor <gp1@sanger.ac.uk>
Date: Thu, 12 Oct 2006 14:53:44 +0000
Subject: [PATCH] Removed xref priority.

---
 modules/Bio/EnsEMBL/DBEntry.pm              | 40 +++------------------
 modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm | 32 +++++++----------
 modules/t/dbEntries.t                       | 22 ++++--------
 3 files changed, 24 insertions(+), 70 deletions(-)

diff --git a/modules/Bio/EnsEMBL/DBEntry.pm b/modules/Bio/EnsEMBL/DBEntry.pm
index 2dc2a846b6..adcedbd995 100644
--- a/modules/Bio/EnsEMBL/DBEntry.pm
+++ b/modules/Bio/EnsEMBL/DBEntry.pm
@@ -84,15 +84,14 @@ sub new_fast {
                     -priority => $priority,
                     -db_display_name => $db_display_name,
                     -info_type => $info_type,
-                    -info_text => $info_text,
-                    -xref_priority => $xref_priority);
+                    -info_text => $info_text);
   Description: Creates a new DBEntry object
   Returntype : Bio::EnsEMBL::DBEntry
   Exceptions : none
   Caller     : Bio::EnsEMBL::DBEntryAdaptor
   Status     : At Risk
                Due to 'PRIMARY_ID_LINKABLE','DISPLAY_ID_LINKABLE','PRIORITY',
-              'INFO_TYPE', 'INFO_TEXT', ''DB_DISPLAY_NAME', 'XREF_PRIORITY'
+              'INFO_TYPE', 'INFO_TEXT', ''DB_DISPLAY_NAME'
                being under development - if you don't use any of these the
                method can be considered Stable
 
@@ -106,12 +105,11 @@ sub new {
   my ( $adaptor, $dbID, $primary_id, $version,
        $dbname, $release, $display_id, $description,
        $primary_id_linkable, $display_id_linkable, $priority,
-       $db_display_name, $info_type, $info_text, $xref_priority) =
+       $db_display_name, $info_type, $info_text) =
     rearrange ( ['ADAPTOR','DBID','PRIMARY_ID','VERSION',
                  'DBNAME','RELEASE','DISPLAY_ID','DESCRIPTION',
 		 'PRIMARY_ID_LINKABLE','DISPLAY_ID_LINKABLE','PRIORITY',
-		 'DB_DISPLAY_NAME', 'INFO_TYPE', 'INFO_TEXT',
-                 'XREF_PRIORITY'], @args );
+		 'DB_DISPLAY_NAME', 'INFO_TYPE', 'INFO_TEXT'], @args );
 
   $self->{'adaptor'} = $adaptor;
   $self->{'dbID'}    = $dbID;
@@ -129,7 +127,6 @@ sub new {
   if( defined $db_display_name) { $self->db_display_name($db_display_name) }
   if( defined $info_type) { $self->info_type($info_type) }
   if( defined $info_text) { $self->info_text($info_text) }
-  if( defined $xref_priority) { $self->xref_priority($xref_priority) }
 
   return $self;
 }
@@ -380,9 +377,7 @@ sub display_id_linkable {
   Arg [1]    : int $priority
   Example    : none
   Priority   : Getter/setter for attribute 'priority'. Note this
-               is the priority from the external_db table; if you
-               require the priority from the xref table, us the
-               xref_priority attribute instead.
+               is the priority from the external_db table.
   Returntype : String
   Exceptions : none
   Caller     : general
@@ -556,31 +551,6 @@ sub status{
   return $self->{status};
 }
 
-
-=head2 xref_priority
-
-  Arg [1]    : int $xref_priority
-  Example    : none
-  Priority   : Getter/setter for attribute 'xref_priority'. Note
-               that this is the priority from the xref table; if
-               you require the priority from the external_db table,
-               use the priority attribute instead.
-  Returntype : String
-  Exceptions : none
-  Caller     : general
-  Status     : At Risk
-             : due to it being under development
-
-=cut
-
-sub xref_priority {
-  my ( $self, $arg ) = @_;
-  if( defined $arg ) {
-    $self->{xref_priority} = $arg;
-  }
-  return $self->{xref_priority};
-}
-
 =head1 DEPRECATED METHODS
 
 =cut
diff --git a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
index 077c6299e4..f0f80fafb5 100644
--- a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
@@ -67,7 +67,7 @@ sub fetch_by_dbID {
            xref.version, xref.description,
            exDB.dbprimary_acc_linkable, exDB.display_label_linkable, exDB.priority,
            exDB.db_name, exDB.db_display_name, exDB.db_release, es.synonym,
-           xref.info_type, xref.info_text, xref.priority
+           xref.info_type, xref.info_text
     FROM   (xref, external_db exDB)
     LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
     WHERE  xref.xref_id = ?
@@ -82,7 +82,7 @@ sub fetch_by_dbID {
     my ( $refID, $dbprimaryId, $displayid, $version, $desc,
 	 $primary_id_linkable, $display_id_linkable, $priority,
          $dbname, $db_display_name, $release, $synonym, 
-	 $info_type, $info_text, $xref_priority) = @$arrayref;
+	 $info_type, $info_text) = @$arrayref;
 
     if(!$exDB) {
       $exDB = Bio::EnsEMBL::DBEntry->new
@@ -98,8 +98,7 @@ sub fetch_by_dbID {
 	  -priority => $priority,
 	  -db_display_name => $db_display_name,
 	  -info_type => $info_type,
-	  -info_text => $info_text,
-          -xref_priority => $xref_priority);
+	  -info_text => $info_text);
 
       $exDB->description( $desc ) if ( $desc );
     }
@@ -142,7 +141,7 @@ sub fetch_by_db_accession {
            xref.version, xref.description,
            exDB.dbprimary_acc_linkable, exDB.display_label_linkable, exDB.priority,
            exDB.db_name, exDB.db_display_name, exDB.db_release, es.synonym,
-           xref.info_type, xref.info_text, xref.priority
+           xref.info_type, xref.info_text
     FROM   (xref, external_db exDB)
     LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
     WHERE  xref.dbprimary_acc = ?
@@ -173,7 +172,7 @@ sub fetch_by_db_accession {
   while ( my $arrayref = $sth->fetchrow_arrayref()){
     my ( $dbID, $dbprimaryId, $displayid, $version, $desc, 
 	 $primary_id_linkable, $display_id_linkable, $priority, $dbname, $db_display_name,
-         $release, $synonym, $info_type, $info_text, $xref_priority) = @$arrayref;
+         $release, $synonym, $info_type, $info_text) = @$arrayref;
 
     if(!$exDB) {
       $exDB = Bio::EnsEMBL::DBEntry->new
@@ -189,8 +188,7 @@ sub fetch_by_db_accession {
 	  -priority => $priority,
 	  -db_display_name=>$db_display_name,
 	  -info_type => $info_type,
-	  -info_text => $info_text,
-          -xref_priority => $xref_priority);
+	  -info_text => $info_text);
 
       $exDB->description( $desc ) if ( $desc );
     }
@@ -309,8 +307,7 @@ sub store {
            description = ?,
            external_db_id = ?,
            info_type = ?,
-           info_text = ?,
-           priority = ?");
+           info_text = ?");
     $sth->bind_param(1, $exObj->primary_id,SQL_VARCHAR);
     $sth->bind_param(2, $exObj->display_id,SQL_VARCHAR);
     $sth->bind_param(3, $exObj->version,SQL_VARCHAR);
@@ -318,7 +315,6 @@ sub store {
     $sth->bind_param(5, $dbRef,SQL_INTEGER);
     $sth->bind_param(6, $exObj->info_type, SQL_VARCHAR);
     $sth->bind_param(7, $exObj->info_text, SQL_VARCHAR);
-    $sth->bind_param(8, 1,SQL_INTEGER); # XXX remove this!
 
     $sth->execute();
 
@@ -698,7 +694,7 @@ sub _fetch_by_object_type {
            idt.hit_end, idt.translation_start, idt.translation_end,
            idt.cigar_line, idt.score, idt.evalue, idt.analysis_id,
            gx.linkage_type,
-           xref.info_type, xref.info_text, xref.priority
+           xref.info_type, xref.info_text
     FROM   (xref xref, external_db exDB, object_xref oxr)
     LEFT JOIN external_synonym es on es.xref_id = xref.xref_id 
     LEFT JOIN identity_xref idt on idt.object_xref_id = oxr.object_xref_id
@@ -722,7 +718,7 @@ sub _fetch_by_object_type {
          $synonym, $queryid, $targetid, $query_start, $query_end,
          $translation_start, $translation_end, $cigar_line,
          $score, $evalue, $analysis_id, $linkage_type,
-	 $info_type, $info_text, $xref_priority) = @$arrRef;
+	 $info_type, $info_text) = @$arrRef;
 
     my %obj_hash = ( 
 		    'adaptor'    => $self,
@@ -774,7 +770,6 @@ sub _fetch_by_object_type {
       $exDB->db_display_name($exDB_db_display_name);
       $exDB->info_type($info_type);
       $exDB->info_text($info_text);
-      $exDB->xref_priority($xref_priority);
 
       push( @out, $exDB );
       $seen{$refID} = $exDB;
@@ -1101,10 +1096,10 @@ sub fetch_all_by_description {
            xref.version, xref.description,
            exDB.dbprimary_acc_linkable, exDB.display_label_linkable, exDB.priority,
            exDB.db_name, exDB.db_display_name, exDB.db_release, es.synonym,
-           xref.info_type, xref.info_text, xref.priority
+           xref.info_type, xref.info_text
     FROM   (xref, external_db exDB)
     LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
-    WHERE  xref.description like ?    
+    WHERE  xref.description like ?
     AND    xref.external_db_id = exDB.external_db_id";
 
    if(defined($dbname)){
@@ -1120,7 +1115,7 @@ sub fetch_all_by_description {
   while ( my $arrayref = $sth->fetchrow_arrayref()){
     my ( $dbID, $dbprimaryId, $displayid, $version, $desc, 
 	 $primary_id_linkable, $display_id_linkable, $priority, $dbname,$db_display_name,
-         $release, $synonym, $info_type, $info_text, $xref_priority) = @$arrayref;
+         $release, $synonym, $info_type, $info_text) = @$arrayref;
 
       my $exDB = Bio::EnsEMBL::DBEntry->new
         ( -adaptor => $self,
@@ -1135,8 +1130,7 @@ sub fetch_all_by_description {
 	  -priority => $priority,
 	  -db_display_name=>$db_display_name,
 	  -info_type => $info_type,
-	  -info_text => $info_text,
-          -xref_priority => $xref_priority);
+	  -info_text => $info_text);
 
       $exDB->description( $desc ) if ( $desc );
 
diff --git a/modules/t/dbEntries.t b/modules/t/dbEntries.t
index e07e7a6372..e37adb17b5 100644
--- a/modules/t/dbEntries.t
+++ b/modules/t/dbEntries.t
@@ -91,8 +91,7 @@ my $xref = Bio::EnsEMBL::DBEntry->new
    -priority => "5",
    -db_display_name => "Nice friendly name",
    -info_type => "PROJECTION",
-   -info_text => "from human gene ENSG0000011111",
-   -xref_priority => "2"
+   -info_text => "from human gene ENSG0000011111"
    );
 
 
@@ -125,22 +124,16 @@ $multi->hide( "core", "object_xref", "xref", "identity_xref", "go_xref" );
 
 my $gene = $ga->fetch_by_dbID( $all_gene_ids->[0] );
 my $tr = $gene->get_all_Transcripts()->[0];
-print STDERR "transcript ".$tr->dbID."\n";
 my $tl = $tr->translation();
 
-print STDERR "\ndb1=".$dbEntryAdaptor->store( $xref, $gene->dbID, "Gene" )."\n";
 my $oxr_count = count_rows($db, 'object_xref');
-print STDERR "\n1 count is actually".$oxr_count."\n";
-print STDERR "\ndb2=".$dbEntryAdaptor->store( $xref, $tr->dbID, "Transcript" );
+$dbEntryAdaptor->store( $xref, $tr->dbID, "Transcript" );
 $oxr_count = count_rows($db, 'object_xref');
-print STDERR "\n2 count is avctually".$oxr_count."\n";
-print STDERR "\ndb3=".$dbEntryAdaptor->store( $goref, $tl->dbID, "Translation" );
+$dbEntryAdaptor->store( $goref, $tl->dbID, "Translation" );
 $oxr_count = count_rows($db, 'object_xref');
-print STDERR "\n3 count is actually".$oxr_count."\n";
-print STDERR "\ndb4=".$dbEntryAdaptor->store( $ident_xref, $tl->dbID, "Translation" );
+$dbEntryAdaptor->store( $ident_xref, $tl->dbID, "Translation" );
 $oxr_count = count_rows($db, 'object_xref');
-print STDERR "\n4 count is actually".$oxr_count."\n";
-print STDERR "\ndb5=".$dbEntryAdaptor->store( $ident_xref, $tr->dbID, "Transcript" );
+$dbEntryAdaptor->store( $ident_xref, $tr->dbID, "Transcript" );
 my ($go_count );
 
 $oxr_count = count_rows($db, 'object_xref');
@@ -148,8 +141,7 @@ $oxr_count = count_rows($db, 'object_xref');
 # 6 right number of object xrefs in db
 #
 debug( "object_xref_count = $oxr_count" );
-print STDERR "\n5 count is actually".$oxr_count."\n";
-ok( $oxr_count == 5 );
+ok( $oxr_count == 4 );
 
 $xref_count = count_rows($db, 'xref');
 $sth->finish();
@@ -176,8 +168,6 @@ $ident_count = count_rows($db, 'identity_xref');
 debug( "Number of identity_xrefs = $ident_count" );
 ok( $ident_count == 2 );
 
-ok($xref->xref_priority() == 2);
-
 $multi->restore();
 
 
-- 
GitLab