From 22ae58b7d063f2a1c7fe90facb7ab68dcfa8e823 Mon Sep 17 00:00:00 2001
From: Glenn Proctor <gp1@sanger.ac.uk>
Date: Tue, 8 Mar 2005 17:03:16 +0000
Subject: [PATCH] Fixed bug that was causing a small number of HUGO xrefs to
 have null labels (hence xref displayed was numeric HGNC instead).

---
 .../xref_mapping/XrefParser/HUGOParser.pm     | 44 ++++++++-----------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/misc-scripts/xref_mapping/XrefParser/HUGOParser.pm b/misc-scripts/xref_mapping/XrefParser/HUGOParser.pm
index 8ffe6a7abe..45881f7e84 100644
--- a/misc-scripts/xref_mapping/XrefParser/HUGOParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/HUGOParser.pm
@@ -1,37 +1,33 @@
 package XrefParser::HUGOParser;
-  
+
 use strict;
-use POSIX qw(strftime);
 use File::Basename;
-  
+
 use XrefParser::BaseParser;
-  
+
 use vars qw(@ISA);
 @ISA = qw(XrefParser::BaseParser);
- 
 my $xref_sth ;
 my $dep_sth;
-  
- 
-  
+
 # --------------------------------------------------------------------------------
 # Parse command line and run if being run directly
-  
+
 if (!defined(caller())) {
-  
+
   if (scalar(@ARGV) != 1) {
     print "\nUsage: HUGOParser.pm file <source_id> <species_id>\n\n";
     exit(1);
   }
-  
+
   run(@ARGV);
 }
 
- 
 sub run {
+
   my $self = shift if (defined(caller(1)));
   my $file = shift;
- 
+
   my $source_id = shift;
   my $species_id = shift;
 
@@ -44,9 +40,9 @@ sub run {
   }
 
   my $dir = dirname($file);
- 
+
   my %hugo;
-    
+
   open (ENS4, $dir."/ens4.txt") || die "Can't open hugo ens4 $dir/ens4.txt\n";
   #HGNC    Symbol  Literature Aliases      Withdrawn Symbols
   #5       A1BG
@@ -57,15 +53,14 @@ sub run {
     my @array = split(/\t/,$_);
     my $hgnc = $array[0];
     my $label = $array[1];
-    
-    $hugo{$hgnc} = $label
+
+    $hugo{$hgnc} = $label;
+
   }
   close ENS4;
 
-  
   my (%swiss)  =  %{XrefParser::BaseParser->get_valid_codes("uniprot",$species_id)};
   my (%refseq) =  %{XrefParser::BaseParser->get_valid_codes("refseq",$species_id)};
- 
 
   my $count = 0;
   my $mismatch = 0;
@@ -78,7 +73,7 @@ sub run {
     chomp;
     my @array = split(/\t/,$_);
     my $hgnc = $array[0];
-    
+
     if ($array[1]) {  #swissprot
       my $master = $swiss{$array[1]};
       my $dep    = $hugo{$hgnc};
@@ -91,7 +86,7 @@ sub run {
       }
       #	print "$array[1]\tSPTR\t$hgnc\tHUGO\t$hugo_id{$hgnc}\t$hugo_syn{$hgnc}\tXREF\n";
     }
-    
+
     if ($array[2]) {
       my $master = $refseq{$array[2]};
       my $dep    = $hugo{$hgnc};
@@ -99,7 +94,7 @@ sub run {
 	$mismatch++;
       }
       else{
-	XrefParser::BaseParser->add_to_xrefs($master,$hgnc,'',$hugo{hgnc},"","",$source_id,$species_id);
+	XrefParser::BaseParser->add_to_xrefs($master,$hgnc,'',$hugo{$hgnc},"","",$source_id,$species_id);
 	$count++;
       }
     }
@@ -108,8 +103,7 @@ sub run {
   print "\t$count xrefs succesfully loaded\n";
   print "\t$mismatch xrefs ignored\n";
 }
-  
-      
+
 sub new {
 
   my $self = {};
@@ -117,7 +111,7 @@ sub new {
   return $self;
 
 }
- 
+
 1;
     
 
-- 
GitLab