diff --git a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm index f97d4680008d465fcdebb72764dac72469d7985c..301de787f8acac952897228cc1b3a9a694df6319 100644 --- a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm +++ b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm @@ -8,7 +8,6 @@ use File::Basename; use IPC::Open3; use XrefMapper::db; -use XrefMapper::uniparc; =head2 new @@ -49,23 +48,6 @@ sub xref{ return $self->{_xref}; } -=head2 uniparc - - Arg [1] : (optional) - Example : $mapper->uniparc($new_uniparc); - Description: Getter / Setter for the uniparc. - info for the uniparc database. - Returntype : XrefMapper::uniparc - Exceptions : none - -=cut - -sub uniparc { - my ($self, $uniparc) = @_; - $self->{uniparc} = $uniparc if defined $uniparc; - return $self->{uniparc}; -} - =head2 farm_queue Arg [1] : (optional) @@ -209,13 +191,11 @@ sub process_file { my $xref=undef; my $ensembl=undef; - my $uniparc; my $type; my %xref_hash=(); my %species_hash=(); my %farm_hash=(); - my %uniparc_hash; open my $fh, "<", $file or croak ("\nCannot open input file '$file':\n $!\n"); while( my $line = <$fh> ) { @@ -235,9 +215,6 @@ sub process_file { elsif($key eq "farm"){ $type = "farm"; } - elsif($key eq 'uniparc'){ - $type = 'uniparc'; - } elsif($type eq "species"){ # processing species data $species_hash{lc($key)} = $value; } @@ -247,9 +224,6 @@ sub process_file { elsif($type eq "farm"){ $farm_hash{lc($key)} = $value; } - elsif($type eq 'uniparc') { # Processing uniparc settings - $uniparc_hash{lc($key)} = $value; - } } close $fh or croak "Can't close file"; @@ -360,21 +334,6 @@ sub process_file { croak "No host name given for xref database\n"; } - - #If we had UniParc information then create the settings - if($uniparc_hash{dbname}) { - my %args = ( - -DBNAME => $uniparc_hash{dbname}, - -USER => $uniparc_hash{user} - ); - $args{-PASS} = $uniparc_hash{password} if $uniparc_hash{password}; - - $uniparc = XrefMapper::uniparc->new(%args); - $uniparc->method($uniparc_hash{method}); - $mapper->uniparc($uniparc); - } - - if(defined($species_hash{'species'})){ my ($host, $port, $user, $dbname, $pass); diff --git a/misc-scripts/xref_mapping/XrefMapper/UniParcMapper.pm b/misc-scripts/xref_mapping/XrefMapper/UniParcMapper.pm index c0c19c79239c313d9f195c9caf9d4e7a2d00e3e9..cc1f14ef91fe1fe4600b9d9865eb378ed3dbfb3a 100644 --- a/misc-scripts/xref_mapping/XrefMapper/UniParcMapper.pm +++ b/misc-scripts/xref_mapping/XrefMapper/UniParcMapper.pm @@ -14,9 +14,7 @@ sub new { my $self = bless {}, $class; $self->core($mapper->core); $self->xref($mapper->xref); - $self->uniparc($mapper->uniparc()); $self->mapper($mapper); - $self->method($self->uniparc()->method() || $DEFAULT_METHOD); return $self; } @@ -57,12 +55,14 @@ sub process { $self->_update_status('checksum_xrefs_started'); - my $method = $self->get_method(); - my $results = $method->run(); - - if($do_upload) { - $self->log_progress('Starting upload'); - $self->upload($results); + if($self->_map_checksums()) { + my $method = $self->get_method(); + my $results = $method->run(); + + if($do_upload) { + $self->log_progress('Starting upload'); + $self->upload($results); + } } $self->_update_status('checksum_xrefs_finished'); @@ -145,7 +145,7 @@ sub species_id { sub get_method { my ($self) = @_; - my $method_class = $self->method(); + my $method_class = $DEFAULT_METHOD; eval "require ${method_class};"; if($@) { throw "Cannot require the class ${method_class}. Make sure your PERL5LIB is correct: $@"; @@ -169,6 +169,12 @@ sub _update_status { return; } +sub _map_checksums { + my ($self) = @_; + my $count = $self->_xref_helper()->execute_single_result(-SQL => 'select count(*) from checksum_xref'); + return $count; +} + sub log_progress { my ( $self, $fmt, @params ) = @_; return if (!$self->verbose); diff --git a/misc-scripts/xref_mapping/XrefMapper/uniparc.pm b/misc-scripts/xref_mapping/XrefMapper/uniparc.pm deleted file mode 100644 index 190a91ea0fbba0fac952a18c78d4f9cb185b239d..0000000000000000000000000000000000000000 --- a/misc-scripts/xref_mapping/XrefMapper/uniparc.pm +++ /dev/null @@ -1,11 +0,0 @@ -package XrefMapper::uniparc; - -use base qw(XrefMapper::db); - -sub method { - my ($self, $method) = @_; - $self->{method} = $method if defined $method; - return $self->{method}; -} - -1; \ No newline at end of file diff --git a/misc-scripts/xref_mapping/xref_mapper.input b/misc-scripts/xref_mapping/xref_mapper.input index acb0bfe2d6ff94337ae01263f7da2d126b3994b0..5d841809a4509b876841a6900858f8abce36bee1 100644 --- a/misc-scripts/xref_mapping/xref_mapper.input +++ b/misc-scripts/xref_mapping/xref_mapper.input @@ -6,11 +6,6 @@ user=ensadmin password= dir=/nfs/acari/gp1/work/ensembl/misc-scripts/xref_mapping/xref -#uniparc -#dbname= -#user= -#password= - species=mus_musculus host=ecs4 port=3306 diff --git a/misc-scripts/xref_mapping/xref_mapper.pl b/misc-scripts/xref_mapping/xref_mapper.pl index 12f4a4965b5ddaa6d803f6fadcd695197e2fcd8e..0d017907cd1c443965a08b16e10d540c56a4caa4 100644 --- a/misc-scripts/xref_mapping/xref_mapper.pl +++ b/misc-scripts/xref_mapping/xref_mapper.pl @@ -210,10 +210,9 @@ if($status eq "alt_alleles_processed"){ #UniParc checksum mapping -#Allow for reruns if required but needs a uniparc object available in the mapper -#as that means we can do it +#Allow for reruns if required and let the mapper decide if it can run or not $status = $mapper->xref_latest_status(); -if($status eq 'official_naming_done' && defined $mapper->uniparc()) { +if($status eq 'official_naming_done') { my $checksum_mapper = XrefMapper::UniParcMapper->new($mapper); $checksum_mapper->process($upload); }