From 5cebf8d439ed8d667a80dc3f2e5f643a5b8525a1 Mon Sep 17 00:00:00 2001 From: William McLaren <wm2@ebi.ac.uk> Date: Mon, 19 Oct 2009 13:14:07 +0000 Subject: [PATCH] Added get_all_StructuralVariationFeatures method --- modules/Bio/EnsEMBL/Slice.pm | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/Bio/EnsEMBL/Slice.pm b/modules/Bio/EnsEMBL/Slice.pm index 8659500266..7d7695c437 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 -- GitLab