diff --git a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm index d3b0e0d40e3ffdc6de7e09b4e397c9a8ea4749f4..aaf6859f8827d673d2111f321c5581382279e854 100644 --- a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm @@ -194,6 +194,7 @@ sub fetch_by_dbID { return $gene; } + =head2 fetch_by_stable_id Title : fetch_by_stable_id @@ -244,12 +245,13 @@ sub fetch_by_contig_list{ $str =~ s/\,$//g; $str = "($str)"; + # # this is non-optimised, because we are going to make multiple # trips to the database. should fix here # - my $sth = $self->prepare("select distinct(t.gene_id) from transcript t,exon_transcript et,exon e,contig c where c.id in $str and c.internal_id = e.contig and et.exon_id = e.exon_id and et.transcript_id = t.transcript_id"); + my $sth = $self->prepare("select distinct(t.gene_id) from transcript t,exon_transcript et,exon e,contig c where c.id in $str and c.internal_id = e.contig_id and et.exon_id = e.exon_id and et.transcript_id = t.transcript_id"); $sth->execute; my @out; diff --git a/modules/Bio/EnsEMBL/Mapper.pm b/modules/Bio/EnsEMBL/Mapper.pm index d845a9d42f89669ff99a88788b947f7e6f2dddf6..d5940d94f5a7ee8ccc19c0416fb61de9818a3db3 100644 --- a/modules/Bio/EnsEMBL/Mapper.pm +++ b/modules/Bio/EnsEMBL/Mapper.pm @@ -67,11 +67,15 @@ use Bio::EnsEMBL::Mapper::Gap; sub new { my($class,@args) = @_; - my $to = shift @args; my $from = shift @args; + my $to = shift @args; my $self = {}; bless $self,$class; + + if( !defined $to ) { + $self->throw("Must supply from and to tags"); + } $self->{'_pair_hash_to'} = {}; $self->{'_pair_hash_from'} = {}; @@ -239,6 +243,10 @@ sub map_coordinates{ sub add_map_coordinates{ my ($self,$contig_start,$contig_end,$contig_id,$chr_start,$chr_end,$chr_name,$contig_ori) = @_; + if( !defined $contig_ori ) { + $self->throw("Need 7 arguments!"); + } + if( $contig_start !~ /\d+/ || $chr_start !~ /\d+/ ) { $self->throw("Not doable - $contig_start as start or $chr_start as start?"); } diff --git a/modules/t/mapper.t b/modules/t/mapper.t index 5ee3bb02bfd521b3500cdfeb749767b0aa7a93a7..df95e28f62a7d37fea5e26b86d35e5de9f60abba 100644 --- a/modules/t/mapper.t +++ b/modules/t/mapper.t @@ -35,7 +35,7 @@ use Bio::EnsEMBL::Mapper; # testing the Bio::EnsEMBL::Mapper module -$mapper = Bio::EnsEMBL::Mapper->new( "virtualcontig", "rawcontig" ); +$mapper = Bio::EnsEMBL::Mapper->new( "rawcontig", "virtualcontig" ); load_sgp_dump( $mapper ); $mapper->_freeze;