Skip to content
Snippets Groups Projects
Commit 22ae58b7 authored by Glenn Proctor's avatar Glenn Proctor
Browse files

Fixed bug that was causing a small number of HUGO xrefs to have null labels...

Fixed bug that was causing a small number of HUGO xrefs to have null labels (hence xref displayed was numeric HGNC instead).
parent 8d6dd221
No related branches found
No related tags found
No related merge requests found
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;
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