From 2faf72c41b13d8d4fd7c83bf5bde8e91a2dc39e8 Mon Sep 17 00:00:00 2001
From: Glenn Proctor <gp1@sanger.ac.uk>
Date: Fri, 11 Aug 2006 08:31:32 +0000
Subject: [PATCH] Added ability to project gene descriptions as well as names
 etc. Projected descriptions are currently stored the 'old' way, i.e. in the
 actual gene description field rather than in the info_* fields in the xref
 table.

---
 .../xref_projection/project_display_xrefs.pl        | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/misc-scripts/xref_projection/project_display_xrefs.pl b/misc-scripts/xref_projection/project_display_xrefs.pl
index d8231c3e7e..f48b27608d 100644
--- a/misc-scripts/xref_projection/project_display_xrefs.pl
+++ b/misc-scripts/xref_projection/project_display_xrefs.pl
@@ -11,7 +11,7 @@ use Bio::EnsEMBL::DBSQL::GeneAdaptor;
 
 my $method_link_type = "ENSEMBL_HOMOLOGUES";
 
-my ($conf, $compara, $from_species, @to_multi, $print, $names, $go_terms, $delete_names, $delete_go_terms, $no_backup, $full_stats);
+my ($conf, $compara, $from_species, @to_multi, $print, $names, $go_terms, $delete_names, $delete_go_terms, $no_backup, $full_stats, $descriptions);
 
 GetOptions('conf=s'          => \$conf,
 	   'compara=s'       => \$compara,
@@ -25,6 +25,7 @@ GetOptions('conf=s'          => \$conf,
 	   'delete_go_terms' => \$delete_go_terms,
 	   'nobackup'        => \$no_backup,
 	   'full_stats'      => \$full_stats,
+           'descriptions'    => \$descriptions,
 	   'help'            => sub { usage(); exit(0); });
 
 
@@ -83,7 +84,6 @@ foreach my $to_species (@to_multi) {
   print_stats($to_ga);
 
   # Get all genes, find homologies, set xrefs
-
   foreach my $gene_id (@{$from_ga->list_dbIDs}) {
 
     my $gene = $from_ga->fetch_by_dbID($gene_id);
@@ -170,6 +170,11 @@ sub project_display_names {
       # Modify the dbEntry to indicate it's not from this species - set info_type & info_text
       my $txt = "from $from_latin_species gene " . $from_gene->stable_id();
 
+      # Add description to the gene if required
+      # This should probably be in another column in the xref table but we just use the gene
+      # description column for now. 
+      $to_gene->description($from_gene->description()) if ($descriptions && $from_gene->description());
+
       $dbEntry->info_type("PROJECTION");
       $dbEntry->info_text($txt);
 
@@ -508,6 +513,10 @@ sub usage {
 
   [--delete_go_terms]   Delete projected GO terms.
 
+  [--descriptions]      Project descriptions as well. Only works if -names is
+                        specified. Descriptions appended to info_text field,
+                        separated by |
+
   [--print]             Print details of projection only, don't store in database
 
   [--method]            Type of homologs (default: TREE_HOMOLOGIES)
-- 
GitLab