Commit 4a9b9a8d authored by Ian Longden's avatar Ian Longden
Browse files

LRGSlice fixes

parent 5bd6ce87
...@@ -366,13 +366,14 @@ sub _remap { ...@@ -366,13 +366,14 @@ sub _remap {
Status: Stable Status: Stable
=cut =cut
use Data::Dumper; # use Data::Dumper;
sub store{ sub store{
my $self = shift; my $self = shift;
my $asx = shift; my $asx = shift;
my $asx2 = shift; my $asx2 = shift;
if (! $asx->isa('Bio::EnsEMBL::AssemblyExceptionFeature')){ if (! $asx->isa('Bio::EnsEMBL::AssemblyExceptionFeature')){
throw("$asx is not a Ensembl assemlby exception -- not stored"); throw("$asx is not a Ensembl assemlby exception -- not stored");
} }
...@@ -389,7 +390,7 @@ sub store{ ...@@ -389,7 +390,7 @@ sub store{
if ($asx->type !~ /PAR|HAP/){ if ($asx->type !~ /PAR|HAP/){
throw("Only types of assembly exception features valid are PAR and HAP"); throw("Only types of assembly exception features valid are PAR and HAP");
} }
if (! $asx->alternate_slice->isa('Bio::EnsEMBL::Slice')){ if ( !($asx->alternate_slice->isa('Bio::EnsEMBL::Slice') or $asx->alternate_slice->isa('Bio::EnsEMBL::LRGSlice')) ){
throw("Alternate slice should be a Bio::EnsEMBL::Slice"); throw("Alternate slice should be a Bio::EnsEMBL::Slice");
} }
#now check the other Assembly exception feature, the one pointing to the REF #now check the other Assembly exception feature, the one pointing to the REF
...@@ -403,8 +404,8 @@ sub store{ ...@@ -403,8 +404,8 @@ sub store{
if ($asx2->type !~ /HAP REF|PAR REF/){ if ($asx2->type !~ /HAP REF|PAR REF/){
throw("$asx2 should have type of assembly exception features HAP REF or PAR REF"); throw("$asx2 should have type of assembly exception features HAP REF or PAR REF");
} }
if (! $asx->alternate_slice->isa('Bio::EnsEMBL::Slice')){ if (! ($asx2->alternate_slice->isa('Bio::EnsEMBL::Slice') or $asx2->alternate_slice->isa('Bio::EnsEMBL::LRGSlice'))){
throw("Alternate slice should be a Bio::EnsEMBL::Slice"); throw("Alternate slice should be a Bio::EnsEMBL::Slice");
} }
#finally check that both features are pointing to each other slice #finally check that both features are pointing to each other slice
if ($asx->slice != $asx2->alternate_slice || $asx->alternate_slice != $asx2->slice){ if ($asx->slice != $asx2->alternate_slice || $asx->alternate_slice != $asx2->slice){
...@@ -487,7 +488,7 @@ sub _pre_store { ...@@ -487,7 +488,7 @@ sub _pre_store {
my $slice_adaptor = $db->get_SliceAdaptor(); my $slice_adaptor = $db->get_SliceAdaptor();
my $slice = $feature->slice(); my $slice = $feature->slice();
if(!ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw('Feature must be attached to Slice to be stored.'); throw('Feature must be attached to Slice to be stored.');
} }
......
...@@ -218,7 +218,7 @@ sub fetch_all_by_Slice_constraint { ...@@ -218,7 +218,7 @@ sub fetch_all_by_Slice_constraint {
my @result = (); my @result = ();
if(!ref($slice) || (!$slice->isa('Bio::EnsEMBL::Slice') && !$slice->isa('Bio::EnsEMBL::LRGSlice'))) { if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw("Bio::EnsEMBL::Slice argument expected."); throw("Bio::EnsEMBL::Slice argument expected.");
} }
...@@ -581,7 +581,7 @@ sub _pre_store { ...@@ -581,7 +581,7 @@ sub _pre_store {
my $slice_adaptor = $db->get_SliceAdaptor(); my $slice_adaptor = $db->get_SliceAdaptor();
my $slice = $feature->slice(); my $slice = $feature->slice();
if(!ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw('Feature must be attached to Slice to be stored.'); throw('Feature must be attached to Slice to be stored.');
} }
...@@ -642,7 +642,7 @@ sub _pre_store_userdata { ...@@ -642,7 +642,7 @@ sub _pre_store_userdata {
my $slice = $feature->slice(); my $slice = $feature->slice();
my $slice_adaptor = $slice->adaptor; my $slice_adaptor = $slice->adaptor;
if(!ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw('Feature must be attached to Slice to be stored.'); throw('Feature must be attached to Slice to be stored.');
} }
...@@ -927,7 +927,7 @@ sub remove { ...@@ -927,7 +927,7 @@ sub remove {
sub remove_by_Slice { sub remove_by_Slice {
my ($self, $slice) = @_; my ($self, $slice) = @_;
if(!$slice || !ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!$slice || !ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("Slice argument is required"); throw("Slice argument is required");
} }
......
...@@ -125,7 +125,7 @@ sub store{ ...@@ -125,7 +125,7 @@ sub store{
} }
my $slice = $feat->slice(); my $slice = $feat->slice();
if(!defined($slice) || !$slice->isa("Bio::EnsEMBL::Slice")) { if(!defined($slice) || !($slice->isa("Bio::EnsEMBL::Slice") or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("A slice must be attached to the features to be stored."); throw("A slice must be attached to the features to be stored.");
} }
......
...@@ -436,7 +436,7 @@ sub store { ...@@ -436,7 +436,7 @@ sub store {
} }
my $slice = $rf->slice(); my $slice = $rf->slice();
if(!ref($slice) || !$slice->isa("Bio::EnsEMBL::Slice")) { if(!ref($slice) || !($slice->isa("Bio::EnsEMBL::Slice") or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw("RepeatFeature cannot be stored without an associated slice."); throw("RepeatFeature cannot be stored without an associated slice.");
} }
......
...@@ -139,7 +139,7 @@ sub new { ...@@ -139,7 +139,7 @@ sub new {
sub fetch_by_Slice_start_end_strand { sub fetch_by_Slice_start_end_strand {
my ( $self, $slice, $start, $end, $strand ) = @_; my ( $self, $slice, $start, $end, $strand ) = @_;
if(!ref($slice) || !$slice->isa("Bio::EnsEMBL::Slice")) { if(!ref($slice) || !($slice->isa("Bio::EnsEMBL::Slice") or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("Slice argument is required."); throw("Slice argument is required.");
} }
......
...@@ -559,7 +559,7 @@ sub get_seq_region_id { ...@@ -559,7 +559,7 @@ sub get_seq_region_id {
my $self = shift; my $self = shift;
my $slice = shift; my $slice = shift;
if(!$slice || !ref($slice) || (!$slice->isa('Bio::EnsEMBL::Slice') && !$slice->isa('Bio::EnsEMBL::LRGSlice'))) { if(!$slice || !ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw('Slice argument is required'); throw('Slice argument is required');
} }
...@@ -1073,7 +1073,7 @@ sub fetch_by_Feature{ ...@@ -1073,7 +1073,7 @@ sub fetch_by_Feature{
} }
my $slice = $feature->slice(); my $slice = $feature->slice();
if(!$slice || (!$slice->isa('Bio::EnsEMBL::Slice') && !$slice->isa('Bio::EnsEMBL::LRGSlice') )) { if(!$slice || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice') )) {
throw('Feature must be attached to a valid slice.'); throw('Feature must be attached to a valid slice.');
} }
...@@ -1361,7 +1361,7 @@ sub store { ...@@ -1361,7 +1361,7 @@ sub store {
# Get all of the sanity checks out of the way before storing anything # Get all of the sanity checks out of the way before storing anything
# #
if(!ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw('Slice argument is required'); throw('Slice argument is required');
} }
...@@ -1467,10 +1467,10 @@ sub store_assembly{ ...@@ -1467,10 +1467,10 @@ sub store_assembly{
# Get all of the sanity checks out of the way before storing anything # Get all of the sanity checks out of the way before storing anything
# #
if(!ref($asm_slice) || !$asm_slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($asm_slice) || !($asm_slice->isa('Bio::EnsEMBL::Slice') or $asm_slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw('Assembled Slice argument is required'); throw('Assembled Slice argument is required');
} }
if(!ref($cmp_slice) || !$cmp_slice->isa('Bio::EnsEMBL::Slice')) { if(!ref($cmp_slice) || !($cmp_slice->isa('Bio::EnsEMBL::Slice') or $cmp_slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw('Assembled Slice argument is required'); throw('Assembled Slice argument is required');
} }
......
...@@ -837,7 +837,9 @@ sub transform { ...@@ -837,7 +837,9 @@ sub transform {
my $self = shift; my $self = shift;
# catch for old style transform calls # catch for old style transform calls
if( !@_ || ( ref $_[0] && $_[0]->isa( "Bio::EnsEMBL::Slice" ))) { if( !@_ || ( ref $_[0] &&
($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" ))
)) {
deprecate('Calling transform without a coord system name is deprecated.'); deprecate('Calling transform without a coord system name is deprecated.');
return $self->_deprecated_transform(@_); return $self->_deprecated_transform(@_);
} }
......
...@@ -302,7 +302,7 @@ sub hslice { ...@@ -302,7 +302,7 @@ sub hslice {
if(@_) { if(@_) {
my $sl = shift; my $sl = shift;
if(defined($sl) && (!ref($sl) || !$sl->isa('Bio::EnsEMBL::Slice'))) { if(defined($sl) && (!ref($sl) || !($sl->isa('Bio::EnsEMBL::Slice') or $sl->isa('Bio::EnsEMBL::Slice')) )) {
throw('slice argument must be a Bio::EnsEMBL::Slice'); throw('slice argument must be a Bio::EnsEMBL::Slice');
} }
......
...@@ -925,7 +925,7 @@ sub transform { ...@@ -925,7 +925,7 @@ sub transform {
my $self = shift; my $self = shift;
# catch for old style transform calls # catch for old style transform calls
if( !@_ || ( ref $_[0] && $_[0]->isa( "Bio::EnsEMBL::Slice" ))) { if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )) )) {
deprecate('Calling transform without a coord system name is deprecated.'); deprecate('Calling transform without a coord system name is deprecated.');
return $self->_deprecated_transform(@_); return $self->_deprecated_transform(@_);
} }
......
...@@ -211,7 +211,7 @@ sub add_Slice_Mapper_pair { ...@@ -211,7 +211,7 @@ sub add_Slice_Mapper_pair {
my $mapper = shift; my $mapper = shift;
# argument check # argument check
unless ($slice and ref($slice) and $slice->isa('Bio::EnsEMBL::Slice')) { unless ($slice and ref($slice) and ($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("You must provide a slice."); throw("You must provide a slice.");
} }
......
...@@ -154,7 +154,7 @@ sub new { ...@@ -154,7 +154,7 @@ sub new {
# argument check # argument check
unless ($ref_slice and ref($ref_slice) and unless ($ref_slice and ref($ref_slice) and
$ref_slice->isa('Bio::EnsEMBL::Slice')) { ($ref_slice->isa('Bio::EnsEMBL::Slice') or $ref_slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("You must provide a reference slice."); throw("You must provide a reference slice.");
} }
...@@ -184,7 +184,7 @@ sub _create_container_slice { ...@@ -184,7 +184,7 @@ sub _create_container_slice {
# argument check # argument check
unless ($ref_slice and ref($ref_slice) and unless ($ref_slice and ref($ref_slice) and
$ref_slice->isa('Bio::EnsEMBL::Slice')) { ($ref_slice->isa('Bio::EnsEMBL::Slice') or $ref_slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("You must provide a reference slice."); throw("You must provide a reference slice.");
} }
...@@ -483,7 +483,7 @@ sub ref_slice { ...@@ -483,7 +483,7 @@ sub ref_slice {
if (@_) { if (@_) {
my $slice = shift; my $slice = shift;
unless (ref($slice) and $slice->isa('Bio::EnsEMBL::Slice')) { unless (ref($slice) and ($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
throw("Need a Bio::EnsEMBL::Slice."); throw("Need a Bio::EnsEMBL::Slice.");
} }
...@@ -517,7 +517,7 @@ sub container_slice { ...@@ -517,7 +517,7 @@ sub container_slice {
if (@_) { if (@_) {
my $slice = shift; my $slice = shift;
unless (ref($slice) and $slice->isa('Bio::EnsEMBL::Slice')) { unless (ref($slice) and ($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice')) ) {
throw("Need a Bio::EnsEMBL::Slice."); throw("Need a Bio::EnsEMBL::Slice.");
} }
......
...@@ -185,7 +185,7 @@ sub transform { ...@@ -185,7 +185,7 @@ sub transform {
my $self = shift; my $self = shift;
# catch for old style transform calls # catch for old style transform calls
if( !@_ || ( ref $_[0] && $_[0]->isa( "Bio::EnsEMBL::Slice" ))) { if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )))) {
throw( "transform needs coordinate systems details now," . throw( "transform needs coordinate systems details now," .
"please use transfer" ); "please use transfer" );
} }
......
...@@ -409,7 +409,7 @@ sub transform { ...@@ -409,7 +409,7 @@ sub transform {
my $self = shift; my $self = shift;
# catch for old style transform calls # catch for old style transform calls
if( ref $_[0] && $_[0]->isa( "Bio::EnsEMBL::Slice" )) { if( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" ))) {
throw("transform needs coordinate systems details now," . throw("transform needs coordinate systems details now," .
"please use transfer"); "please use transfer");
} }
......
...@@ -999,7 +999,7 @@ sub transform { ...@@ -999,7 +999,7 @@ sub transform {
# transform to slice coords from raw contig coords # transform to slice coords from raw contig coords
return $self->_transform_to_Slice($slice); return $self->_transform_to_Slice($slice);
} }
elsif ($self->contig->isa( "Bio::EnsEMBL::Slice" )) { elsif ($self->contig->isa( "Bio::EnsEMBL::Slice" ) or $self->contig->isa( "Bio::EnsEMBL::LRGSlice" )) {
# transform to slice coords from other slice coords # transform to slice coords from other slice coords
return $self->_transform_between_Slices($slice); return $self->_transform_between_Slices($slice);
...@@ -1088,7 +1088,7 @@ sub _transform_between_Slices { ...@@ -1088,7 +1088,7 @@ sub _transform_between_Slices {
my $from_slice = $self->contig; my $from_slice = $self->contig;
$self->throw("New contig [$to_slice] is not a Bio::EnsEMBL::Slice") $self->throw("New contig [$to_slice] is not a Bio::EnsEMBL::Slice")
unless $to_slice->isa("Bio::EnsEMBL::Slice"); unless ($to_slice->isa("Bio::EnsEMBL::Slice") or $to_slice->isa("Bio::EnsEMBL::LRGSlice") );
if ((my $c1 = $from_slice->chr_name) ne (my $c2 = $to_slice->chr_name)) { if ((my $c1 = $from_slice->chr_name) ne (my $c2 = $to_slice->chr_name)) {
$self->warn("Can't transform between chromosomes: $c1 and $c2"); $self->warn("Can't transform between chromosomes: $c1 and $c2");
......
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