Commit 2a8e4146 authored by Ian Longden's avatar Ian Longden
Browse files

create LRGSlice when needed

parent 57d73b5a
...@@ -98,7 +98,7 @@ use strict; ...@@ -98,7 +98,7 @@ use strict;
use Bio::EnsEMBL::DBSQL::BaseAdaptor; use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::Slice; use Bio::EnsEMBL::Slice;
use Bio::EnsEMBL::Mapper; use Bio::EnsEMBL::Mapper;
use Bio::EnsEMBL::LRGSlice;
use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning stack_trace_dump); use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning stack_trace_dump);
...@@ -119,6 +119,13 @@ sub new { ...@@ -119,6 +119,13 @@ sub new {
$self->{'sr_name_cache'} = $seq_region_cache->{'name_cache'}; $self->{'sr_name_cache'} = $seq_region_cache->{'name_cache'};
$self->{'sr_id_cache'} = $seq_region_cache->{'id_cache'}; $self->{'sr_id_cache'} = $seq_region_cache->{'id_cache'};
$self->{'lrg_region_test'} = undef;
my $meta_container = $self->db->get_MetaContainer();
my @values = $meta_container->list_value_by_key("LRG");
if(defined(@values) and scalar(@values) and $values[0]->[0]){
$self->{'lrg_region_test'} = $values[0]->[0];
}
return $self; return $self;
} }
...@@ -388,15 +395,27 @@ sub fetch_by_region { ...@@ -388,15 +395,27 @@ sub fetch_by_region {
) ); ) );
} }
return if(defined($self->{'lrg_region_test'}) and substr($cs->name,0,3) eq $self->{'lrg_region_test'}){
Bio::EnsEMBL::Slice->new_fast({ return
'coord_system' => $cs, Bio::EnsEMBL::LRGSlice->new( -COORD_SYSTEM => $cs,
'seq_region_name' => $seq_region_name, -SEQ_REGION_NAME => $seq_region_name,
'seq_region_length' => $length, -SEQ_REGION_LENGTH => $length,
'start' => $start, -START => $start,
'end' => $end, -END => $end,
'strand' => $strand, -STRAND => $strand,
'adaptor' => $self} ); -ADAPTOR => $self );
}
else{
return
Bio::EnsEMBL::Slice->new_fast({
'coord_system' => $cs,
'seq_region_name' => $seq_region_name,
'seq_region_length' => $length,
'start' => $start,
'end' => $end,
'strand' => $strand,
'adaptor' => $self} );
}
} ## end sub fetch_by_region } ## end sub fetch_by_region
...@@ -1054,7 +1073,7 @@ sub fetch_by_Feature{ ...@@ -1054,7 +1073,7 @@ sub fetch_by_Feature{
} }
my $slice = $feature->slice(); my $slice = $feature->slice();
if(!$slice || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!$slice || (!$slice->isa('Bio::EnsEMBL::Slice') && !$slice->isa('Bio::EnsEMBL::LRGSlice') )) {
throw('Feature must be attached to a valid slice.'); throw('Feature must be attached to a valid slice.');
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment