From 98a44bc7b5764b7f3e4b742a5aa36eeb9c69e17a Mon Sep 17 00:00:00 2001
From: Ian Longden <ianl@sanger.ac.uk>
Date: Thu, 14 Jul 2011 14:50:30 +0000
Subject: [PATCH] perlcritic level 5 fixes

---
 .../xref_mapping/XrefParser/AedesCAPParser.pm |   3 +-
 .../XrefParser/AedesGenBankParser.pm          |   3 +-
 .../xref_mapping/XrefParser/AgilentParser.pm  |   3 +-
 .../xref_mapping/XrefParser/AnoXcelParser.pm  |  14 +-
 .../XrefParser/AnophelesSymbolParser.pm       |   3 +-
 .../xref_mapping/XrefParser/BaseParser.pm     | 124 +++++++++---------
 .../xref_mapping/XrefParser/CCDSParser.pm     |   2 +-
 .../xref_mapping/XrefParser/CeleraParser.pm   |   3 +-
 .../XrefParser/CeleraProteinParser.pm         |   2 +-
 .../XrefParser/CeleraTranscriptParser.pm      |   2 +-
 .../xref_mapping/XrefParser/CodelinkParser.pm |   3 +-
 .../xref_mapping/XrefParser/DBASSParser.pm    |   4 +-
 .../xref_mapping/XrefParser/EG_DBParser.pm    |  16 +--
 .../XrefParser/EntrezGeneParser.pm            |  17 +--
 .../xref_mapping/XrefParser/FantomParser.pm   |  18 +--
 .../xref_mapping/XrefParser/FastaParser.pm    |   3 +-
 .../XrefParser/Flybase_dmel_GFFv3_Parser.pm   |  28 +---
 .../xref_mapping/XrefParser/GOParser.pm       |  17 +--
 .../xref_mapping/XrefParser/GOSlimParser.pm   |   2 +-
 .../xref_mapping/XrefParser/HGNCParser.pm     |  16 +--
 .../xref_mapping/XrefParser/HPAParser.pm      |   3 +-
 .../xref_mapping/XrefParser/IKMCParser.pm     |   3 +-
 .../xref_mapping/XrefParser/IPIParser.pm      |   3 +-
 .../xref_mapping/XrefParser/IlluminaParser.pm |   3 +-
 .../XrefParser/IlluminaWGParser.pm            |   3 +-
 .../xref_mapping/XrefParser/ImmunoDBParser.pm |  18 +--
 .../XrefParser/InterproGoParser.pm            |   3 +-
 .../xref_mapping/XrefParser/InterproParser.pm |  25 +---
 .../XrefParser/IxodesCAPParser.pm             |   3 +-
 .../xref_mapping/XrefParser/JGI_Parser.pm     |   3 +-
 .../XrefParser/JGI_ProteinParser.pm           |   2 +-
 .../xref_mapping/XrefParser/MGDParser.pm      |  35 ++---
 .../xref_mapping/XrefParser/MGIParser.pm      |  17 +--
 .../XrefParser/MGI_Desc_Parser.pm             |  15 +--
 .../xref_mapping/XrefParser/MIMParser.pm      |  17 +--
 .../xref_mapping/XrefParser/Mim2GeneParser.pm |  17 +--
 .../xref_mapping/XrefParser/OTTTParser.pm     |  12 +-
 .../xref_mapping/XrefParser/PHIbaseParser.pm  |  20 +--
 .../xref_mapping/XrefParser/RGDParser.pm      |  18 +--
 .../XrefParser/RefSeqGPFFParser.pm            |  23 +---
 .../xref_mapping/XrefParser/RefSeqParser.pm   |  20 +--
 .../XrefParser/RefSeq_CCDSParser.pm           |   2 +-
 .../xref_mapping/XrefParser/SGDParser.pm      |  14 +-
 .../xref_mapping/XrefParser/SegmentParser.pm  |  17 +--
 .../xref_mapping/XrefParser/UCSCParser.pm     |   3 +-
 .../xref_mapping/XrefParser/UniGeneParser.pm  |  25 +---
 .../XrefParser/UniProtDirectParser.pm         |  16 +--
 .../xref_mapping/XrefParser/UniProtParser.pm  |  23 +---
 .../UniProtParser_descriptions_only.pm        |  20 +--
 .../XrefParser/UniProtVarSplicParser.pm       |   3 +-
 .../XrefParser/VBCommunitySymbolParser.pm     |  17 +--
 .../XrefParser/VBExternalDescriptionParser.pm |  14 +-
 .../xref_mapping/XrefParser/VBPubMedParser.pm |  15 +--
 .../XrefParser/VBRNADescriptionParser.pm      |  15 +--
 .../XrefParser/VBribosomalParser.pm           |  14 +-
 .../xref_mapping/XrefParser/VbDirectParser.pm |   6 +-
 .../xref_mapping/XrefParser/VbGFF3Parser.pm   |   9 +-
 .../XrefParser/WilsonAffyParser.pm            |   3 +-
 .../xref_mapping/XrefParser/WormPepParser.pm  |   3 +-
 .../XrefParser/XenopusJamboreeParser.pm       |   3 +-
 .../xref_mapping/XrefParser/ZFINDescParser.pm |  22 +---
 .../xref_mapping/XrefParser/ZFINParser.pm     |  18 +--
 .../XrefParser/curated_transcriptParser.pm    |  15 +--
 .../xref_mapping/XrefParser/ncRNAParser.pm    |  17 +--
 .../xref_mapping/XrefParser/ncRNA_DBParser.pm |  15 +--
 65 files changed, 159 insertions(+), 696 deletions(-)

diff --git a/misc-scripts/xref_mapping/XrefParser/AedesCAPParser.pm b/misc-scripts/xref_mapping/XrefParser/AedesCAPParser.pm
index 33e72cefbb..5986301bc9 100644
--- a/misc-scripts/xref_mapping/XrefParser/AedesCAPParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/AedesCAPParser.pm
@@ -20,8 +20,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/AedesGenBankParser.pm b/misc-scripts/xref_mapping/XrefParser/AedesGenBankParser.pm
index 3699a7e221..feb2241a22 100644
--- a/misc-scripts/xref_mapping/XrefParser/AedesGenBankParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/AedesGenBankParser.pm
@@ -13,8 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/AgilentParser.pm b/misc-scripts/xref_mapping/XrefParser/AgilentParser.pm
index 3ee69d8651..0f5d42fc23 100644
--- a/misc-scripts/xref_mapping/XrefParser/AgilentParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/AgilentParser.pm
@@ -13,8 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/AnoXcelParser.pm b/misc-scripts/xref_mapping/XrefParser/AnoXcelParser.pm
index 2e40b0a109..514a070809 100644
--- a/misc-scripts/xref_mapping/XrefParser/AnoXcelParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/AnoXcelParser.pm
@@ -13,21 +13,9 @@ use base qw( XrefParser::BaseParser );
 # AGAP004678-PA   AGAP004678-RA   2L:203866-204956:1      AGAP004678
 #...
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: AnoXcelParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/AnophelesSymbolParser.pm b/misc-scripts/xref_mapping/XrefParser/AnophelesSymbolParser.pm
index 59e24b7f3e..b6f94919fb 100644
--- a/misc-scripts/xref_mapping/XrefParser/AnophelesSymbolParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/AnophelesSymbolParser.pm
@@ -14,8 +14,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
index add99cbada..281cdede6d 100644
--- a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
@@ -1,6 +1,8 @@
 package XrefParser::BaseParser;
 
 use strict;
+use warnings;
+use Bio::EnsEMBL::Utils::Exception;
 
 use Carp;
 use DBI;
@@ -17,7 +19,6 @@ use URI::file;
 use Text::Glob qw( match_glob );
 use LWP::UserAgent;
 
-use Bio::EnsEMBL::Utils::Exception;
 
 my $base_dir = File::Spec->curdir();
 
@@ -45,9 +46,7 @@ my ( $host,             $port,    $dbname,        $user,
 # Get info about files to be parsed from the database
 
 sub run {
-    my $self = shift;
-
-    (  $host,             $port,          $dbname,
+    (  my $self, $host,             $port,          $dbname,
        $user,             $pass,          my $speciesr,
        my $sourcesr,      $checkdownload, $create,
        $release,          $cleanup,       $drop_db,
@@ -352,7 +351,7 @@ sub run {
 	  # second the number of primary xrefs
 	  $group_sql = "SELECT count(*), s.name from source s, primary_xref px, xref x where s.source_id = x.source_id and px.xref_id = x.xref_id group by s.name";
 	  
-	  my $sum_sth = $dbi->prepare($group_sql);
+	  $sum_sth = $dbi->prepare($group_sql);
 	  $sum_sth->execute();
 	  
 	  $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -371,7 +370,7 @@ sub run {
 	  # third the number of dependent xrefs
 	  $group_sql = "SELECT count(*), s.name from source s, dependent_xref dx, xref x where s.source_id = x.source_id and dx.dependent_xref_id = x.xref_id group by s.name";
 	  
-	  my $sum_sth = $dbi->prepare($group_sql);
+	  $sum_sth = $dbi->prepare($group_sql);
 	  $sum_sth->execute();
 	  
 	  $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -395,7 +394,7 @@ sub run {
 
 	    $group_sql = "SELECT count(*), s.name from source s, ".$type."_direct_xref dx, xref x where s.source_id = x.source_id and dx.general_xref_id = x.xref_id group by s.name";
 	  
-	    my $sum_sth = $dbi->prepare($group_sql);
+	    $sum_sth = $dbi->prepare($group_sql);
 	    $sum_sth->execute();
 	    
 	    $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -415,7 +414,7 @@ sub run {
 	  # seventh the number of coordinate xrefs
 	  $group_sql = "SELECT count(*), s.name from source s, coordinate_xref cx  where s.source_id = cx.source_id group by s.name";
 	  
-	  my $sum_sth = $dbi->prepare($group_sql);
+	  $sum_sth = $dbi->prepare($group_sql);
 	  $sum_sth->execute();
 	  
 	  $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -433,7 +432,7 @@ sub run {
 	  # eigth the number of synonyms
 	  $group_sql = "select count(*), s.name from source s, xref x, synonym o where s.source_id = x.source_id and x.xref_id = o.xref_id group by s.name";
 	  
-	  my $sum_sth = $dbi->prepare($group_sql);
+	  $sum_sth = $dbi->prepare($group_sql);
 	  $sum_sth->execute();
 	  
 	  $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -500,7 +499,7 @@ sub run {
       # second the number of primary xrefs
       $group_sql = "SELECT count(*), s.name from source s, primary_xref px, xref x where s.source_id = x.source_id and px.xref_id = x.xref_id group by s.name";
       
-      my $sum_sth = $dbi->prepare($group_sql);
+      $sum_sth = $dbi->prepare($group_sql);
       $sum_sth->execute();
       
       $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -515,7 +514,7 @@ sub run {
       # third the number of dependent xrefs
       $group_sql = "SELECT count(*), s.name from source s, dependent_xref dx, xref x where s.source_id = x.source_id and dx.dependent_xref_id = x.xref_id group by s.name";
       
-      my $sum_sth = $dbi->prepare($group_sql);
+      $sum_sth = $dbi->prepare($group_sql);
       $sum_sth->execute();
       
       $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -533,7 +532,7 @@ sub run {
 	
 	$group_sql = "SELECT count(*), s.name from source s, ".$type."_direct_xref dx, xref x where s.source_id = x.source_id and dx.general_xref_id = x.xref_id group by s.name";
 	
-	my $sum_sth = $dbi->prepare($group_sql);
+	$sum_sth = $dbi->prepare($group_sql);
 	$sum_sth->execute();
 	
 	$sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -548,7 +547,7 @@ sub run {
       # seventh the number of coordinate xrefs
       $group_sql = "SELECT count(*), s.name from source s, coordinate_xref cx  where s.source_id = cx.source_id group by s.name";
       
-      my $sum_sth = $dbi->prepare($group_sql);
+      $sum_sth = $dbi->prepare($group_sql);
       $sum_sth->execute();
       
       $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -562,7 +561,7 @@ sub run {
       # eigth the number of synonyms
       $group_sql = "select count(*), s.name from source s, xref x, synonym o where s.source_id = x.source_id and x.xref_id = o.xref_id group by s.name";
       
-      my $sum_sth = $dbi->prepare($group_sql);
+      $sum_sth = $dbi->prepare($group_sql);
       $sum_sth->execute();
       
       $sum_sth->bind_columns(\$sum_count, \$sum_name);
@@ -586,7 +585,7 @@ sub run {
     # remove last working directory
     # TODO reinstate after debugging
     #rmtree $dir;
-
+    return 1;
 } ## end sub run
 
 # ------------------------------------------------------------------------------
@@ -599,9 +598,7 @@ sub run {
 # if there was an error.
 
 sub fetch_files {
-    my $self = shift;
-
-    my ( $dest_dir, @user_uris ) = @_;
+    my ($self, $dest_dir, @user_uris ) = @_;
 
     my @processed_files;
 
@@ -838,7 +835,7 @@ sub get_filehandle
           or carp("Can not open file '$file_name'");
     }
 
-    if ( !defined $io ) { return undef }
+    if ( !defined $io ) { return }
 
     print "Reading from '$file_name'...\n" if($verbose);
 
@@ -885,7 +882,7 @@ sub get_source_id_for_filename {
 }
 
 sub rename_url_file{
-  return undef;
+  return;
 }
 
 # Get species ID for a particular file; matches url field
@@ -1246,7 +1243,7 @@ sub upload_xref_object_graphs {
        my $xref_id=undef;
        if(!defined($xref->{ACCESSION})){
 	 print "your xref does not have an accession-number,so it can't be stored in the database\n";
-	 return undef;
+	 return;
        }
       # Create entry in xref table and note ID
        if(! $xref_sth->execute($xref->{ACCESSION},
@@ -1258,7 +1255,7 @@ sub upload_xref_object_graphs {
 			 $xref->{INFO_TYPE} || "MISC")){
 	 if(!defined($xref->{SOURCE_ID})){
 	   print "your xref: $xref->{ACCESSION} does not have a source-id\n";
-	   return undef;
+	   return;
 	 }
 	 $xref_id = $self->insert_or_select($xref_sth, $dbi->err, $xref->{ACCESSION}, $xref->{SOURCE_ID}, $xref->{SPECIES_ID});
 	 $xref_update_label_sth->execute($xref->{LABEL},$xref_id) if (defined($xref->{LABEL}));
@@ -1351,6 +1348,7 @@ sub upload_direct_xrefs{
       $self->add_direct_xref($general_xref_id, $dr->{ENSEMBL_STABLE_ID},$dr->{ENSEMBL_TYPE},$dr->{LINKAGE_XREF});
     }
   }
+  return;
 }
 
 sub add_meta_pair {
@@ -1361,7 +1359,7 @@ sub add_meta_pair {
   my $sth = $dbi->prepare('insert into meta (meta_key, meta_value, date) values("'.$key.'", "'.$value.'", now())');
   $sth->execute;
   $sth->finish;
-
+  return;
 }
 
 
@@ -1410,7 +1408,7 @@ sub taxonomy2species_id {
       my $species_id = $row[0];
       my $taxonomy_id = $row[1];
       if( my $ori =$taxonomy2species_id{$taxonomy_id} ){
-        die( "Taxon $taxonomy_id already used for species $ori. ".
+        croak ( "Taxon $taxonomy_id already used for species $ori. ".
                "Cannot assign to species $species_id as well. ".
                "Consider using the species_id2taxonomy call instead. ".
                "Called by ". join( ', ', (caller(0))[1..2] ) );
@@ -1476,7 +1474,7 @@ sub name2species_id {
             my $species_id = $row[0];
             foreach my $name ( split /,\s*/, $row[1] ) {
                 if ( my $ori = $name2species_id{$name} ) {
-                  die( "Name $name already used for species $ori. ".
+                  croak ( "Name $name already used for species $ori. ".
                        "Cannot assign to species $species_id as well. ".
                        "Consider using the species_id2name call instead. ".
                        "Called by ". join( ', ', (caller(0))[1..2] ) );
@@ -1546,14 +1544,14 @@ sub update_source
     # inherited set_release() method.
 
     $dbi->prepare($sql)->execute() || croak( $dbi->errstr() );
+    return;
 }
 
 
 # --------------------------------------------------------------------------------
 sub dbi2{
 
-    my $self = shift;
-    my ($host, $port, $user, $dbname, $pass) = @_;
+    my ($self, $host, $port, $user, $dbname, $pass) = @_;
     my $dbi2 = undef;
 
     if ( !defined $dbi2 || !$dbi2->ping() ) {
@@ -1565,7 +1563,7 @@ sub dbi2{
           DBI->connect( $connect_string, $user, $pass,
 #            { 'RaiseError' => 1 } )
 			)
-          or warn( "Can't connect to database: " . $DBI::errstr ) and return undef;
+          or warn( "Can't connect to database: " . $DBI::errstr ) and return;
         $dbi2->{'mysql_auto_reconnect'} = 1; # Reconnect on timeout
     }
     
@@ -1603,14 +1601,14 @@ sub md5sum
 {
     my $file = shift;
 
-    if ( !open( FILE, $file ) ) { return undef }
-    binmode(FILE);
+    open my $FH, "<", $file or return;
+    binmode($FH);
 
     my $checksum = sprintf( "%s/%d",
-        substr( Digest::MD5->new()->addfile(*FILE)->hexdigest(), 0, 6 ),
-        [ stat FILE ]->[7] );
+        substr( Digest::MD5->new()->addfile(*$FH)->hexdigest(), 0, 6 ),
+        [ stat $FH ]->[7] );
 
-    close(FILE);
+    close($FH);
 
     return $checksum;
 }
@@ -1737,7 +1735,7 @@ sub delete_by_source {
   $dep_sth->finish() if defined $dep_sth;
   $xref_sth->finish() if defined $xref_sth;
 #  $p_xref_sth->finish() if defined $p_xref_sth;
-
+  return;
 }
 
 # --------------------------------------------------------------------------------
@@ -1769,7 +1767,7 @@ sub validate_sources {
 
 # --------------------------------------------------------------------------------
 
-sub show_valid_sources() {
+sub show_valid_sources {
   my $species = shift;
 
   my $dbi = dbi();
@@ -1779,7 +1777,7 @@ sub show_valid_sources() {
   while (my @row = $sth->fetchrow_array()) {
     print $row[0] . "\n";
   }
-
+  return;
 }
 
 # --------------------------------------------------------------------------------
@@ -1811,7 +1809,7 @@ sub validate_species {
 
 # --------------------------------------------------------------------------------
 
-sub show_valid_species() {
+sub show_valid_species {
 
   my $dbi = dbi();
   my $sth = $dbi->prepare("SELECT name, aliases FROM species");
@@ -1820,7 +1818,7 @@ sub show_valid_species() {
   while (my @row = $sth->fetchrow_array()) {
     print STDERR $row[0] . " (aliases: " . $row[1] . ")\n";
   }
-
+  return;
 }
 
 sub get_taxonomy_from_species_id{
@@ -1849,7 +1847,7 @@ sub get_direct_xref{
  if(my @row = $direct_sth->fetchrow_array()) {
    return $row[0];
  }
- return undef;
+ return;
 }
 
 
@@ -1865,7 +1863,7 @@ sub get_xref{
   if(my @row = $get_xref_sth->fetchrow_array()) {
     return $row[0];
   }   
-  return undef;
+  return;
 }
 
 sub add_xref {
@@ -1904,14 +1902,14 @@ sub add_xref {
 sub add_to_direct_xrefs{
   my ($self,$direct_xref,$type, $acc,$version,$label,$description,$linkage,$source_id,$species_id) = @_;
 
-  $direct_xref || die( "Need a direct_xref on which this xref linked too" );
-  $acc         || die( "Need an accession of this dependent xref" );
+  $direct_xref || croak( "Need a direct_xref on which this xref linked too" );
+  $acc         || croak( "Need an accession of this dependent xref" );
   $version     ||= 0;
   $label       ||= $acc;
   $description ||= undef;
   $linkage     ||= undef;
-  $source_id   || die( "Need a source_id for this dependent xref" );
-  $species_id  || die( "Need a species_id for this dependent xref" );
+  $source_id   || croak( "Need a source_id for this dependent xref" );
+  $species_id  || croak( "Need a species_id for this dependent xref" );
 
   if(!defined($add_xref_sth)){
     $add_xref_sth = dbi->prepare("
@@ -1932,19 +1930,20 @@ VALUES
   $direct_id = $self->get_xref($acc, $source_id, $species_id);
 
   $self->add_direct_xref($direct_id, $direct_xref, $type, "");
+  return;
 }
 
 sub add_to_xrefs{
   my ($self,$master_xref,$acc,$version,$label,$description,$linkage,$source_id,$species_id) = @_;
 
-  $master_xref || die( "Need a master_xref_id on which this xref depends" );
-  $acc         || die( "Need an accession of this dependent xref" );
+  $master_xref || croak( "Need a master_xref_id on which this xref depends" );
+  $acc         || croak( "Need an accession of this dependent xref" );
   $version     ||= 0;
   $label       ||= $acc;
   $description ||= undef;
   $linkage     ||= undef;
-  $source_id   || die( "Need a source_id for this dependent xref" );
-  $species_id  || die( "Need a species_id for this dependent xref" );
+  $source_id   || croak( "Need a source_id for this dependent xref" );
+  $species_id  || croak( "Need a species_id for this dependent xref" );
 
   if(!defined($add_xref_sth)){
     $add_xref_sth = dbi->prepare("
@@ -1997,7 +1996,7 @@ sub add_to_syn_for_mult_sources{
       $found = 1;
     }
   }
-
+  return;
 }
 
 
@@ -2016,6 +2015,7 @@ sub add_to_syn{
       warn (  "Could not find acc $acc in "
             . "xref table source = $source_id of species $species_id\n" );
   }
+  return;
 }
 
 
@@ -2031,6 +2031,7 @@ sub add_synonym{
     $add_synonym_sth->execute( $xref_id, $syn )
       or croak( $dbi->errstr() . "\n $xref_id\n $syn\n" );
 
+  return;
 }
 
 
@@ -2061,6 +2062,7 @@ sub add_direct_xref {
   else{
     $add_direct_xref_sth{$ensembl_type}->execute($general_xref_id, $ensembl_stable_id, $linkage_type);
   }
+  return;
 }
 
 # ------------------------------------------------------------------------------
@@ -2089,7 +2091,7 @@ sub create {
     catfile( $sql_dir, 'sql', 'populate_metadata.sql' );
   my $ini_file = catfile( $sql_dir, 'xref_config.ini' );
 
-  $| = 1;    # flush stdout
+  local $| = 1;    # flush stdout
 
   # Figure out whether to run 'xref_config2sql.pl' or not by comparing
   # the timestamps on 'xref_config.ini' and 'sql/populate_metadata.sql'.
@@ -2101,7 +2103,7 @@ sub create {
             catfile( 'sql', 'populate_metadata.sql' ) );
     print("==> Should I re-run 'xref_config2sql.pl' for you? [y/N]: ");
 
-    my $reply = <STDIN>;
+    my $reply = <ARGV>;
     chomp $reply;
 
     if ( lc( substr( $reply, 0, 1 ) ) eq 'y' ) {
@@ -2140,7 +2142,7 @@ sub create {
   
     if ( $create && !$drop_db ) {
       print "WARNING: about to drop database $dbname on $host:$port; yes to confirm, otherwise exit: ";
-      my $p = <STDIN>;
+      my $p = <ARGV>;
       chomp $p;
       if ($p eq "yes") {
 	$dbh->do( "DROP DATABASE $dbname" );
@@ -2179,6 +2181,7 @@ sub create {
     . "$dbname < $metadata_file";
   system($cmd) == 0
     or croak("Cannot execute the following command (exit $?):\n$cmd\n");
+  return;
 }
 
 sub get_label_to_acc{
@@ -2212,7 +2215,7 @@ sub get_label_to_acc{
   if(defined($species_id)){
     $sql .= " and xref.species_id  = $species_id";
   }
-  my $sub_sth = dbi->prepare($sql);    
+  $sub_sth = dbi->prepare($sql);    
 
   $sub_sth->execute();
   while(my @row = $sub_sth->fetchrow_array()) {
@@ -2254,7 +2257,7 @@ sub get_label_to_desc{
   if(defined($species_id)){
     $sql .= " and xref.species_id  = $species_id";
   }
-  my $sub_sth = dbi->prepare($sql);    
+  $sub_sth = dbi->prepare($sql);    
 
   $sub_sth->execute();
   while(my @row = $sub_sth->fetchrow_array()) {
@@ -2280,7 +2283,7 @@ sub get_accession_from_label{
   while(my @row = $sub_sth->fetchrow_array()) {
     return $row[0];
   }   	  
-  return undef;
+  return;
   
 }
 
@@ -2305,8 +2308,7 @@ sub get_sub_list{
 
 sub set_release
 {
-    my $self = shift;
-    my ( $source_id, $release ) = @_;
+    my ($self, $source_id, $release ) = @_;
 
     my $dbi = dbi();
 
@@ -2317,6 +2319,7 @@ sub set_release
     print "Setting release to '$release' for source ID '$source_id'\n" if($verbose);
 
     $sth->execute( $release, $source_id );
+    return;
 }
 
 sub get_dependent_mappings {
@@ -2336,7 +2339,7 @@ sub get_dependent_mappings {
     $xref_dependent_mapped{$master_xref."|".$dependent_xref}=1;
   }
   $sth->finish;
-
+  return;
 }
 
 sub get_ext_synonyms{
@@ -2402,7 +2405,7 @@ sub parsing_finished_store_data{
     $self->add_meta_pair("PARSED_".$table_and_key{$table}, $max_val);
     $sth->finish;
   }
-  
+  return;
 }
 
 
@@ -2420,7 +2423,7 @@ sub reset_to_just_parsed{
 
  # set process_status to "parsing_finished"
 
-
+return;
 }
 
 
@@ -2428,6 +2431,7 @@ sub reset_to_mapping_finished{
   my $self= shift;
  $self->reset_to_parsed();
 #set process_status to "mapping_finished"
+  return;
 }
 
 # --------------------------------------------------------------------------------
diff --git a/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm b/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm
index df16975c46..a57a837235 100644
--- a/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm
@@ -13,7 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run_script {
 
-  my $self = shift if (defined(caller(1)));
+  my $self = shift;
   my $file = shift;
   my $source_id  = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/CeleraParser.pm b/misc-scripts/xref_mapping/XrefParser/CeleraParser.pm
index d2e38ad5b2..d4c54d1b35 100644
--- a/misc-scripts/xref_mapping/XrefParser/CeleraParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/CeleraParser.pm
@@ -16,8 +16,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/CeleraProteinParser.pm b/misc-scripts/xref_mapping/XrefParser/CeleraProteinParser.pm
index a51cc21403..6b71d99084 100644
--- a/misc-scripts/xref_mapping/XrefParser/CeleraProteinParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/CeleraProteinParser.pm
@@ -6,7 +6,7 @@ use base qw( XrefParser::CeleraParser );
 
 # See CeleraParser for details
 
-sub get_sequence_type()
+sub get_sequence_type
 {
     return 'peptide';
 }
diff --git a/misc-scripts/xref_mapping/XrefParser/CeleraTranscriptParser.pm b/misc-scripts/xref_mapping/XrefParser/CeleraTranscriptParser.pm
index fb08e9f140..c2f5473471 100644
--- a/misc-scripts/xref_mapping/XrefParser/CeleraTranscriptParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/CeleraTranscriptParser.pm
@@ -6,7 +6,7 @@ use base qw( XrefParser::CeleraParser );
 
 # See CeleraParser for details
 
-sub get_sequence_type()
+sub get_sequence_type
 {
     return 'dna';
 }
diff --git a/misc-scripts/xref_mapping/XrefParser/CodelinkParser.pm b/misc-scripts/xref_mapping/XrefParser/CodelinkParser.pm
index e314556b60..d987126916 100644
--- a/misc-scripts/xref_mapping/XrefParser/CodelinkParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/CodelinkParser.pm
@@ -14,8 +14,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/DBASSParser.pm b/misc-scripts/xref_mapping/XrefParser/DBASSParser.pm
index e1ec0267c8..4efd8e988b 100644
--- a/misc-scripts/xref_mapping/XrefParser/DBASSParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/DBASSParser.pm
@@ -20,8 +20,7 @@ my $source_id;
 
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -30,7 +29,6 @@ sub run {
 
   my $filename = @{$files}[0];
 
-#    my ( $source_id, $species_id, $filename, $rel_url,$verbose ) = @_;
 
     my $file_io = $self->get_filehandle($filename);
     if ( !defined($file_io) ) {
diff --git a/misc-scripts/xref_mapping/XrefParser/EG_DBParser.pm b/misc-scripts/xref_mapping/XrefParser/EG_DBParser.pm
index ee69800373..a535ba4109 100644
--- a/misc-scripts/xref_mapping/XrefParser/EG_DBParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/EG_DBParser.pm
@@ -8,22 +8,8 @@ use base qw( XrefParser::BaseParser );
 use strict;
 use Bio::EnsEMBL::DBSQL::DBAdaptor;
 
-
-#my $dbi2;
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: EG_DBParser.pm file <source_id> <species_id> <verbose>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
-
 sub run_script {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/EntrezGeneParser.pm b/misc-scripts/xref_mapping/XrefParser/EntrezGeneParser.pm
index 4811ab0000..b7ce3e4259 100644
--- a/misc-scripts/xref_mapping/XrefParser/EntrezGeneParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/EntrezGeneParser.pm
@@ -6,24 +6,9 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: EntrezGeneParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/FantomParser.pm b/misc-scripts/xref_mapping/XrefParser/FantomParser.pm
index 8184144e26..e049d77338 100644
--- a/misc-scripts/xref_mapping/XrefParser/FantomParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/FantomParser.pm
@@ -7,25 +7,9 @@ use File::Spec::Functions;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: FantomParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/FastaParser.pm b/misc-scripts/xref_mapping/XrefParser/FastaParser.pm
index 4cbc9c369e..2979e1d152 100644
--- a/misc-scripts/xref_mapping/XrefParser/FastaParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/FastaParser.pm
@@ -14,8 +14,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/Flybase_dmel_GFFv3_Parser.pm b/misc-scripts/xref_mapping/XrefParser/Flybase_dmel_GFFv3_Parser.pm
index 3beecdac6b..0f06ab57b9 100644
--- a/misc-scripts/xref_mapping/XrefParser/Flybase_dmel_GFFv3_Parser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/Flybase_dmel_GFFv3_Parser.pm
@@ -46,23 +46,6 @@ my %cache_source =();
 
 my $verbose;
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: Flybase_dmel_GFFv3_Parser.pm file.gff\n";
-    print scalar(@ARGV);
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
-# --------------------------------------------------------------------------------
-
 sub new {
   my $proto = shift;
   my $self = $proto->SUPER::new(@_);
@@ -177,8 +160,7 @@ sub get_source{
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -186,10 +168,6 @@ sub run {
   $verbose       = shift;
 
   my $file = @{$files}[0];
-#   my $self = shift if (defined(caller(1)));
-#  my $source_id = shift;
-#  my $species_id = shift;
-#  my $file = shift;
 
   my $species_name;
 
@@ -530,7 +508,7 @@ sub set_flybase_synonyms {
     $self->add_synonym($unique_id,\@syns);
     return \@syns;
   }
-  return undef;
+  return;
 }
 
 sub make_id_xref{
@@ -619,7 +597,7 @@ sub get_fields {
 
     # if the item does not hold information of specific field
   }else{
-    return undef;
+    return;
   }
 }
 
diff --git a/misc-scripts/xref_mapping/XrefParser/GOParser.pm b/misc-scripts/xref_mapping/XrefParser/GOParser.pm
index bcaaa991eb..3f7c7c4738 100644
--- a/misc-scripts/xref_mapping/XrefParser/GOParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/GOParser.pm
@@ -8,24 +8,9 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: GoParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/GOSlimParser.pm b/misc-scripts/xref_mapping/XrefParser/GOSlimParser.pm
index 27e27fc0ac..861e32f3ff 100644
--- a/misc-scripts/xref_mapping/XrefParser/GOSlimParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/GOSlimParser.pm
@@ -11,7 +11,7 @@ my $reg = "Bio::EnsEMBL::Registry";
 
 sub run_script {
 
-  my $self = shift if (defined(caller(1)));
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/HGNCParser.pm b/misc-scripts/xref_mapping/XrefParser/HGNCParser.pm
index b80e1ccfcc..674828b6a8 100644
--- a/misc-scripts/xref_mapping/XrefParser/HGNCParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/HGNCParser.pm
@@ -9,23 +9,9 @@ my $xref_sth ;
 my $dep_sth;
 my $syn_sth;
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: HGNCParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files_ref  = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/HPAParser.pm b/misc-scripts/xref_mapping/XrefParser/HPAParser.pm
index 86213a1d22..5b9b41572c 100644
--- a/misc-scripts/xref_mapping/XrefParser/HPAParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/HPAParser.pm
@@ -15,8 +15,7 @@ use base qw( XrefParser::BaseParser);
 
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/IKMCParser.pm b/misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
index 8418befa85..3b01292c9a 100644
--- a/misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
@@ -16,8 +16,7 @@ sub new {
 }
 
 sub run_script {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/IPIParser.pm b/misc-scripts/xref_mapping/XrefParser/IPIParser.pm
index 49a276def6..9925f5253c 100644
--- a/misc-scripts/xref_mapping/XrefParser/IPIParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/IPIParser.pm
@@ -13,8 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/IlluminaParser.pm b/misc-scripts/xref_mapping/XrefParser/IlluminaParser.pm
index b0a1d86724..9ca3123d5e 100644
--- a/misc-scripts/xref_mapping/XrefParser/IlluminaParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/IlluminaParser.pm
@@ -14,8 +14,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/IlluminaWGParser.pm b/misc-scripts/xref_mapping/XrefParser/IlluminaWGParser.pm
index cf063fea76..aaa2cc6228 100644
--- a/misc-scripts/xref_mapping/XrefParser/IlluminaWGParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/IlluminaWGParser.pm
@@ -7,8 +7,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/ImmunoDBParser.pm b/misc-scripts/xref_mapping/XrefParser/ImmunoDBParser.pm
index 8f647862b9..dbaa82911e 100644
--- a/misc-scripts/xref_mapping/XrefParser/ImmunoDBParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/ImmunoDBParser.pm
@@ -5,24 +5,8 @@ use POSIX qw(strftime);
 use File::Basename; 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: ImmunoDBParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
-
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/InterproGoParser.pm b/misc-scripts/xref_mapping/XrefParser/InterproGoParser.pm
index cb0e84f2a8..f2a8dba9f3 100644
--- a/misc-scripts/xref_mapping/XrefParser/InterproGoParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/InterproGoParser.pm
@@ -6,8 +6,7 @@ use vars qw(@ISA);
 @ISA = qw(XrefParser::BaseParser);
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/InterproParser.pm b/misc-scripts/xref_mapping/XrefParser/InterproParser.pm
index d0794e6d77..f538aa9a12 100644
--- a/misc-scripts/xref_mapping/XrefParser/InterproParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/InterproParser.pm
@@ -3,31 +3,14 @@ package XrefParser::InterproParser;
 use strict;
 use POSIX qw(strftime);
 use File::Basename;
-  
+
 use base 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: InterproParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-  
-  run(@ARGV);
-}
-  
- 
-sub run {
-  my $self = shift if (defined(caller(1)));
 
+sub run {
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files_ref = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/IxodesCAPParser.pm b/misc-scripts/xref_mapping/XrefParser/IxodesCAPParser.pm
index 2a888a14af..c2a2f1232a 100644
--- a/misc-scripts/xref_mapping/XrefParser/IxodesCAPParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/IxodesCAPParser.pm
@@ -13,8 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/JGI_Parser.pm b/misc-scripts/xref_mapping/XrefParser/JGI_Parser.pm
index cb32def5a1..7ceed6ea14 100644
--- a/misc-scripts/xref_mapping/XrefParser/JGI_Parser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/JGI_Parser.pm
@@ -13,8 +13,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/JGI_ProteinParser.pm b/misc-scripts/xref_mapping/XrefParser/JGI_ProteinParser.pm
index 90afb658b7..b290559173 100644
--- a/misc-scripts/xref_mapping/XrefParser/JGI_ProteinParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/JGI_ProteinParser.pm
@@ -7,7 +7,7 @@ use base qw( XrefParser::JGI_Parser );
 
 # See JGI_Parser for details
 
-sub get_sequence_type() {
+sub get_sequence_type {
   return 'peptide';
 }
 
diff --git a/misc-scripts/xref_mapping/XrefParser/MGDParser.pm b/misc-scripts/xref_mapping/XrefParser/MGDParser.pm
index 709aa4c3f8..8bb8c80b30 100644
--- a/misc-scripts/xref_mapping/XrefParser/MGDParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/MGDParser.pm
@@ -1,34 +1,17 @@
 package XrefParser::MGDParser;
- 
+
 use strict;
+use warnings;
 use POSIX qw(strftime);
 use File::Basename;
- 
+
 use base 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: MGDParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
- 
-  run($ARGV[0]);
- 
-}
- 
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -38,14 +21,18 @@ sub run {
   my $file = @{$files}[0];
 
   die "No longer used. MGI is taken form the uniprot file\n";
+}
+1;
+
+__END__
 
   if(!defined($source_id)){
     $source_id = XrefParser::BaseParser->get_source_id_for_filename($file);
   }
   if(!defined($species_id)){
     $species_id = XrefParser::BaseParser->get_species_id_for_filename($file);
-  }                                                                                                                      
-                                                                                                                      
+  }
+
   my (%swiss) = %{XrefParser::BaseParser->get_valid_codes("uniprot",$species_id)};
   my (%refseq) = %{XrefParser::BaseParser->get_valid_codes("refseq",$species_id)};
 
diff --git a/misc-scripts/xref_mapping/XrefParser/MGIParser.pm b/misc-scripts/xref_mapping/XrefParser/MGIParser.pm
index cab7091c0e..c48e3d1bf8 100644
--- a/misc-scripts/xref_mapping/XrefParser/MGIParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/MGIParser.pm
@@ -6,24 +6,9 @@ use DBI;
 
 use base qw(XrefParser::BaseParser);
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: MGIParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/MGI_Desc_Parser.pm b/misc-scripts/xref_mapping/XrefParser/MGI_Desc_Parser.pm
index 8d29ef3ec6..1c6fe5b661 100644
--- a/misc-scripts/xref_mapping/XrefParser/MGI_Desc_Parser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/MGI_Desc_Parser.pm
@@ -9,22 +9,9 @@ use strict;
 use Bio::EnsEMBL::DBSQL::DBAdaptor;
 
 
-#my $dbi2;
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: MGI_Desc_Parser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/MIMParser.pm b/misc-scripts/xref_mapping/XrefParser/MIMParser.pm
index d78e5a086a..c5b5296526 100644
--- a/misc-scripts/xref_mapping/XrefParser/MIMParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/MIMParser.pm
@@ -6,24 +6,9 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: MIMParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $general_source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/Mim2GeneParser.pm b/misc-scripts/xref_mapping/XrefParser/Mim2GeneParser.pm
index 008e0a4ddf..c6f093dfe3 100644
--- a/misc-scripts/xref_mapping/XrefParser/Mim2GeneParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/Mim2GeneParser.pm
@@ -6,24 +6,9 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: Mim2GeneParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm b/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm
index b1b848842b..dc42b67c7b 100644
--- a/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm
@@ -7,19 +7,9 @@ use base qw( XrefParser::BaseParser );
 
 use strict;
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: OTTTParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
 
 sub run_script {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/PHIbaseParser.pm b/misc-scripts/xref_mapping/XrefParser/PHIbaseParser.pm
index 9bb8f76ae2..13bfd128c5 100644
--- a/misc-scripts/xref_mapping/XrefParser/PHIbaseParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/PHIbaseParser.pm
@@ -8,29 +8,11 @@ use XML::LibXML;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: PhibaseParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  print STDERR "ARGV[0]: $ARGV[0]\n";
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id    = shift;
   my $species_id   = shift;
-  #my $phi_xml_file = shift;
   my $files        = shift;
   my $verbose      = shift;
 
diff --git a/misc-scripts/xref_mapping/XrefParser/RGDParser.pm b/misc-scripts/xref_mapping/XrefParser/RGDParser.pm
index a35e5deef5..3df95f851c 100644
--- a/misc-scripts/xref_mapping/XrefParser/RGDParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/RGDParser.pm
@@ -9,25 +9,9 @@ use base 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: RGDParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/RefSeqGPFFParser.pm b/misc-scripts/xref_mapping/XrefParser/RefSeqGPFFParser.pm
index 32acd1d3fb..1a93281505 100644
--- a/misc-scripts/xref_mapping/XrefParser/RefSeqGPFFParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/RefSeqGPFFParser.pm
@@ -8,28 +8,11 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: RefSeqGPFFParser.pm file.SPC <source_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
-# --------------------------------------------------------------------------------
-
 my $verbose;
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files_ref  = shift;
@@ -135,7 +118,7 @@ sub create_xrefs {
 
   if ( !defined $refseq_io ) {
     print STDERR "ERROR: Can't open RefSeqGPFF file $file\n";
-    return undef;
+    return;
   }
 
   my @xrefs;
@@ -161,7 +144,7 @@ sub create_xrefs {
 
   }else{
     print STDERR "Could not work out sequence type for $file\n";
-    return undef;
+    return;
   }
 
 
diff --git a/misc-scripts/xref_mapping/XrefParser/RefSeqParser.pm b/misc-scripts/xref_mapping/XrefParser/RefSeqParser.pm
index e631e31a0a..019d3d2060 100644
--- a/misc-scripts/xref_mapping/XrefParser/RefSeqParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/RefSeqParser.pm
@@ -10,26 +10,10 @@ use base qw( XrefParser::BaseParser );
 
 
 my $verbose;
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: RefSeqParser.pm file.SPC <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
-# --------------------------------------------------------------------------------
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id  = shift;
   my $species_id = shift;
   my $files_ref  = shift;
@@ -130,7 +114,7 @@ sub create_xrefs {
 
   if ( !defined $refseq_io ) {
       print STDERR "ERROR: Can't open RefSeq file $file\n";
-      return undef;
+      return;
   }
 
   my @xrefs;
diff --git a/misc-scripts/xref_mapping/XrefParser/RefSeq_CCDSParser.pm b/misc-scripts/xref_mapping/XrefParser/RefSeq_CCDSParser.pm
index fe64316796..3a89d7f2c2 100644
--- a/misc-scripts/xref_mapping/XrefParser/RefSeq_CCDSParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/RefSeq_CCDSParser.pm
@@ -10,7 +10,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run_script {
 
-  my $self = shift if (defined(caller(1)));
+  my $self = shift;
   my $file = shift;
   my $source_id  = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/SGDParser.pm b/misc-scripts/xref_mapping/XrefParser/SGDParser.pm
index 44d4e37653..e32c2d724a 100644
--- a/misc-scripts/xref_mapping/XrefParser/SGDParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/SGDParser.pm
@@ -9,21 +9,9 @@ use base qw( XrefParser::BaseParser );
 # --------------------------------------------------------------------------------
 # Parse command line and run if being run directly
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: SGDParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files_ref  = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/SegmentParser.pm b/misc-scripts/xref_mapping/XrefParser/SegmentParser.pm
index 3d87d28a71..623fb18739 100644
--- a/misc-scripts/xref_mapping/XrefParser/SegmentParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/SegmentParser.pm
@@ -6,23 +6,8 @@ use File::Basename;
  
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: SegmentParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files_ref  = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/UCSCParser.pm b/misc-scripts/xref_mapping/XrefParser/UCSCParser.pm
index 50645bf7ba..d8b3c244bd 100644
--- a/misc-scripts/xref_mapping/XrefParser/UCSCParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UCSCParser.pm
@@ -8,8 +8,7 @@ use warnings;
 use base qw( XrefParser::CoordinateParser );
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/UniGeneParser.pm b/misc-scripts/xref_mapping/XrefParser/UniGeneParser.pm
index 574d5e3c6a..ef664a438c 100644
--- a/misc-scripts/xref_mapping/XrefParser/UniGeneParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UniGeneParser.pm
@@ -10,26 +10,9 @@ use base qw( XrefParser::BaseParser );
 
 my $verbose;
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: UniGeneParser.pm file.SPC <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
-# --------------------------------------------------------------------------------
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -112,7 +95,7 @@ sub get_desc{
 
   if ( !defined $desc_io ) {
     print STDERR "ERROR: Can't open $data_file\n";
-    return undef;
+    return;
   }
 
   while ( $_ = $desc_io->getline() ) {
@@ -147,14 +130,14 @@ sub create_xrefs {
   # my %name2species_id     = map{ $_=>$species_id } @names;
 
   if ( !defined( $self->get_desc($data_file) ) ) {
-    return undef;
+    return;
   }
 
   my $unigene_io = $self->get_filehandle($uniq_file);
 
   if ( !defined $unigene_io ) {
     print STDERR "Can't open RefSeq file $uniq_file\n";
-    return undef;
+    return;
   }
 
 #>gnl|UG|Hs#S19185843 Homo sapiens N-acetyltransferase 2 (arylamine N-acetyltransferase)
diff --git a/misc-scripts/xref_mapping/XrefParser/UniProtDirectParser.pm b/misc-scripts/xref_mapping/XrefParser/UniProtDirectParser.pm
index f81c3311ee..e0f1123ceb 100644
--- a/misc-scripts/xref_mapping/XrefParser/UniProtDirectParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UniProtDirectParser.pm
@@ -10,26 +10,12 @@ use base qw( XrefParser::BaseParser );
 # All assumed to be linked to translation
 
 my $verbose;
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print "\nUsage: RefSeqParser.pm file.SPC <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
 
 # --------------------------------------------------------------------------------
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id  = shift;
   my $species_id = shift;
   my $files  = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/UniProtParser.pm b/misc-scripts/xref_mapping/XrefParser/UniProtParser.pm
index 2d82b3c578..8163af5bbf 100644
--- a/misc-scripts/xref_mapping/XrefParser/UniProtParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UniProtParser.pm
@@ -18,28 +18,9 @@ use base qw( XrefParser::BaseParser );
 
 my $verbose;
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 3) {
-    print STDERR "\nUsage: UniProtParser.pm file.SPC <source_id> <species_id>\n\n";
-    print STDERR scalar(@ARGV);
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
-# --------------------------------------------------------------------------------
-
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -199,7 +180,7 @@ sub create_xrefs {
       %{ $self->get_valid_codes( "mim_morbid", $species_id ) };
 
     my $uniprot_io = $self->get_filehandle($file);
-    if ( !defined $uniprot_io ) { return undef }
+    if ( !defined $uniprot_io ) { return }
 
   my @xrefs;
 
diff --git a/misc-scripts/xref_mapping/XrefParser/UniProtParser_descriptions_only.pm b/misc-scripts/xref_mapping/XrefParser/UniProtParser_descriptions_only.pm
index 0e233f0d8e..66100abe2b 100644
--- a/misc-scripts/xref_mapping/XrefParser/UniProtParser_descriptions_only.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UniProtParser_descriptions_only.pm
@@ -15,29 +15,13 @@ use File::Basename;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 3) {
-    print STDERR "\nUsage: UniProtParser.pm file.SPC <source_id> <species_id>\n\n";
-    print STDERR scalar(@ARGV);
-    exit(1);
-  }
-
-  run($ARGV[0], -1);
-
-}
-
 my $verbose;
 
 # --------------------------------------------------------------------------------
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id    = shift;
   my $species_id   = shift;
   my $files         = shift;
@@ -177,7 +161,7 @@ sub create_xrefs {
   print "Predicted SpTREMBL source id for $file: $sptr_pred_source_id\n" if($verbose);
 
     my $uniprot_io = $self->get_filehandle($file);
-    if ( !defined $uniprot_io ) { return undef }
+    if ( !defined $uniprot_io ) { return }
 
   my @xrefs;
 
diff --git a/misc-scripts/xref_mapping/XrefParser/UniProtVarSplicParser.pm b/misc-scripts/xref_mapping/XrefParser/UniProtVarSplicParser.pm
index 2ac20eb65c..efb7a1e82e 100644
--- a/misc-scripts/xref_mapping/XrefParser/UniProtVarSplicParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/UniProtVarSplicParser.pm
@@ -18,8 +18,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VBCommunitySymbolParser.pm b/misc-scripts/xref_mapping/XrefParser/VBCommunitySymbolParser.pm
index cd8f89ed4f..02dc38fb93 100644
--- a/misc-scripts/xref_mapping/XrefParser/VBCommunitySymbolParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VBCommunitySymbolParser.pm
@@ -6,24 +6,9 @@ use File::Basename;
  
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: VBCommunitySymbolParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VBExternalDescriptionParser.pm b/misc-scripts/xref_mapping/XrefParser/VBExternalDescriptionParser.pm
index 804edce1a9..38da9125ef 100644
--- a/misc-scripts/xref_mapping/XrefParser/VBExternalDescriptionParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VBExternalDescriptionParser.pm
@@ -13,21 +13,9 @@ use base qw( XrefParser::BaseParser );
 # AAEL010223      phosphatidylserine decarboxylase
 # ...
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: VBExternalDescription.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VBPubMedParser.pm b/misc-scripts/xref_mapping/XrefParser/VBPubMedParser.pm
index b21e682ebb..a4fff87462 100644
--- a/misc-scripts/xref_mapping/XrefParser/VBPubMedParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VBPubMedParser.pm
@@ -12,22 +12,9 @@ use base qw( XrefParser::BaseParser );
 #1961751	AAEL006563	gene	AAEL006563	Inferred from UniProt entry VCP_AEDAE (P42660)
 #2052024	AAEL006424	gene	AAEL006424	Inferred from UniProt entry ALL2_AEDAE (P18153)
 
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: VBPubMed.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VBRNADescriptionParser.pm b/misc-scripts/xref_mapping/XrefParser/VBRNADescriptionParser.pm
index a939e46434..f721c9a803 100644
--- a/misc-scripts/xref_mapping/XrefParser/VBRNADescriptionParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VBRNADescriptionParser.pm
@@ -12,22 +12,9 @@ use base qw( XrefParser::BaseParser );
 # AGAP013556      U6 spliceosomal RNA [Source: RFAM 9.0]
 # etc.
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: VBRNADescription.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VBribosomalParser.pm b/misc-scripts/xref_mapping/XrefParser/VBribosomalParser.pm
index f37bcaf41e..719af0eae6 100644
--- a/misc-scripts/xref_mapping/XrefParser/VBribosomalParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VBribosomalParser.pm
@@ -13,21 +13,9 @@ use base qw( XrefParser::BaseParser );
 # MOS10003	AGAP001910	gene	Rps3	40S ribosomal protein S3
 # ...
 
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: VBribosomalParser.pm.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/VbDirectParser.pm b/misc-scripts/xref_mapping/XrefParser/VbDirectParser.pm
index de97986c48..1c8013b33e 100644
--- a/misc-scripts/xref_mapping/XrefParser/VbDirectParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VbDirectParser.pm
@@ -19,14 +19,14 @@ sub run {
 
 	my ($self, $file, $source_id, $species_id) = @_;
 
-	open (INFILE, "<$file");
+	open my $FH, "<", $file || return;
 	my $i=0;
 	print STDERR "source: ".$source_id."\tspecies: ".$species_id."\n";
 	
 
 	my $type = "transcript";
 
-	while (my $ln = <INFILE>) {
+	while (my $ln = <$FH>) {
 		chomp($ln);
 		my ($probe,$id, $version, $description, $ensembl_id) = split("\t",$ln);      
 		$i++;
@@ -40,7 +40,7 @@ sub run {
 
 	print $i." VB direct xrefs succesfully parsed\n" if($verbose);
 
-	close(INFILE);
+	close($FH);
 
 	return 0;
 
diff --git a/misc-scripts/xref_mapping/XrefParser/VbGFF3Parser.pm b/misc-scripts/xref_mapping/XrefParser/VbGFF3Parser.pm
index 7e516a65d3..ce4fe5dcb5 100644
--- a/misc-scripts/xref_mapping/XrefParser/VbGFF3Parser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/VbGFF3Parser.pm
@@ -12,8 +12,7 @@ use base qw( XrefParser::CoordinateParser );
 
 # Parser for GFF3-format probe mappings from Vectorbase
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -22,9 +21,9 @@ sub run {
 
   my $file = @{$files}[0];
 
-	open (INFILE, "<$file");
+	open ($FH, "<", $file) || return 1;
 	my $i=0; my $type = "transcript";
-	while (my $ln = <INFILE>) {
+	while (my $ln = <$FH>) {
 #	# parse GFF line:
 		chomp($ln); $i++;
 		my ($seqid, $source, $type, $start, $end, $score, $strand, $phase, $attributes) = split("\t",$ln);
@@ -76,7 +75,7 @@ sub run {
 			}
 		}
 	print STDERR $i." VB GFF3 xrefs succesfully parsed\n" if($verbose);
-	close(INFILE);
+	close($FH);
 
   return 0;
 } ## end sub run
diff --git a/misc-scripts/xref_mapping/XrefParser/WilsonAffyParser.pm b/misc-scripts/xref_mapping/XrefParser/WilsonAffyParser.pm
index 9eb1ee65e6..b3c29c2432 100644
--- a/misc-scripts/xref_mapping/XrefParser/WilsonAffyParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/WilsonAffyParser.pm
@@ -10,8 +10,7 @@ my $syn_sth;
 
 sub run {
 
- my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/WormPepParser.pm b/misc-scripts/xref_mapping/XrefParser/WormPepParser.pm
index e86d288af1..49e55340d6 100644
--- a/misc-scripts/xref_mapping/XrefParser/WormPepParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/WormPepParser.pm
@@ -17,8 +17,7 @@ my $dep_sth;
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/XenopusJamboreeParser.pm b/misc-scripts/xref_mapping/XrefParser/XenopusJamboreeParser.pm
index a646eff138..0ff6fef022 100644
--- a/misc-scripts/xref_mapping/XrefParser/XenopusJamboreeParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/XenopusJamboreeParser.pm
@@ -11,8 +11,7 @@ use base qw( XrefParser::BaseParser );
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/ZFINDescParser.pm b/misc-scripts/xref_mapping/XrefParser/ZFINDescParser.pm
index f42493093a..ab03b01198 100644
--- a/misc-scripts/xref_mapping/XrefParser/ZFINDescParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/ZFINDescParser.pm
@@ -7,25 +7,10 @@ use File::Spec::Functions;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: ZFINDescParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
@@ -42,7 +27,7 @@ sub run {
   }
 
 
-  open(FH,"<$file") || die "could not open file $file";
+  open( my $FH, "<", $file) || die "could not open file $file";
   
 
 #e.g.
@@ -53,7 +38,7 @@ sub run {
 
   my $count =0;
   my $withdrawn = 0;
-  while ( <FH> ) {
+  while ( <$FH> ) {
     chomp;
     my ($zfin, $desc, $label) = split (/\t/,$_);
 
@@ -65,6 +50,7 @@ sub run {
       $count++;
     }
   }
+  close($FH);
 
   if($verbose){
     print "\t$count xrefs added, $withdrawn withdrawn entries ignored\n";
diff --git a/misc-scripts/xref_mapping/XrefParser/ZFINParser.pm b/misc-scripts/xref_mapping/XrefParser/ZFINParser.pm
index 9ba745b102..a00cb1d867 100644
--- a/misc-scripts/xref_mapping/XrefParser/ZFINParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/ZFINParser.pm
@@ -7,25 +7,9 @@ use File::Spec::Functions;
 
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: ZFINParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
-
 sub run {
 
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm b/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm
index 0518e8b16a..d5da63aeb2 100644
--- a/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm
@@ -9,21 +9,8 @@ use Bio::EnsEMBL::Registry;
 my $reg = "Bio::EnsEMBL::Registry";
 
 
-#my $dbi2;
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: curated_transcriptParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
-
 sub run_script {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/ncRNAParser.pm b/misc-scripts/xref_mapping/XrefParser/ncRNAParser.pm
index 7e4b80eceb..06cad2bc89 100644
--- a/misc-scripts/xref_mapping/XrefParser/ncRNAParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/ncRNAParser.pm
@@ -6,24 +6,9 @@ use File::Basename;
  
 use base qw( XrefParser::BaseParser );
 
-# --------------------------------------------------------------------------------
-# Parse command line and run if being run directly
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: ncRNAParser.pm file <source_id> <species_id>\n\n";
-    exit(1);
-  }
-
-  run($ARGV[0]);
-
-}
-
 
 sub run {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $source_id = shift;
   my $species_id = shift;
   my $files       = shift;
diff --git a/misc-scripts/xref_mapping/XrefParser/ncRNA_DBParser.pm b/misc-scripts/xref_mapping/XrefParser/ncRNA_DBParser.pm
index 1f2bc3f787..ba8b8cb414 100644
--- a/misc-scripts/xref_mapping/XrefParser/ncRNA_DBParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/ncRNA_DBParser.pm
@@ -9,21 +9,8 @@ use strict;
 use Bio::EnsEMBL::DBSQL::DBAdaptor;
 
 
-#my $dbi2;
-
-if (!defined(caller())) {
-
-  if (scalar(@ARGV) != 1) {
-    print STDERR "\nUsage: ncRNA_DBParser.pm file <source_id> <species_id> <verbose>\n\n";
-    exit(1);
-  }
-
-  run(@ARGV);
-}
-
 sub run_script {
-  my $self = shift if (defined(caller(1)));
-
+  my $self = shift;
   my $file = shift;
   my $source_id = shift;
   my $species_id = shift;
-- 
GitLab