diff --git a/modules/Bio/EnsEMBL/Exon.pm b/modules/Bio/EnsEMBL/Exon.pm index fb9cbad7b96d6e7fb4088ae2020643aa895875f1..b24ecbad79f6f19a12c4388d6ad3c9dbfcbacd9d 100755 --- a/modules/Bio/EnsEMBL/Exon.pm +++ b/modules/Bio/EnsEMBL/Exon.pm @@ -1550,12 +1550,13 @@ sub adjust_start_end { my $new_exon = Bio::EnsEMBL::Exon->new(); %{$new_exon} = %{$self}; + if( $self->strand() == 1 ) { $new_exon->start( $self->start() + $start_adjust ); $new_exon->end( $self->end() + $end_adjust ) } else { - $new_exon->start( $self->end() - $start_adjust ); - $new_exon->end( $self->start() - $end_adjust ) + $new_exon->start( $self->start() - $end_adjust ); + $new_exon->end( $self->end() - $start_adjust ) } return $new_exon; diff --git a/modules/Bio/EnsEMBL/Protein.pm b/modules/Bio/EnsEMBL/Protein.pm index 3c4ab8d9a5e462cd4e9f628666eeec5fd5c40c66..07e2d64ed127f14caecbaeb2252b67d0b642ad2e 100644 --- a/modules/Bio/EnsEMBL/Protein.pm +++ b/modules/Bio/EnsEMBL/Protein.pm @@ -51,7 +51,9 @@ package Bio::EnsEMBL::Protein; use vars qw(@ISA); use strict; -use Bio::Root::Object; + +use Bio::EnsEMBL::Root; + use Bio::SeqI; use Bio::EnsEMBL::Transcript; use Bio::DBLinkContainerI; @@ -60,34 +62,13 @@ use Bio::Tools::SeqStats; # Object preamble - inheriets from Bio::Root::Object -@ISA = qw(Bio::PrimarySeq Bio::SeqI); +@ISA = qw( Bio::PrimarySeq Bio::SeqI); =head2 SeqI interface features =cut - -#=head2 add_date - -# Title : add_date -# Usage : $self->add_date($ref) -# Function: adds a date -# Example : -# Returns : -# Args : - -#=cut - -#sub add_date { -# my ($self) = shift; -# foreach my $dt ( @_ ) { -# push(@{$self->{'date'}},$dt); -# } -#} - - - =head2 adaptor Title : adaptor @@ -109,31 +90,6 @@ sub adaptor { } -#=head2 get_dates - -# Title : get_dates -# Usage : foreach $dt ( $self->get_dates() ) -# Function: gets an array of dates -# Example : -# Returns : -# Args : - -#=cut - -#sub get_dates { -# my ($self) = @_; - -# $self->warn("In giving back dates, have not sorted out how stable id system works with proteins"); - -# return (); -# return @{$self->{'date'}}; -#} - - -#sub each_date { -# my ($self) = @_; -# return $self->get_dates; -#} =head2 species @@ -441,7 +397,7 @@ sub get_all_ProfileFeatures{ } } - return $self->{'_profile'}; + return ( $self->{'_profile'} || [] ); } =head2 add_Profile @@ -494,7 +450,7 @@ sub get_all_blastpFeatures{ } } - return $self->{'_blastp'}; + return ( $self->{'_blastp'} || [] ); } =head2 add_blastp @@ -543,7 +499,7 @@ sub get_all_PrintsFeatures{ $self->add_Prints($in); } } - return $self->{'_prints'}; + return ( $self->{'_prints'} || [] ); } =head2 add_Prints @@ -594,7 +550,7 @@ sub get_all_PfamFeatures{ $self->add_Pfam($in); } } - return $self->{'_pfam'}; + return ( $self->{'_pfam'} || [] ); } =head2 add_Pfam @@ -643,7 +599,7 @@ sub get_all_PrositeFeatures{ $self->add_Prosite($in); } } - return $self->{'_prosite'}; + return ( $self->{'_prosite'} || [] ); } =head2 add_Prosite @@ -692,7 +648,7 @@ sub get_all_SigpFeatures{ $self->add_Sigp($in); } } - return $self->{'_sigp'}; + return ( $self->{'_sigp'} || [] ); } =head2 add_Sigp @@ -743,7 +699,7 @@ sub get_all_TransmembraneFeatures{ } } - return $self->{'_transmembrane'}; + return ( $self->{'_transmembrane'} || [] ); } @@ -794,7 +750,7 @@ sub get_all_CoilsFeatures{ $self->add_Coils($in); } } - return $self->{'_coils'}; + return ( $self->{'_coils'} || [] ); } =head2 add_Coils @@ -841,7 +797,7 @@ sub get_all_LowcomplFeatures{ $self->add_Lowcompl($in); } } - return $self->{'_lowcompl'}; + return ( $self->{'_lowcompl'} || [] ); } =head2 add_LowCompl @@ -891,7 +847,7 @@ sub get_all_SuperfamilyFeatures{ $self->add_Superfamily($in); } } - return $self->{'_superfamily'}; + return ( $self->{'_superfamily'} || [] ); } =head2 add_Superfamily @@ -917,129 +873,6 @@ sub add_Superfamily{ } -#=head2 add_intron - -# Title : add_intron -# Usage : -# Function: -# Example : -# Returns : -# Args : - - -#=cut - -#sub add_intron{ -# my ($self,$value) = @_; -# if ((!defined $value) || (!$value->isa('Bio::EnsEMBL::ProteinFeature'))) { -# $self->throw("The Protein Feature added is not defined or is not a protein feature object"); -# } -# push(@{$self->{'_intron'}},$value); - -#} - - -#=head2 get_all_IntronFeatures - -# Title : get_all_IntronFeatures -# Usage :my @introns_feature = $protein->get_all_IntronFeatures($proteinid) -# Function:Get all of the introns as ProteinFeatures for a given peptide and add them to protein features -# Example : -# Returns : Nothing -# Args :Peptide ID - - -#=cut - -#sub get_all_IntronFeatures{ -# my ($self) = @_; -# if (defined ($self->{'_intron'})) { -# return @{$self->{'_intron'}}; -# } -# else { -# my $proteinid = $self->id(); -# my $pa = $self->adaptor()->db()->get_ProteinAdaptor(); -# my @array_introns = $pa->get_Introns($proteinid); -# foreach my $in (@array_introns) { -# $self->add_intron($in); -# } -# return @array_introns; -# } -#} - -#=head2 add_snps - -# Title : add_snps -# Usage : -# Function: -# Example : -# Returns : -# Args : - - -#=cut - -#sub add_snps{ -# my ($self,$value) = @_; - -# if ((!defined $value)) { -# $self->throw("Value is not defined"); -# } - -# push(@{$self->{'_snp'}},$value); -#} - - -#=head2 get_all_SnpsFeatures - -# Title : get_all_SnpsFeatures -# Usage : -# Function: -# Example : -# Returns : -# Args : - - -#=cut - -#sub get_all_SnpsFeatures{ -# my ($self) = @_; -# if (defined ($self->{'_snp'})) { -# return @{$self->{'_snp'}}; -# } -# else { -# my $gbdb = $self->gbrowser_adaptor(); -# my $snpdb = $self->snp_adaptor(); -# my @snps_array = $self->adaptor->get_snps($self,$snpdb,$gbdb); -# foreach my $sn (@snps_array) { -# $self->add_snps($sn); -# } -# return @snps_array; -# } - -#} - - - -#Title : add_ProteinFeature (formerly add_Protein_feature) -# Usage : -# Function: -# Example : -# Returns : -# Args : - - -#=cut - -#sub add_ProteinFeature{ -# my ($self,$value) = @_; - -# if ((!defined $value) || (!$value->isa('Bio::EnsEMBL::ProteinFeature'))) { -# $self->throw("[$value] is not a protein feature object"); -# } - -# push(@{$self->{'_prot_feat'}},$value); -# } =head2 length @@ -1093,81 +926,6 @@ sub get_all_DBLinks{ return $self->{'_dblinks'}; } -#=head2 molecular_weight - -# Title : molecular_weight -# Usage : -# Function: This method has been placed here for convenience function. This gets and return the molecular weight of the protein -# Example : my $mw = $protein->molecular_weight -# Returns : Moleculat weight of the peptide -# Args : - -#=cut - -#sub molecular_weight{ -# my ($self) = @_; -# my $mw = ${Bio::Tools::SeqStats->get_mol_wt($self)}[0]; -# return $mw; -#} - -#=head2 checksum - -# Title : checksum -# Usage : my $checksum = $protein->checksum() -# Function: Get the crc64 for the sequence of the protein (this method has been copied from _crc64 method which is in swiss.pm in Bioperl and have been placed here for convenience function -# Example : -# Returns : CRC64 -# Args : Nothing - - -#=cut - -#sub checksum{ -# my ($self) = @_; - -# my $sequence = \$self->seq(); - -# my $POLY64REVh = 0xd8000000; -# my @CRCTableh = 256; -# my @CRCTablel = 256; -# my $initialized; - - -# my $seq = $$sequence; - -# my $crcl = 0; -# my $crch = 0; -# if (!$initialized) { -# $initialized = 1; -# for (my $i=0; $i<256; $i++) { -# my $partl = $i; -# my $parth = 0; -# for (my $j=0; $j<8; $j++) { -# my $rflag = $partl & 1; -# $partl >>= 1; -# $partl |= (1 << 31) if $parth & 1; -# $parth >>= 1; -# $parth ^= $POLY64REVh if $rflag; -# } -# $CRCTableh[$i] = $parth; -# $CRCTablel[$i] = $partl; -# } -# } - -# foreach (split '', $seq) { -# my $shr = ($crch & 0xFF) << 24; -# my $temp1h = $crch >> 8; -# my $temp1l = ($crcl >> 8) | $shr; -# my $tableindex = ($crcl ^ (unpack "C", $_)) & 0xFF; -# $crch = $temp1h ^ $CRCTableh[$tableindex]; -# $crcl = $temp1l ^ $CRCTablel[$tableindex]; -# } -# my $crc64 = sprintf("%08X%08X", $crch, $crcl); - -# return $crc64; - -#} - diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index 2389cecc6bcb352f5cd09ec668033f7946940530..89bcdb4761efbc5a25b17366b5afbd3c9fd721d0 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -722,30 +722,21 @@ sub get_all_translateable_Exons { my( @translateable ); foreach my $ex (@{$self->get_all_Exons}) { - my $ex_id = $ex->dbID; if ($ex ne $start_exon and ! @translateable) { next; # Not yet in translated region } - my $start = $ex->start; - my $end = $ex->end; + my $length = $ex->length; - my $strand = $ex->strand; - - my $trunc_start = $start; - my $trunc_end = $end; + my $adjust_start = 0; + my $adjust_end = 0; # Adjust to translation start if this is the start exon if ($ex == $start_exon ) { if ($t_start < 1 or $t_start > $length) { $self->throw("Translation start '$t_start' is outside exon $ex length=$length"); } - if ($strand == 1) { - $trunc_start = $start + $t_start - 1; - } - else { - $trunc_end = $end - $t_start + 1; - } + $adjust_start = $t_start - 1; } # Adjust to translation end if this is the end exon @@ -753,22 +744,15 @@ sub get_all_translateable_Exons { if ($t_end < 1 or $t_end > $length) { $self->throw("Translation end '$t_end' is outside exon $ex length=$length"); } - if ($strand == 1) { - $trunc_end = $end - $length + $t_end; - } - else { - $trunc_start = $start + $length - $t_end; - } + $adjust_end = $t_end - $length; } - + # Make a truncated exon if the translation start or # end causes the coordinates to be altered. - if ($trunc_start != $start or $trunc_end != $end) { - my ( $adjust_start, $adjust_end ); - $adjust_start = $trunc_start - $start; - $adjust_end = $trunc_end - $end; + if ($adjust_end || $adjust_start) { + my $newex = $ex->adjust_start_end( $adjust_start, $adjust_end ); - push( @translateable, $ex->adjust_start_end( $adjust_start, $adjust_end )); + push( @translateable, $newex ); } else { push(@translateable, $ex); } diff --git a/modules/runtests.pl b/modules/runtests.pl index 25da55a6190295c1c687ab76c5f74f3826bb871e..10726266926b7ab2e0a98c1495fe46d95633b125 100755 --- a/modules/runtests.pl +++ b/modules/runtests.pl @@ -26,6 +26,8 @@ if($opt_l) { } #run all of the specified tests +$ENV{'RUNTEST_ACTIVE'} = 1; + runtests(@{&get_all_tests('.', \@ARGV)}); diff --git a/modules/t/MultiTestDB.conf b/modules/t/MultiTestDB.conf index 14bc2b5043013302ffd9488ffdf4c562e4c36755..6db4f8f8b71d966607b895c99d444bef1bdf82ff 100644 --- a/modules/t/MultiTestDB.conf +++ b/modules/t/MultiTestDB.conf @@ -4,7 +4,7 @@ 'user' => 'ensadmin', 'pass' => 'ensembl', 'host' => 'ecs1c', - 'zip' => 'multidb.zip', + 'zip' => 'test_genome.zip', #add a line with the dbname and module 'databases' => { 'core' => 'Bio::EnsEMBL::DBSQL::DBAdaptor',