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

LRGSlice fixes

parent 5bd6ce87
......@@ -366,13 +366,14 @@ sub _remap {
Status: Stable
=cut
use Data::Dumper;
# use Data::Dumper;
sub store{
my $self = shift;
my $asx = shift;
my $asx2 = shift;
if (! $asx->isa('Bio::EnsEMBL::AssemblyExceptionFeature')){
throw("$asx is not a Ensembl assemlby exception -- not stored");
}
......@@ -389,7 +390,7 @@ sub store{
if ($asx->type !~ /PAR|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");
}
#now check the other Assembly exception feature, the one pointing to the REF
......@@ -403,7 +404,7 @@ sub store{
if ($asx2->type !~ /HAP REF|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");
}
#finally check that both features are pointing to each other slice
......@@ -487,7 +488,7 @@ sub _pre_store {
my $slice_adaptor = $db->get_SliceAdaptor();
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.');
}
......
......@@ -218,7 +218,7 @@ sub fetch_all_by_Slice_constraint {
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.");
}
......@@ -581,7 +581,7 @@ sub _pre_store {
my $slice_adaptor = $db->get_SliceAdaptor();
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.');
}
......@@ -642,7 +642,7 @@ sub _pre_store_userdata {
my $slice = $feature->slice();
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.');
}
......@@ -927,7 +927,7 @@ sub remove {
sub remove_by_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");
}
......
......@@ -125,7 +125,7 @@ sub store{
}
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.");
}
......
......@@ -436,7 +436,7 @@ sub store {
}
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.");
}
......
......@@ -139,7 +139,7 @@ sub new {
sub fetch_by_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.");
}
......
......@@ -559,7 +559,7 @@ sub get_seq_region_id {
my $self = 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');
}
......@@ -1073,7 +1073,7 @@ sub fetch_by_Feature{
}
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.');
}
......@@ -1361,7 +1361,7 @@ sub store {
# 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');
}
......@@ -1467,10 +1467,10 @@ sub store_assembly{
# 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');
}
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');
}
......
......@@ -837,7 +837,9 @@ sub transform {
my $self = shift;
# 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.');
return $self->_deprecated_transform(@_);
}
......
......@@ -302,7 +302,7 @@ sub hslice {
if(@_) {
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');
}
......
......@@ -925,7 +925,7 @@ sub transform {
my $self = shift;
# 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.');
return $self->_deprecated_transform(@_);
}
......
......@@ -211,7 +211,7 @@ sub add_Slice_Mapper_pair {
my $mapper = shift;
# 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.");
}
......
......@@ -154,7 +154,7 @@ sub new {
# argument check
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.");
}
......@@ -184,7 +184,7 @@ sub _create_container_slice {
# argument check
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.");
}
......@@ -483,7 +483,7 @@ sub ref_slice {
if (@_) {
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.");
}
......@@ -517,7 +517,7 @@ sub container_slice {
if (@_) {
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.");
}
......
......@@ -185,7 +185,7 @@ sub transform {
my $self = shift;
# 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," .
"please use transfer" );
}
......
......@@ -409,7 +409,7 @@ sub transform {
my $self = shift;
# 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," .
"please use transfer");
}
......
......@@ -999,7 +999,7 @@ sub transform {
# transform to slice coords from raw contig coords
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
return $self->_transform_between_Slices($slice);
......@@ -1088,7 +1088,7 @@ sub _transform_between_Slices {
my $from_slice = $self->contig;
$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)) {
$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