From 4d7fb252c593d5623b2185d4d2ecf6eb8cd38515 Mon Sep 17 00:00:00 2001
From: Dan Staines <dstaines@ebi.ac.uk>
Date: Mon, 18 Mar 2013 09:37:38 +0000
Subject: [PATCH] reformatted source with current perltidy settings

---
 modules/Bio/EnsEMBL/DBSQL/AttributeAdaptor.pm | 411 ++++++++----------
 modules/t/attributeAdaptor.t                  | 178 +++-----
 2 files changed, 238 insertions(+), 351 deletions(-)

diff --git a/modules/Bio/EnsEMBL/DBSQL/AttributeAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/AttributeAdaptor.pm
index 8bab776831..9b855af26c 100644
--- a/modules/Bio/EnsEMBL/DBSQL/AttributeAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/AttributeAdaptor.pm
@@ -1,3 +1,4 @@
+
 =head1 LICENSE
 
   Copyright (c) 1999-2012 The European Bioinformatics Institute and
@@ -58,7 +59,6 @@ use vars qw(@ISA);
 
 @ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
 
-
 =head2 new
 
   Arg [...]  : Superclass args.  See Bio::EnsEMBL::DBSQL::BaseAdaptor
@@ -70,13 +70,11 @@ use vars qw(@ISA);
 
 =cut
 
-
 sub new {
   my $class = shift;
 
   my $self = $class->SUPER::new(@_);
 
-
   # cache creation could go here
   return $self;
 }
@@ -84,234 +82,207 @@ sub new {
 use vars '$AUTOLOAD';
 
 sub AUTOLOAD {
-  my ($self,@args) = @_;
-  my @array_return=();
-  my $ref_return = undef;
-  $AUTOLOAD =~ /^.*::(\w+_)+(\w+)$/ ;
+  my ($self, @args) = @_;
+  my @array_return = ();
+  my $ref_return   = undef;
+  $AUTOLOAD =~ /^.*::(\w+_)+(\w+)$/;
 
-  my $sub = $1;
+  my $sub  = $1;
   my $type = $2;
 
+  #  print STDERR "AUTO".$AUTOLOAD."\n";
 
-
-#  print STDERR "AUTO".$AUTOLOAD."\n";
-
-#  print STDERR "AUTOLOAD reached with call to $sub of type $type\n";
-  if($self->can($sub)){
-    return $self->$sub($type,@args);
-  }
-  else{
-    warn("In AttribAdaptor cannot call sub $sub$type\n");
+  #  print STDERR "AUTOLOAD reached with call to $sub of type $type\n";
+  if ($self->can($sub)) {
+	return $self->$sub($type, @args);
+  } else {
+	warn("In AttribAdaptor cannot call sub $sub$type\n");
   }
   return undef;
 }
 
-
-
 sub store_on_ {
-  my $self = shift;
-  my $type = shift;
-  my $object = shift;
+  my $self       = shift;
+  my $type       = shift;
+  my $object     = shift;
   my $attributes = shift;
   my $table;
 
-
   my $object_id;
-  if($type =~ /[GT][er][na][en]/){
-    if (!ref($object)){
-      $object_id = $object;
-    }
-    else {
-      $object_id = $object->dbID;
-    }
-    $table = lc($type);
-#    $type = lc($type);
-  }
-  else{
-    if(!ref($object) || !$object->isa('Bio::EnsEMBL::'.$type)) {
-      throw("$type argument is required. but you passed $object");
-    }
-    if($type eq "Slice"){
-      $object_id = $object->get_seq_region_id();
-      $table = "seq_region"; 
-      $type = "seq_region";
-    }
-    else{
-      if($type eq "MiscFeature"){
-	$type = "misc_feature";
-	$table = "misc"; 
-      }
-      else{
+  if ($type =~ /[GT][er][na][en]/) {
+	if (!ref($object)) {
+	  $object_id = $object;
+	} else {
+	  $object_id = $object->dbID;
+	}
 	$table = lc($type);
-      }
-      
-      $object_id = $object->dbID();
-      my $db = $self->db();
-      
-      if(!$object->is_stored($db)) {
-	throw("$type is not stored in this database.");
-      }
-      
-    }
-  }
-  my $sth = $self->prepare( "INSERT into ".$table."_attrib ".
-			    "SET ".$type."_id = ?, attrib_type_id = ?, ".
-			    "value = ? " );
+	#    $type = lc($type);
+  } else {
+	if (!ref($object) || !$object->isa('Bio::EnsEMBL::' . $type)) {
+	  throw("$type argument is required. but you passed $object");
+	}
+	if ($type eq "Slice") {
+	  $object_id = $object->get_seq_region_id();
+	  $table     = "seq_region";
+	  $type      = "seq_region";
+	} else {
+	  if ($type eq "MiscFeature") {
+		$type  = "misc_feature";
+		$table = "misc";
+	  } else {
+		$table = lc($type);
+	  }
+
+	  $object_id = $object->dbID();
+	  my $db = $self->db();
+
+	  if (!$object->is_stored($db)) {
+		throw("$type is not stored in this database.");
+	  }
+
+	}
+  } ## end else [ if ($type =~ /[GT][er][na][en]/)]
+  my $sth = $self->prepare("INSERT into " . $table . "_attrib " . "SET " . $type . "_id = ?, attrib_type_id = ?, " . "value = ? ");
 
   my $undef_circular_cache = 0;
-  for my $attrib ( @$attributes ) {
-    if(!ref($attrib) && $attrib->isa('Bio::EnsEMBL::Attribute')) {
-      throw("Reference to list of Bio::EnsEMBL::Attribute objects " .
-            "argument expected.");
-    }
-
-#    next if ! $attrib->value;
-
-    my $atid = $self->_store_type( $attrib );
-    if ((defined $attrib->code) and ($attrib->code eq 'circular_seq')) {
-	$undef_circular_cache = 1;
-    }
-    $sth->bind_param(1,$object_id,SQL_INTEGER);
-    $sth->bind_param(2,$atid,SQL_INTEGER);
-    $sth->bind_param(3,$attrib->value,SQL_VARCHAR);
-    $sth->execute();
+  for my $attrib (@$attributes) {
+	if (!ref($attrib) && $attrib->isa('Bio::EnsEMBL::Attribute')) {
+	  throw("Reference to list of Bio::EnsEMBL::Attribute objects " . "argument expected.");
+	}
+
+	#    next if ! $attrib->value;
+
+	my $atid = $self->_store_type($attrib);
+	if ((defined $attrib->code) and ($attrib->code eq 'circular_seq')) {
+	  $undef_circular_cache = 1;
+	}
+	$sth->bind_param(1, $object_id,     SQL_INTEGER);
+	$sth->bind_param(2, $atid,          SQL_INTEGER);
+	$sth->bind_param(3, $attrib->value, SQL_VARCHAR);
+	$sth->execute();
   }
 
-  if($table eq "seq_region") {        
-    if ($undef_circular_cache) {
-	#the slice is circular
-	$object->{'circular'} = 1;
-	my $slice_adaptor = $object->adaptor();
-        #undefine slice adaptor->is_circular and the circular slice cache
-	if (defined $slice_adaptor) {
-	    $slice_adaptor->{'is_circular'} = undef;
-	    $slice_adaptor->{'circular_sr_id_cache'} = {};
+  if ($table eq "seq_region") {
+	if ($undef_circular_cache) {
+	  #the slice is circular
+	  $object->{'circular'} = 1;
+	  my $slice_adaptor = $object->adaptor();
+	  #undefine slice adaptor->is_circular and the circular slice cache
+	  if (defined $slice_adaptor) {
+		$slice_adaptor->{'is_circular'}          = undef;
+		$slice_adaptor->{'circular_sr_id_cache'} = {};
+	  }
 	}
-    }
   }
 
   return;
-}
+} ## end sub store_on_
 
-
-sub remove_from_{
+sub remove_from_ {
   my $self   = shift;
   my $type   = shift;
   my $object = shift;
   my $code   = shift;
   my $table;
 
-  if(!ref($object) || !$object->isa('Bio::EnsEMBL::'.$type)) {
-    throw("$type argument is required or a attrib code. but you passed $object");
+  if (!ref($object) || !$object->isa('Bio::EnsEMBL::' . $type)) {
+	throw("$type argument is required or a attrib code. but you passed $object");
   }
 
   my $object_id;
-  if($type eq "Slice"){
-    $object_id = $object->get_seq_region_id();
-    $table = "seq_region"; 
-    $type = "seq_region";
-    if ((defined $code) and ($code eq 'circular_seq')) {
-	#undefine slice->is_circular, slice adaptor->is_circular and the circular slice cache
-	$object->{'circular'} = undef;
-	my $slice_adaptor = $object->adaptor();
-	if (defined $slice_adaptor) {
-	    $slice_adaptor->{'is_circular'} = undef;
-	    $slice_adaptor->{'circular_sr_id_cache'} = {};
+  if ($type eq "Slice") {
+	$object_id = $object->get_seq_region_id();
+	$table     = "seq_region";
+	$type      = "seq_region";
+	if ((defined $code) and ($code eq 'circular_seq')) {
+	  #undefine slice->is_circular, slice adaptor->is_circular and the circular slice cache
+	  $object->{'circular'} = undef;
+	  my $slice_adaptor = $object->adaptor();
+	  if (defined $slice_adaptor) {
+		$slice_adaptor->{'is_circular'}          = undef;
+		$slice_adaptor->{'circular_sr_id_cache'} = {};
+	  }
+	}
+  } else {
+	if ($type eq "MiscFeature") {
+	  $type  = "misc_feature";
+	  $table = "misc";
+	} else {
+	  $table = lc($type);
+	}
+
+	$object_id = $object->dbID();
+	my $db = $self->db();
+
+	if (!$object->is_stored($db)) {
+	  throw("$type is not stored in this database.");
 	}
-    }
-  }
-  else{
-    if($type eq "MiscFeature"){
-      $type = "misc_feature";
-      $table = "misc"; 
-    }
-    else{
-      $table = lc($type);
-    }
-
-    $object_id = $object->dbID();
-    my $db = $self->db();
-    
-    if(!$object->is_stored($db)) {
-      throw("$type is not stored in this database.");
-    }
 
   }
 
-  if(!defined($object_id)) {
-    throw("$type must have dbID.");
+  if (!defined($object_id)) {
+	throw("$type must have dbID.");
   }
 
   my $sth;
-  if(defined($code)){
-    $sth = $self->prepare("DELETE a FROM ".$table."_attrib a ,attrib_type at " .
-                         "WHERE a.attrib_type_id = at.attrib_type_id AND ".
-                         "a.".$type."_id = ? AND ".
-			 "at.code like ?");
-    $sth->bind_param(1,$object_id,SQL_INTEGER);
-    $sth->bind_param(2,$code,SQL_VARCHAR);
-  }
-  else{
-    $sth = $self->prepare("DELETE FROM ".$table."_attrib " .
-                         "WHERE ".$type."_id = ?");
-    $sth->bind_param(1,$object_id,SQL_INTEGER);
+  if (defined($code)) {
+	$sth = $self->prepare("DELETE a FROM " . $table . "_attrib a ,attrib_type at " . "WHERE a.attrib_type_id = at.attrib_type_id AND " . "a." . $type . "_id = ? AND " . "at.code like ?");
+	$sth->bind_param(1, $object_id, SQL_INTEGER);
+	$sth->bind_param(2, $code,      SQL_VARCHAR);
+  } else {
+	$sth = $self->prepare("DELETE FROM " . $table . "_attrib " . "WHERE " . $type . "_id = ?");
+	$sth->bind_param(1, $object_id, SQL_INTEGER);
   }
   $sth->execute();
 
   $sth->finish();
 
   return;
-}
+} ## end sub remove_from_
 
 sub fetch_all {
   throw("Use of method fetch_all not supported for attributes");
 }
 
+sub fetch_all_by_ {
+  my $self   = shift;
+  my $type   = shift;
+  my $object = shift;
+  my $code   = shift;
+  my $table  = undef;
 
-
-sub fetch_all_by_{
-  my $self     = shift;
-  my $type     = shift;
-  my $object   = shift;
-  my $code     = shift;
-  my $table =undef;
-
-  if (defined($object)){
-    if(!ref($object) || !$object->isa('Bio::EnsEMBL::'.$type)) {
-      throw("$type argument is required. but you passed $object");
-    }
+  if (defined($object)) {
+	if (!ref($object) || !$object->isa('Bio::EnsEMBL::' . $type)) {
+	  throw("$type argument is required. but you passed $object");
+	}
   }
 
   my $object_id;
-  if($type eq "Slice"){
-    $object_id = $object->get_seq_region_id() if defined $object;
-    $table = "seq_region"; 
-    $type = "seq_region";
-  }
-  else{
-    if($type eq "MiscFeature"){
-      $type = "misc_feature";
-      $table = "misc"; 
-    }
-    else{
-      $table = lc($type);
-    }
-
-    $object_id = $object->dbID() if defined $object;
+  if ($type eq "Slice") {
+	$object_id = $object->get_seq_region_id() if defined $object;
+	$table     = "seq_region";
+	$type      = "seq_region";
+  } else {
+	if ($type eq "MiscFeature") {
+	  $type  = "misc_feature";
+	  $table = "misc";
+	} else {
+	  $table = lc($type);
+	}
+
+	$object_id = $object->dbID() if defined $object;
   }
 
-  my $sql = "SELECT at.code, at.name, at.description, t.value " .
-              "FROM ".($table||$type)."_attrib t, attrib_type at ".
-                 "WHERE at.attrib_type_id = t.attrib_type_id ";
+  my $sql = "SELECT at.code, at.name, at.description, t.value " . "FROM " . ($table || $type) . "_attrib t, attrib_type at " . "WHERE at.attrib_type_id = t.attrib_type_id ";
 
-  if(defined($code)){
-    $sql .= 'AND at.code like "'.$code.'" ';
+  if (defined($code)) {
+	$sql .= 'AND at.code like "' . $code . '" ';
   }
 
-  if(defined($object_id)){
-    $sql .= "AND t.".$type."_id = ".$object_id;
+  if (defined($object_id)) {
+	$sql .= "AND t." . $type . "_id = " . $object_id;
   }
-		   
+
   my $sth = $self->prepare($sql);
   $sth->execute();
 
@@ -320,14 +291,12 @@ sub fetch_all_by_{
   $sth->finish();
 
   return $results;
-  
-}
 
+} ## end sub fetch_all_by_
 
-sub DESTROY{
+sub DESTROY {
 }
 
-
 #
 # _id_check
 #
@@ -336,94 +305,84 @@ sub DESTROY{
 #
 
 sub _id_check {
-  my $self = shift;
+  my $self  = shift;
   my $ensID = shift;
 
   if ($ensID =~ /^\d+$/) {
-    return $ensID;
-  
-  } elsif (ref($ensID) eq 'Bio::EnsEMBL::Gene' or
-      ref($ensID) eq 'Bio::EnsEMBL::Transcript' or
-      ref($ensID) eq 'Bio::EnsEMBL::Translation') {
+	return $ensID;
+
+  } elsif (   ref($ensID) eq 'Bio::EnsEMBL::Gene'
+		   or ref($ensID) eq 'Bio::EnsEMBL::Transcript'
+		   or ref($ensID) eq 'Bio::EnsEMBL::Translation')
+  {
 
-    warning("You should pass a dbID rather than an ensembl object to store the attribute on");
+	warning("You should pass a dbID rather than an ensembl object to store the attribute on");
 
-    if ($ensID->dbID) {
-      return $ensID->dbID;
-    } else {
-      throw("Ensembl object ".$ensID->display_id." doesn't have a dbID, can't store attribute");
-    }
+	if ($ensID->dbID) {
+	  return $ensID->dbID;
+	} else {
+	  throw("Ensembl object " . $ensID->display_id . " doesn't have a dbID, can't store attribute");
+	}
 
   } else {
-    throw("Invalid dbID");
+	throw("Invalid dbID");
   }
 
-}
-
+} ## end sub _id_check
 
 # _store_type
 
 sub _store_type {
-  my $self = shift;
+  my $self   = shift;
   my $attrib = shift;
 
-  my $sth1 = $self->prepare
-    ("INSERT IGNORE INTO attrib_type set code = ?, name = ?, ".
-     "description = ?" );
-
+  my $sth1 = $self->prepare("INSERT IGNORE INTO attrib_type set code = ?, name = ?, " . "description = ?");
 
-  $sth1->bind_param(1,$attrib->code,SQL_VARCHAR);
-  $sth1->bind_param(2,$attrib->name,SQL_VARCHAR);
-  $sth1->bind_param(3,$attrib->description,SQL_LONGVARCHAR);
+  $sth1->bind_param(1, $attrib->code,        SQL_VARCHAR);
+  $sth1->bind_param(2, $attrib->name,        SQL_VARCHAR);
+  $sth1->bind_param(3, $attrib->description, SQL_LONGVARCHAR);
 
-  my $rows_inserted =  $sth1->execute();
+  my $rows_inserted = $sth1->execute();
 
   my $atid = $sth1->{'mysql_insertid'};
 
-  if($rows_inserted == 0) {
-    # the insert failed because the code is already stored
-    my $sth2 = $self->prepare
-      ("SELECT attrib_type_id FROM attrib_type " .
-       "WHERE code = ?");
-    $sth2->bind_param(1,$attrib->code,SQL_VARCHAR);
-    $sth2->execute();
-    ($atid) = $sth2->fetchrow_array();
-
-    $sth2->finish();
-
-    if(!$atid) {
-      throw("Could not store or fetch attrib_type code [".$attrib->code."]\n" .
-	    "Wrong database user/permissions?");
-    }
+  if ($rows_inserted == 0) {
+	# the insert failed because the code is already stored
+	my $sth2 = $self->prepare("SELECT attrib_type_id FROM attrib_type " . "WHERE code = ?");
+	$sth2->bind_param(1, $attrib->code, SQL_VARCHAR);
+	$sth2->execute();
+	($atid) = $sth2->fetchrow_array();
+
+	$sth2->finish();
+
+	if (!$atid) {
+	  throw("Could not store or fetch attrib_type code [" . $attrib->code . "]\n" . "Wrong database user/permissions?");
+	}
   }
 
   $sth1->finish();
 
   return $atid;
-}
-
+} ## end sub _store_type
 
 sub _obj_from_sth {
   my $self = shift;
-  my $sth = shift;
+  my $sth  = shift;
 
   my ($code, $name, $desc, $value);
   $sth->bind_columns(\$code, \$name, \$desc, \$value);
 
   my @results;
-  while($sth->fetch()) {
-    push @results, Bio::EnsEMBL::Attribute->new_fast
-                                             ( {'code' => $code,
-                                                'name' => $name,
-                                                'description' => $desc,
-                                                'value' => $value} );
+  while ($sth->fetch()) {
+	push @results,
+	  Bio::EnsEMBL::Attribute->new_fast({'code'        => $code,
+										 'name'        => $name,
+										 'description' => $desc,
+										 'value'       => $value});
   }
 
   return \@results;
 }
 
-
-
-
 1;
 
diff --git a/modules/t/attributeAdaptor.t b/modules/t/attributeAdaptor.t
index 7501dc4876..092a85430c 100644
--- a/modules/t/attributeAdaptor.t
+++ b/modules/t/attributeAdaptor.t
@@ -8,10 +8,9 @@ use Bio::EnsEMBL::Test::MultiTestDB;
 use Bio::EnsEMBL::Attribute;
 
 our $verbose = 1;
-our $clean = 0;
+our $clean   = 0;
 
 my $multi = Bio::EnsEMBL::Test::MultiTestDB->new;
-
 # get a core DBAdaptor
 my $db = $multi->get_DBAdaptor("core");
 
@@ -19,7 +18,6 @@ my $slice_adaptor = $db->get_SliceAdaptor();
 my $mfa           = $db->get_MiscFeatureAdaptor();
 my $ga            = $db->get_GeneAdaptor();
 
-
 #
 # Test get_AttributeAdaptor works
 #
@@ -27,21 +25,18 @@ my $aa = $db->get_AttributeAdaptor();
 
 ok($aa && ref($aa) && $aa->isa('Bio::EnsEMBL::DBSQL::AttributeAdaptor'));
 
-
 # hide the contents of the attrib_type, misc_attrib, seq_region_attrib tables
 # so we can test storing etc. with a clean slate
 $multi->hide('core', 'misc_attrib', 'seq_region_attrib', 'attrib_type', 'gene_attrib');
 
-
 ##############
 # MiscFeature functionality tests
 #
 
-my $attrib = Bio::EnsEMBL::Attribute->new(-NAME => 'test_name',
-                                          -CODE => 'test_code',
-                                          -DESCRIPTION => 'test_desc',
-                                          -VALUE => 'test_value');
-
+my $attrib = Bio::EnsEMBL::Attribute->new(-NAME        => 'test_name',
+										  -CODE        => 'test_code',
+										  -DESCRIPTION => 'test_desc',
+										  -VALUE       => 'test_value');
 
 my $mf = $mfa->fetch_by_dbID(1);
 $aa->store_on_MiscFeature($mf, [$attrib]);
@@ -49,18 +44,14 @@ $aa->store_on_MiscFeature($mf, [$attrib]);
 #
 # make sure the misc_attrib table was updated
 #
-my $count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM misc_attrib " .
-   "WHERE misc_feature_id = 1")->[0]->[0];
+my $count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM misc_attrib " . "WHERE misc_feature_id = 1")->[0]->[0];
 
 ok($count == 1);
 
 #
 # make sure the attrib_type table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM attrib_type " .
-   "WHERE code = 'test_code'")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM attrib_type " . "WHERE code = 'test_code'")->[0]->[0];
 ok($count == 1);
 
 #
@@ -72,22 +63,21 @@ ok(@attribs == 1);
 
 $attrib = $attribs[0];
 
-ok($attrib->name eq 'test_name');
-ok($attrib->code eq 'test_code');
+ok($attrib->name        eq 'test_name');
+ok($attrib->code        eq 'test_code');
 ok($attrib->description eq 'test_desc');
-ok($attrib->value eq 'test_value');
+ok($attrib->value       eq 'test_value');
 
-@attribs = @{ $aa->fetch_all_by_MiscFeature() };
+@attribs = @{$aa->fetch_all_by_MiscFeature()};
 
 ok(@attribs == 1);
 
 $attrib = $attribs[0];
 
-ok($attrib->name eq 'test_name');
-ok($attrib->code eq 'test_code');
+ok($attrib->name        eq 'test_name');
+ok($attrib->code        eq 'test_code');
 ok($attrib->description eq 'test_desc');
-ok($attrib->value eq 'test_value');
-
+ok($attrib->value       eq 'test_value');
 
 #
 # test the removal of this attribute
@@ -97,9 +87,7 @@ $aa->remove_from_MiscFeature($mf);
 #
 # make sure the misc_attrib table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM misc_attrib " .
-   "WHERE misc_feature_id = 1")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM misc_attrib " . "WHERE misc_feature_id = 1")->[0]->[0];
 
 ok($count == 0);
 
@@ -109,19 +97,14 @@ ok($count == 0);
 @attribs = @{$aa->fetch_all_by_MiscFeature($mf)};
 ok(@attribs == 0);
 
-
-
-
 #################
 # Slice functionality tests
 #
 
-
-$attrib = Bio::EnsEMBL::Attribute->new(-NAME => 'test_name2',
-                                       -CODE => 'test_code2',
-                                       -DESCRIPTION => 'test_desc2',
-                                       -VALUE => 'test_value2');
-
+$attrib = Bio::EnsEMBL::Attribute->new(-NAME        => 'test_name2',
+									   -CODE        => 'test_code2',
+									   -DESCRIPTION => 'test_desc2',
+									   -VALUE       => 'test_value2');
 
 my $slice = $slice_adaptor->fetch_by_region('chromosome', '20');
 
@@ -130,18 +113,14 @@ $aa->store_on_Slice($slice, [$attrib]);
 #
 # make sure the seq_region_attrib table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM seq_region_attrib " .
-   "WHERE seq_region_id = ".$slice->get_seq_region_id())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM seq_region_attrib " . "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
 
 ok($count == 1);
 
 #
 # make sure the attrib_type table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM attrib_type " .
-   "WHERE code = 'test_code2'")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM attrib_type " . "WHERE code = 'test_code2'")->[0]->[0];
 ok($count == 1);
 
 #
@@ -150,58 +129,45 @@ ok($count == 1);
 @attribs = @{$aa->fetch_all_by_Slice($slice)};
 ok(@attribs == 1);
 
-@attribs = @{$aa->fetch_all_by_Slice($slice,"rubbish")};
+@attribs = @{$aa->fetch_all_by_Slice($slice, "rubbish")};
 ok(@attribs == 0);
 
-@attribs = @{$aa->fetch_all_by_Slice($slice,"test_code2")};
+@attribs = @{$aa->fetch_all_by_Slice($slice, "test_code2")};
 ok(@attribs == 1);
 
-@attribs = @{$aa->fetch_all_by_Slice(undef,"test_code2")};
+@attribs = @{$aa->fetch_all_by_Slice(undef, "test_code2")};
 ok(@attribs == 1);
 
-
 $attrib = $attribs[0];
 
-ok($attrib->name eq 'test_name2');
-ok($attrib->code eq 'test_code2');
+ok($attrib->name        eq 'test_name2');
+ok($attrib->code        eq 'test_code2');
 ok($attrib->description eq 'test_desc2');
-ok($attrib->value eq 'test_value2');
-
+ok($attrib->value       eq 'test_value2');
 
 #
 # test the removal of this attribute with atrrib code
 #
-$aa->remove_from_Slice($slice,"junk");
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM seq_region_attrib " .
-   "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
+$aa->remove_from_Slice($slice, "junk");
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM seq_region_attrib " . "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
 
 ok($count == 1);
 
-
-
-
 #
 # test the removal of this attribute
 #
 
-$aa->remove_from_Slice($slice,"test_code2");
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM seq_region_attrib " .
-   "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
+$aa->remove_from_Slice($slice, "test_code2");
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM seq_region_attrib " . "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
 
 ok($count == 0);
 
-
-
 #
 # make sure the attribute is no longer retrievable
 #
 @attribs = @{$aa->fetch_all_by_Slice($slice)};
 ok(@attribs == 0);
 
-
-
 #
 # try to add an attribute with an already existing code
 #
@@ -209,18 +175,14 @@ $aa->store_on_Slice($slice, [$attrib]);
 #
 # make sure the seq_region_attrib table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM seq_region_attrib " .
-   "WHERE seq_region_id = ".$slice->get_seq_region_id())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM seq_region_attrib " . "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
 
 ok($count == 1);
 
 #
 # make sure the attrib_type table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM attrib_type " .
-   "WHERE code = 'test_code2'")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM attrib_type " . "WHERE code = 'test_code2'")->[0]->[0];
 ok($count == 1);
 
 @attribs = @{$aa->fetch_all_by_Slice($slice)};
@@ -230,15 +192,11 @@ ok(@attribs == 1);
 @attribs = @{$aa->fetch_all_by_Slice(undef)};
 ok(@attribs == 1);
 
-
-
 #
 # test the removal of this attribute
 #
 $aa->remove_from_Slice($slice);
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM seq_region_attrib " .
-   "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM seq_region_attrib " . "WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
 
 ok($count == 0);
 
@@ -255,17 +213,14 @@ ok($count == 0);
   cmp_ok($new_rows, '>', $current_rows, 'Asserting the storage of undefined attributes will always store them');
 }
 
-
 #################
 # Gene functionality tests
 #
 
-
-$attrib = Bio::EnsEMBL::Attribute->new(-NAME => 'test_name2',
-                                       -CODE => 'test_code2',
-                                       -DESCRIPTION => 'test_desc2',
-                                       -VALUE => 'test_value2');
-
+$attrib = Bio::EnsEMBL::Attribute->new(-NAME        => 'test_name2',
+									   -CODE        => 'test_code2',
+									   -DESCRIPTION => 'test_desc2',
+									   -VALUE       => 'test_value2');
 
 my $gene = $ga->fetch_by_stable_id('ENSG00000171456');
 
@@ -274,18 +229,14 @@ $aa->store_on_Gene($gene, [$attrib]);
 #
 # make sure the seq_region_attrib table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM gene_attrib " .
-   "WHERE gene_id = ".$gene->dbID())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM gene_attrib " . "WHERE gene_id = " . $gene->dbID())->[0]->[0];
 
 ok($count == 1);
 
 #
 # make sure the attrib_type table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM attrib_type " .
-   "WHERE code = 'test_code2'")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM attrib_type " . "WHERE code = 'test_code2'")->[0]->[0];
 ok($count == 1);
 
 #
@@ -294,58 +245,45 @@ ok($count == 1);
 @attribs = @{$aa->fetch_all_by_Gene($gene)};
 ok(@attribs == 1);
 
-@attribs = @{$aa->fetch_all_by_Gene($gene,"rubbish")};
+@attribs = @{$aa->fetch_all_by_Gene($gene, "rubbish")};
 ok(@attribs == 0);
 
-@attribs = @{$aa->fetch_all_by_Gene($gene,"test_code2")};
+@attribs = @{$aa->fetch_all_by_Gene($gene, "test_code2")};
 ok(@attribs == 1);
 
-@attribs = @{$aa->fetch_all_by_Gene(undef,"test_code2")};
+@attribs = @{$aa->fetch_all_by_Gene(undef, "test_code2")};
 ok(@attribs == 1);
 
-
 $attrib = $attribs[0];
 
-ok($attrib->name eq 'test_name2');
-ok($attrib->code eq 'test_code2');
+ok($attrib->name        eq 'test_name2');
+ok($attrib->code        eq 'test_code2');
 ok($attrib->description eq 'test_desc2');
-ok($attrib->value eq 'test_value2');
-
+ok($attrib->value       eq 'test_value2');
 
 #
 # test the removal of this attribute with atrrib code
 #
-$aa->remove_from_Gene($gene,"junk");
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM gene_attrib " .
-   "WHERE gene_id = " . $gene->dbID())->[0]->[0];
+$aa->remove_from_Gene($gene, "junk");
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM gene_attrib " . "WHERE gene_id = " . $gene->dbID())->[0]->[0];
 
 ok($count == 1);
 
-
-
-
 #
 # test the removal of this attribute
 #
 
-$aa->remove_from_Gene($gene,"test_code2");
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM gene_attrib " .
-   "WHERE gene_id = " . $gene->dbID())->[0]->[0];
+$aa->remove_from_Gene($gene, "test_code2");
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM gene_attrib " . "WHERE gene_id = " . $gene->dbID())->[0]->[0];
 
 ok($count == 0);
 
-
-
 #
 # make sure the attribute is no longer retrievable
 #
 @attribs = @{$aa->fetch_all_by_Gene($gene)};
 ok(@attribs == 0);
 
-
-
 #
 # try to add an attribute with an already existing code
 #
@@ -353,18 +291,14 @@ $aa->store_on_Gene($gene, [$attrib]);
 #
 # make sure the seq_region_attrib table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM gene_attrib " .
-   "WHERE gene_id = ".$gene->dbID())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM gene_attrib " . "WHERE gene_id = " . $gene->dbID())->[0]->[0];
 
 ok($count == 1);
 
 #
 # make sure the attrib_type table was updated
 #
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM attrib_type " .
-   "WHERE code = 'test_code2'")->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM attrib_type " . "WHERE code = 'test_code2'")->[0]->[0];
 ok($count == 1);
 
 @attribs = @{$aa->fetch_all_by_Gene($gene)};
@@ -374,15 +308,11 @@ ok(@attribs == 1);
 @attribs = @{$aa->fetch_all_by_Gene(undef)};
 ok(@attribs == 1);
 
-
-
 #
 # test the removal of this attribute
 #
 $aa->remove_from_Gene($gene);
-$count = $db->dbc->db_handle->selectall_arrayref
-  ("SELECT count(*) FROM gene_attrib " .
-   "WHERE gene_id = " . $gene->dbID())->[0]->[0];
+$count = $db->dbc->db_handle->selectall_arrayref("SELECT count(*) FROM gene_attrib " . "WHERE gene_id = " . $gene->dbID())->[0]->[0];
 
 ok($count == 0);
 
@@ -399,8 +329,6 @@ ok($count == 0);
   cmp_ok($new_rows, '>', $current_rows, 'Asserting the storage of undefined attributes will always store them');
 }
 
-
-
 $multi->restore('core', 'misc_attrib', 'seq_region_attrib', 'attrib_type');
 
 done_testing();
-- 
GitLab