From edacc15e1065484113c48ff59391b646f7ef6d4d Mon Sep 17 00:00:00 2001 From: Graham McVicker <mcvicker@sanger.ac.uk> Date: Fri, 16 Jan 2004 12:05:27 +0000 Subject: [PATCH] reduced number of function calls in add_map_coordinates, probably a little bit faster now in some situations --- modules/Bio/EnsEMBL/Mapper.pm | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/modules/Bio/EnsEMBL/Mapper.pm b/modules/Bio/EnsEMBL/Mapper.pm index 6e451553c2..cea829dba5 100644 --- a/modules/Bio/EnsEMBL/Mapper.pm +++ b/modules/Bio/EnsEMBL/Mapper.pm @@ -371,7 +371,7 @@ sub fastmap { sub add_map_coordinates{ my ($self, $contig_id, $contig_start, $contig_end, $contig_ori, $chr_name, $chr_start, $chr_end) = @_; - + unless(defined($contig_id) && defined($contig_start) && defined($contig_end) && defined($contig_ori) && defined($chr_name) && defined($chr_start) && defined($chr_end)) { @@ -382,30 +382,20 @@ sub add_map_coordinates{ throw("Cannot deal with mis-lengthed mappings so far"); } - my $pair = Bio::EnsEMBL::Mapper::Pair->new(); - - my $from = Bio::EnsEMBL::Mapper::Unit->new(); - $from->start($contig_start); - $from->end($contig_end); - $from->id($contig_id); - - my $to = Bio::EnsEMBL::Mapper::Unit->new(); - $to->start($chr_start); - $to->end($chr_end); - $to->id($chr_name); - - $pair->to($to); - $pair->from($from); + my $from = + Bio::EnsEMBL::Mapper::Unit->new($contig_id, $contig_start, $contig_end); + my $to = + Bio::EnsEMBL::Mapper::Unit->new($chr_name, $chr_start, $chr_end); - $pair->ori($contig_ori); + my $pair = Bio::EnsEMBL::Mapper::Pair->new($from, $to, $contig_ori); # place into hash on both ids my $map_to = $self->{'to'}; my $map_from = $self->{'from'}; - + push( @{$self->{"_pair_$map_to"}->{uc($chr_name)}}, $pair ); push( @{$self->{"_pair_$map_from"}->{uc($contig_id)}}, $pair ); - + $self->{'pair_count'}++; $self->{'_is_sorted'} = 0; -- GitLab