diff --git a/modules/Bio/EnsEMBL/Slice.pm b/modules/Bio/EnsEMBL/Slice.pm index 8659500266ccb06ae4536e79bb3d4b7270a08ef3..7d7695c4375feb9a66472d60c861a08ec8a5c1e8 100644 --- a/modules/Bio/EnsEMBL/Slice.pm +++ b/modules/Bio/EnsEMBL/Slice.pm @@ -1525,6 +1525,44 @@ sub get_all_VariationFeatures{ } } +=head2 get_all_StructuralVariationFeatures + + Args : $class [optional] + Description :returns all structural variation features on this slice. This function will only work + correctly if the variation database has been attached to the core database. + If $class is set, only structural variations of that class will be returned. + ReturnType : listref of Bio::EnsEMBL::Variation::StructuralVariationFeature + Exceptions : none + Caller : contigview, snpview + Status : At Risk + +=cut + +sub get_all_StructuralVariationFeatures{ + my $self = shift; + my $sv_class = shift; + + if(!$self->adaptor()) { + warning('Cannot get structural variation features without attached adaptor'); + return []; + } + + my $svf_adaptor = Bio::EnsEMBL::DBSQL::MergedAdaptor->new(-species => $self->adaptor()->db()->species, -type => "StructuralVariationFeature"); + if( $svf_adaptor ) { + if(defined $sv_class) { + return $svf_adaptor->fetch_all_by_Slice_constraint($self, qq{ svf.class = '$sv_class' }); + } + else { + return $svf_adaptor->fetch_all_by_Slice($self); + } + } + else { + warning("Variation database must be attached to core database to " . + "retrieve variation information" ); + return []; + } +} + =head2 get_all_IndividualSlice