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

create LRGSlice when needed

parent 57d73b5a
......@@ -98,7 +98,7 @@ use strict;
use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::Slice;
use Bio::EnsEMBL::Mapper;
use Bio::EnsEMBL::LRGSlice;
use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning stack_trace_dump);
......@@ -119,6 +119,13 @@ sub new {
$self->{'sr_name_cache'} = $seq_region_cache->{'name_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;
}
......@@ -388,6 +395,17 @@ sub fetch_by_region {
) );
}
if(defined($self->{'lrg_region_test'}) and substr($cs->name,0,3) eq $self->{'lrg_region_test'}){
return
Bio::EnsEMBL::LRGSlice->new( -COORD_SYSTEM => $cs,
-SEQ_REGION_NAME => $seq_region_name,
-SEQ_REGION_LENGTH => $length,
-START => $start,
-END => $end,
-STRAND => $strand,
-ADAPTOR => $self );
}
else{
return
Bio::EnsEMBL::Slice->new_fast({
'coord_system' => $cs,
......@@ -397,6 +415,7 @@ sub fetch_by_region {
'end' => $end,
'strand' => $strand,
'adaptor' => $self} );
}
} ## end sub fetch_by_region
......@@ -1054,7 +1073,7 @@ sub fetch_by_Feature{
}
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.');
}
......
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