diff --git a/modules/Bio/EnsEMBL/Exon.pm b/modules/Bio/EnsEMBL/Exon.pm index 425a1d683e932340e2e119491f71593441719183..b1a2e309df3f784d32ac570102240ea367284dcb 100755 --- a/modules/Bio/EnsEMBL/Exon.pm +++ b/modules/Bio/EnsEMBL/Exon.pm @@ -848,8 +848,8 @@ sub slice { sub equals { my ( $self, $exon ) = @_; + if ( !defined($exon) ) { return 0 } if ( $self eq $exon ) { return 1 } - if ( ! defined $exon ) { return 0 } assert_ref( $exon, 'Bio::EnsEMBL::Exon' ); @@ -862,15 +862,16 @@ sub equals { { if ( $self->stable_id() eq $exon->stable_id() ) { return 1; - } else { + } + else { return 0; } } - if ( $self->start() == $exon->start() - && $self->end() == $exon->end() - && $self->strand() == $exon->strand() - && $self->phase() == $exon->phase() ) + if ( $self->start() == $exon->start() && + $self->end() == $exon->end() && + $self->strand() == $exon->strand() && + $self->phase() == $exon->phase() ) { return 1; } diff --git a/modules/Bio/EnsEMBL/Feature.pm b/modules/Bio/EnsEMBL/Feature.pm index d78ef198423e6f0b078d9e7103ad2a1c780a0e09..c5c30a477c3fe7f8ac97972a067a7c24507bb384 100644 --- a/modules/Bio/EnsEMBL/Feature.pm +++ b/modules/Bio/EnsEMBL/Feature.pm @@ -438,12 +438,8 @@ sub equals { my ( $self, $feature ) = @_; # If the features are the same object, they are equal. - if ( $self eq $feature ) { - return 1; - } - if ( ! defined $feature ) { - return 0; - } + if ( !defined($feature) ) { return 0 } + if ( $self eq $feature ) { return 1 } assert_ref( $feature, 'Bio::EnsEMBL::Feature' ); @@ -454,12 +450,10 @@ sub equals { # If the features has the same dbID, they are equal. if ( defined( $self->dbID() ) && defined( $feature->dbID() ) ) { - if ( $self->dbID() == $feature->dbID() ) { - return 1; - } else { - return 0; - } + if ( $self->dbID() == $feature->dbID() ) { return 1 } + else { return 0 } } + # We now know that one of the features do not have a dbID. # If the features have the same start, end, strand and seq_region_id, @@ -468,19 +462,18 @@ sub equals { ( defined( $self->analysis() ) && defined( $feature->analysis() ) ) && ( defined( $self->slice() ) && defined( $feature->slice() ) ) ) { - if ( ( $self->start() == $feature->start() ) - && ( $self->end() == $feature->end() ) - && ( $self->strand() == $feature->strand() ) - && ( $self->slice()->get_seq_region_id() == - $feature->slice()->get_seq_region_id() ) - && ( $self->analysis()->dbID() == $feature->analysis()->dbID() ) - ) + if ( ( $self->start() == $feature->start() ) && + ( $self->end() == $feature->end() ) && + ( $self->strand() == $feature->strand() ) && + ( $self->slice()->get_seq_region_id() == + $feature->slice()->get_seq_region_id() ) && + ( $self->analysis()->dbID() == $feature->analysis()->dbID() ) ) { return 1; - } else { - return 0; } + else { return 0 } } + # We now know that one of the features does not have either analysis # or slice. diff --git a/modules/Bio/EnsEMBL/Gene.pm b/modules/Bio/EnsEMBL/Gene.pm index 9a1f6c8dada3f90989d73116869d6bc29d33ac4c..722699032ccfd5b2cbd708655004cd0553cb9a67 100755 --- a/modules/Bio/EnsEMBL/Gene.pm +++ b/modules/Bio/EnsEMBL/Gene.pm @@ -389,8 +389,8 @@ sub description { sub equals { my ( $self, $gene ) = @_; + if ( !defined($gene) ) { return 0 } if ( $self eq $gene ) { return 1 } - if ( ! defined $gene ) { return 0 } assert_ref( $gene, 'Bio::EnsEMBL::Gene' ); @@ -405,20 +405,17 @@ sub equals { if ( defined( $self->stable_id() ) && defined( $gene->stable_id() ) ) { - if ( $self->stable_id() eq $gene->stable_id() ) { - return 1; - } else { - return 0; - } + if ( $self->stable_id() eq $gene->stable_id() ) { return 1 } + else { return 0 } } my @self_transcripts = sort { - $a->start() <=> $b->start() - || $a->length() <=> $b->length() + $a->start() <=> $b->start() || + $a->length() <=> $b->length() } @{ $self->get_all_Transcripts() }; my @gene_transcripts = sort { - $a->start() <=> $b->start() - || $a->length() <=> $b->length() + $a->start() <=> $b->start() || + $a->length() <=> $b->length() } @{ $gene->get_all_Transcripts() }; if ( scalar(@self_transcripts) != scalar(@gene_transcripts) ) { diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index 2f395532de92139a4f113f750e84a0e5ab8a2441..2613bc3f2da771fd9011e4db63ce2e5266b1ed81 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -2091,7 +2091,7 @@ sub swap_exons { sub equals { my ( $self, $transcript ) = @_; - if ( ! defined $transcript ) { return 0 } + if ( !defined($transcript) ) { return 0 } if ( $self eq $transcript ) { return 1 } assert_ref( $transcript, 'Bio::EnsEMBL::Transcript' ); @@ -2105,23 +2105,24 @@ sub equals { return 0; } - if ( defined( $self->stable_id() ) - && defined( $transcript->stable_id() ) ) + if ( defined( $self->stable_id() ) && + defined( $transcript->stable_id() ) ) { if ( $self->stable_id() eq $transcript->stable_id() ) { return 1; - } else { + } + else { return 0; } } my @self_exons = sort { - $a->start() <=> $b->start() - || $a->length() <=> $b->length() + $a->start() <=> $b->start() || + $a->length() <=> $b->length() } @{ $self->get_all_Exons() }; my @transcript_exons = sort { - $a->start() <=> $b->start() - || $a->length() <=> $b->length() + $a->start() <=> $b->start() || + $a->length() <=> $b->length() } @{ $transcript->get_all_Exons() }; if ( scalar(@self_exons) != scalar(@transcript_exons) ) {