diff --git a/modules/Bio/EnsEMBL/CircularSlice.pm b/modules/Bio/EnsEMBL/CircularSlice.pm index f458560c7f43f15fa00b417c66d08cfa794f112b..4596ea7296a8159f4a5105f140d9b0db612ea16f 100644 --- a/modules/Bio/EnsEMBL/CircularSlice.pm +++ b/modules/Bio/EnsEMBL/CircularSlice.pm @@ -880,267 +880,6 @@ sub get_all_genotyped_VariationFeatures { } -=head2 get_all_QtlFeatures - - Args : none - Description: returns overlapping QtlFeatures - Returntype : listref Bio::EnsEMBL::Map::QtlFeature - Exceptions : none - Caller : general - Status : Stable - -=cut - -sub get_all_QtlFeatures { - my $self = shift; - - if ( !$self->adaptor() ) { - warning('Cannot get QtlFeatures without attached adaptor'); - return []; - } - - my $qfAdaptor; - if ( $self->adaptor() ) { - $qfAdaptor = $self->adaptor()->db()->get_QtlFeatureAdaptor(); - } else { - return []; - } - - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr, @arr1, @arr2 ); - @arr1 = @{ $qfAdaptor->fetch_all_by_Slice_constraint($sl1) }; - @arr2 = @{ $qfAdaptor->fetch_all_by_Slice_constraint($sl2) }; - push @arr, @arr1, @arr2; - return \@arr; - ## circular EOF - -} ## end sub get_all_QtlFeatures - -=head2 get_all_KaryotypeBands - - Arg [1] : none - Example : @kary_bands = @{$slice->get_all_KaryotypeBands}; - Description: Retrieves the karyotype bands which this slice overlaps. - Returntype : listref oif Bio::EnsEMBL::KaryotypeBands - Exceptions : none - Caller : general, contigview - Status : Stable - -=cut - -sub get_all_KaryotypeBands { - my ($self) = @_; - - if ( !$self->adaptor() ) { - warning('Cannot get KaryotypeBands without attached adaptor'); - return []; - } - - my $kadp = $self->adaptor->db->get_KaryotypeBandAdaptor(); - - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr, @arr1, @arr2 ); - @arr1 = @{ $kadp->fetch_all_by_Slice($sl1) }; - @arr2 = @{ $kadp->fetch_all_by_Slice($sl2) }; - push @arr, @arr1, @arr2; - return \@arr; - ## circular EOF - -} ## end sub get_all_KaryotypeBands - - -=head2 get_all_compara_DnaAlignFeatures - - Arg [1] : string $qy_species - The name of the species to retrieve similarity features from - Arg [2] : string $qy_assembly - The name of the assembly to retrieve similarity features from - Arg [3] : string $type - The type of the alignment to retrieve similarity features from - Arg [4] : <optional> compara dbadptor to use. - Example : $fs = $slc->get_all_compara_DnaAlignFeatures('Mus musculus', - 'MGSC3', - 'WGA'); - Description: Retrieves a list of DNA-DNA Alignments to the species specified - by the $qy_species argument. - The compara database must be attached to the core database - for this call to work correctly. As well the compara database - must have the core dbadaptors for both this species, and the - query species added to function correctly. - Returntype : reference to a list of Bio::EnsEMBL::DnaDnaAlignFeatures - Exceptions : warning if compara database is not available - Caller : contigview - Status : Stable - -=cut - -sub get_all_compara_DnaAlignFeatures { - my ( $self, $qy_species, $qy_assembly, $alignment_type, $compara_db ) - = @_; - - if ( !$self->adaptor() ) { - warning( - "Cannot retrieve DnaAlignFeatures without attached adaptor"); - return []; - } - - unless ( $qy_species && $alignment_type # && $qy_assembly - ) - { - throw( -"Query species and assembly and alignmemt type arguments are required" - ); - } - - if ( !defined($compara_db) ) { - $compara_db = - Bio::EnsEMBL::Registry->get_DBAdaptor( "compara", "compara" ); - } - unless ($compara_db) { - warning( - "Compara database must be attached to core database or passed " - . "as an argument to " - . "retrieve compara information" ); - return []; - } - - my $dafa = $compara_db->get_DnaAlignFeatureAdaptor; - - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr, @arr1, @arr2 ); - @arr1 = @{ - $dafa->fetch_all_by_Slice( $sl1, $qy_species, $qy_assembly, - $alignment_type ) }; - @arr2 = @{ - $dafa->fetch_all_by_Slice( $sl2, $qy_species, $qy_assembly, - $alignment_type ) }; - push @arr, @arr1, @arr2; - return \@arr; - ## circular EOF - -} ## end sub get_all_compara_DnaAlignFeatures - -=head2 get_all_compara_Syntenies - - Arg [1] : string $query_species e.g. "Mus_musculus" or "Mus musculus" - Arg [2] : string $method_link_type, default is "SYNTENY" - Arg [3] : <optional> compara dbadaptor to use. - Description: gets all the compara syntenyies for a specfic species - Returns : arrayref of Bio::EnsEMBL::Compara::SyntenyRegion - Status : Stable - -=cut - -sub get_all_compara_Syntenies { - my ( $self, $qy_species, $method_link_type, $compara_db ) = @_; - - if ( !$self->adaptor() ) { - warning("Cannot retrieve features without attached adaptor"); - return []; - } - - unless ($qy_species) { - throw("Query species and assembly arguments are required"); - } - - unless ( defined $method_link_type ) { - $method_link_type = "SYNTENY"; - } - - if ( !defined($compara_db) ) { - $compara_db = - Bio::EnsEMBL::Registry->get_DBAdaptor( "compara", "compara" ); - } - unless ($compara_db) { - warning( - "Compara database must be attached to core database or passed " - . "as an argument to " - . "retrieve compara information" ); - return []; - } - my $gdba = $compara_db->get_GenomeDBAdaptor(); - my $mlssa = $compara_db->get_MethodLinkSpeciesSetAdaptor(); - my $dfa = $compara_db->get_DnaFragAdaptor(); - my $sra = $compara_db->get_SyntenyRegionAdaptor(); - - my $this_gdb = - $gdba->fetch_by_core_DBAdaptor( $self->adaptor()->db() ); - my $query_gdb = $gdba->fetch_by_registry_name($qy_species); - my $mlss = - $mlssa->fetch_by_method_link_type_GenomeDBs( $method_link_type, - [ $this_gdb, $query_gdb ] ); - - my $cs = $self->coord_system()->name(); - my $sr = $self->seq_region_name(); - my ($dnafrag) = - @{ $dfa->fetch_all_by_GenomeDB_region( $this_gdb, $cs, $sr ) }; - - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr, @arr1, @arr2 ); - @arr1 = @{ - $sra->fetch_all_by_MethodLinkSpeciesSet_DnaFrag( $mlss, $dnafrag, - $sl1->start, $sl1->end ) - }; - @arr2 = @{ - $sra->fetch_all_by_MethodLinkSpeciesSet_DnaFrag( $mlss, $dnafrag, - $sl2->start, $sl2->end ) - }; - push @arr, @arr1, @arr2; - return \@arr; - ## circular EOF - -} ## end sub get_all_compara_Syntenies - -=head2 get_all_Haplotypes - - Arg [1] : (optional) boolean $lite_flag - if true lightweight haplotype objects are used - Example : @haplotypes = $slice->get_all_Haplotypes; - Description: Retrieves all of the haplotypes on this slice. Only works - if the haplotype adaptor has been attached to the core adaptor - via $dba->add_db_adaptor('haplotype', $hdba); - Returntype : listref of Bio::EnsEMBL::External::Haplotype::Haplotypes - Exceptions : warning is Haplotype database is not available - Caller : contigview, general - Status : Stable - -=cut - -sub get_all_Haplotypes { - my ( $self, $lite_flag ) = @_; - - if ( !$self->adaptor() ) { - warning("Cannot retrieve features without attached adaptor"); - return []; - } - - my $haplo_db = $self->adaptor->db->get_db_adaptor('haplotype'); - - unless ($haplo_db) { - warning( "Haplotype database must be attached to core database to " - . "retrieve haplotype information" ); - return []; - } - - my $haplo_adaptor = $haplo_db->get_HaplotypeAdaptor; - - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr, @arr1, @arr2 ); - @arr1 = @{ $haplo_adaptor->fetch_all_by_Slice( $sl1, $lite_flag ) }; - @arr2 = @{ $haplo_adaptor->fetch_all_by_Slice( $sl2, $lite_flag ) }; - push @arr, @arr1, @arr2; - return \@arr; - ## circular EOF - -} ## end sub get_all_Haplotypes - - - =head2 get_all_DASFeatures Arg [1] : none @@ -1173,63 +912,6 @@ sub get_all_DASFeatures { } -# GENERIC FEATURES (See DBAdaptor.pm) - -=head2 get_generic_features - - Arg [1] : (optional) List of names of generic feature types to return. - If no feature names are given, all generic features are - returned. - Example : my %features = %{$slice->get_generic_features()}; - Description: Gets generic features via the generic feature adaptors that - have been added via DBAdaptor->add_GenricFeatureAdaptor (if - any) - Returntype : Hash of named features. - Exceptions : none - Caller : none - Status : Stable - -=cut - -sub get_generic_features { - - my ( $self, @names ) = @_; - - if ( !$self->adaptor() ) { - warning('Cannot retrieve features without attached adaptor'); - return []; - } - - my $db = $self->adaptor()->db(); - - my %features = (); # this will hold the results - - # get the adaptors for each feature - my %adaptors = %{ $db->get_GenericFeatureAdaptors(@names) }; - - foreach my $adaptor_name ( keys(%adaptors) ) { - - my $adaptor_obj = $adaptors{$adaptor_name}; - # get the features and add them to the hash - ## circular BOF - my ($sl1, $sl2) = $self->_split; - my ( @arr1, @arr2 ); - my $features_ref; - @arr1 = @{ $adaptor_obj->fetch_all_by_Slice($sl1) }; - @arr2 = @{ $adaptor_obj->fetch_all_by_Slice($sl2) }; - push @{$features_ref}, @arr1, @arr2; - ## circular EOF - - # add each feature to the hash to be returned - foreach my $feature (@$features_ref) { - $features{$adaptor_name} = $feature; - } - } ## end foreach my $adaptor_name ( ...) - - return \%features; - -} ## end sub get_generic_features - =head2 project_to_slice Arg [1] : Slice to project to.