Commit 262e9999 authored by Graham McVicker's avatar Graham McVicker
Browse files

removed Chromosome, ChromosomeAdaptor, RawContig, RawContigAdaptor, Clone, CloneAdaptor modules

parent 01772475
# Creator: Arne Stabenau <stabenau@ebi.ac.uk>
# Date of creation: 07.04.2000
# Last modified : 16.02.2003 by James Smith
#
# Copyright EMBL-EBI/WTSI 2000
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::EnsEMBL::Chromosome
=head1 SYNOPSIS
=head1 DESCRIPTION
The chromosome object is deprecated. Use Bio::EnsEMBL::Slice instead.
=head1 CONTACT
Post questions to the EnsEMBL developer mailing list: <ensembl-dev@ebi.ac.uk>
=cut
package Bio::EnsEMBL::Chromosome;
use vars qw(@ISA);
use strict;
use Bio::EnsEMBL::Utils::Exception qw(deprecate);
use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Slice;
@ISA = qw( Bio::EnsEMBL::Slice );
=head2 new
Description: The chromosome class is deprecated. Bio::EnsEMBL::Slice class
should be used instead.
=cut
sub new {
my $caller = shift;
deprecate("The Bio::EnsEMBL::Chromosome class is deprecated." .
"The Bio::EnsEMBL::Slice class should be used instead");
my ($adaptor, $chr_name) = rearrange(['ADAPTOR', 'CHR_NAME'], @_);
if($chr_name) {
if($adaptor) {
my $csa = $adaptor->db->get_CoordSystemAdaptor();
my ($top_cs) = @{$csa->fetch_all()};
my $chr = $adaptor->fetch_by_region($top_cs->name(),$chr_name,
undef,undef,undef,$top_cs->version());
bless $chr, 'Bio::EnsEMBL::Chromosome';
return $chr;
} else {
return $caller->SUPER::new(@_,
-ADAPTOR => $adaptor,
-SEQ_REGION_NAME => $chr_name);
}
}
my $self = $caller->SUPER::new(@_);
if($self->adaptor) {
$self->adaptor($self->adaptor->db->get_ChromosomeAdaptor);
}
return $self;
}
#by name actually mean seq_region_name
sub name {
my $self = shift;
return $self->seq_region_name(@_);
}
=head2 stats
Arg [1] :
Example : $obj->stats()
Description: returns hashref of additional statistics stored in Chromosome table
Returntype : hashref
Exceptions : none
Caller : mapview
=cut
sub stats {
my $self = shift;
return %{$self->{'stats'} || {}};
}
=head2 stat
Arg [1] : Name of attribute to set
Arg [2] : Optional value to set to...
Example : $obj->stat( $value)
Description: get/set for a statistic...
Returntype : number
Exceptions : none
Caller : mapview
=cut
sub stat {
my( $self, $key, $value ) = @_;
$self->{'stats'}{$key} = $value if defined $value;
return $self->{'stats'}{$key};
}
## Deprecated calls - these should now use "stat"
sub xref_genes { return $_[0]->stat('xref_genes'); }
sub known_genes { return $_[0]->stat('known_genes'); }
sub unknown_genes { return $_[0]->stat('unknown_genes'); }
sub snps { return $_[0]->stat('snps'); }
1;
#
# EnsEMBL module for Bio::EnsEMBL::Clone
#
# Cared for by EnsEMBL (www.ensembl.org)
#
# Copyright GRL and EBI
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::EnsEMBL::Clone - DEPRECATED use Bio::EnsEMBL::Slice instead
=head1 DESCRIPTION
DEPRECATED - Create Slices on clone regions instead
=head1 CONTACT
Post questions to the EnsEMBL developer list: <ensembl-dev@ebi.ac.uk>
=cut
package Bio::EnsEMBL::Clone;
use vars qw(@ISA);
use strict;
use Bio::EnsEMBL::Slice;
use Bio::EnsEMBL::RawContig;
use Bio::EnsEMBL::Utils::Exception qw(throw deprecate);
@ISA = qw( Bio::EnsEMBL::Slice );
=head2 new
Description: DEPRECATED. Use Bio::EnsEMBL::Slice instead
=cut
sub new {
my $class = shift;
deprecate("Bio::EnsEMBL::Clone is a deprecated class\n" .
"Use Bio::EnsEMBL::Slice instead");
return $class->SUPER::new(@_);
}
=head2 get_all_Contigs
Description: DEPRECATED. Use Slice::project instead
=cut
sub get_all_Contigs {
my( $self ) = @_;
deprecate('Use Slice::project instead');
# Assume that we actually want to project to sequence level
my $projection = $self->project('seqlevel');
my @out;
foreach my $segment (@$projection) {
my $contig = $segment->[2];
#bless slices into RawContigs for backwards compatibility
bless $contig, "Bio::EnsEMBL::RawContig";
push @out, $contig;
}
return \@out;
}
=head2 add_Contig
Description: DEPRECATED. There is currently no replacement for this method
Possibly one should be added?
=cut
sub add_Contig {
my ($self, $contig) = @_;
### XXX Should there be a replacement for this?
deprecate('There is currently no replacement for this method');
return 0;
}
=head2 delete_by_dbID
Description: DEPRECATED. There is currently no replacement for this method
Possibly there should be one?
=cut
sub delete_by_dbID {
my ($self)=shift;
### XXX Should there be a replacement for this?
deprecate('There is currently no replacement for this method');
return 0;
}
=head2 get_RawContig_by_position
Description: DEPRECATED. Use Slice::project instead
=cut
sub get_RawContig_by_position {
my ($self, $pos) = @_;
deprecate('Use Slice::project instead');
throw("get_rawcontig_by_position error: Position must be > 0") if($pos < 1);
my $projection = $self->project('seqlevel');
foreach my $segment (@$projection) {
my($start,$end,$contig) = @$segment;
if($start <= $pos) {
return bless($contig, 'Bio::EnsEMBL::RawContig');
}
}
return undef;
}
=head2 htg_phase
Description: DEPRECATED - use $slice->get_attribute('htg_phase') instead
=cut
sub htg_phase {
my $self = shift;
my ($htg_phase) = $self->get_attribute('htg_phase');
return $htg_phase;
}
=head2 created
Description: DEPRECATED - Created information no longer stored
=cut
sub created {
my $obj = shift;
if( @_ ) {
my $value = shift;
$obj->{'created'} = $value;
}
return $obj->{'created'};
}
=head2 modified
Description: DEPRECATE - Modified information no longer stored
=cut
sub modified {
my $obj = shift;
if( @_ ) {
my $value = shift;
$obj->{'modified'} = $value;
}
return $obj->{'modified'};
}
=head2 version
Description: DEPRECATED - use Slice::seq_region_name
=cut
sub version{ embl_version(@_) }
=head2 embl_version
Description: DEPRECATED - use Slice::seq_region_name
=cut
sub embl_version {
my $self = shift;
my $acc_ver = $self->seq_region_name();
#strip version off end of accession
my $ver;
(undef, $ver) = split(/\./, $acc_ver);
return $ver;
}
=head2 embl_id
description: DEPRECATED - use Slice::seq_region_name
=cut
sub embl_id {
my $self = shift;
my $acc = $self->seq_region_name();
#strip off version
($acc) = split(/\./, $acc);
return $acc;
}
#what is actually meant by clone->name is seq_region_name not name
sub name {
my $self = shift;
return $self->seq_region_name();
}
=head2 id
Description: DEPRECATED - use Slice::seq_region_name
=cut
sub id { embl_id(@_);}
=head2 dbID
Description: Deprecated. Use SliceAdaptor::get_seq_region_id instead
Exceptions : none
Caller : general, set from adaptor on store
=cut
sub dbID{
my $self = shift;
deprecate('Use Bio::EnsEMBL::Slice instead of Bio::EnsEMBL::RawContig');
return $self->adaptor->get_seq_region_id($self);
}
1;
......@@ -69,7 +69,7 @@ method, sometimes an individual object. For example
or
@fp = @{$simple_feature_adaptor->fetch_all_by_RawContig($contig)};
@fp = @{$simple_feature_adaptor->fetch_all_by_Slice($slice)};
Occassionally adaptors need to provide access to lists of ids. In this case the
......
#
# Ensembl module for Bio::EnsEMBL::DBSQL::ChromosomeAdaptor
#
# Cared for by Ewan Birney <birney@ebi.ac.uk>
#
# Copyright Ewan Birney
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::EnsEMBL::DBSQL::ChromosomeAdaptor - DEPRECATED
use Bio::EnsEMBL::SliceAdator instead
=head1 DESCRIPTION
This class is deprecated. SliceAdaptor should be used instead.
=head1 AUTHOR - Ewan Birney
This modules is part of the Ensembl project http://www.ensembl.org
Email birney@ebi.ac.uk
=cut
package Bio::EnsEMBL::DBSQL::ChromosomeAdaptor;
use vars qw(@ISA);
use strict;
use Bio::EnsEMBL::Utils::Exception qw(deprecate);
use Bio::EnsEMBL::DBSQL::SliceAdaptor;
use Bio::EnsEMBL::Chromosome;
@ISA = qw(Bio::EnsEMBL::DBSQL::SliceAdaptor);
=head2 fetch_by_dbID
Description: DEPRECATED Use SliceAdaptor::fetch_by_seq_region_id instead
=cut
sub fetch_by_dbID {
my ($self,$id) = @_;
deprecate('Use SliceAdaptor::fetch_by_seq_region_id instead.');
my $chr = $self->SUPER::fetch_by_seq_region_id($id);
#change blessing to chromosome and reset adaptor
bless $chr, 'Bio::EnsEMBL::Chromosome';
$chr->adaptor($self);
return $chr;
}
=head2 fetch_by_chr_name
Description: DEPRECATED Use SliceAdaptor::fetch_by_region instead
=cut
sub fetch_by_chr_name{
my ($self,$chr_name) = @_;
deprecate('Use SliceAdaptor::fetch_by_region instead.');
my $top_level = $self->db->get_CoordSystemAdaptor->fetch_top_level();
my $chr = $self->SUPER::fetch_by_region($top_level->name(),
$chr_name,
undef,
undef,
undef,
$top_level->version);
#change blessing and adaptor
bless $chr, 'Bio::EnsEMBL::Chromosome';
$chr->adaptor($self);
return $chr;
}
=head2 fetch_all
Description: DEPRECATED Use SliceAdaptor::fetch_all instead
=cut
sub fetch_all {
my($self) = @_;
deprecate('Use SliceAdaptor::fetch_all instead.');
my $top_level = $self->db->get_CoordSystemAdaptor->fetch_top_level();
my $chrs = $self->SUPER::fetch_all($top_level->name, $top_level->version);
foreach my $chr (@$chrs) {
bless $chr, 'Bio::EnsEMBL::Chromosome';
$chr->adaptor($self);
}
return $chrs;
}
=head2 store
Description: DEPRECATED no replacement exists
=cut
sub store{
### XXX Should there be a replacement for this?
deprecate('No replacement has been implemented.');
}
1;
#
# BioPerl module for DB::Clone
#
# Cared for by EnsEMBL (www.ensembl.org)
#
# Copyright GRL and EBI
#
# You may distribute this module under the same terms as perl itself
=head1 NAME
Bio::EnsEMBL::DBSQL::CloneAdaptor - DEPRECATED use Bio::EnsEMBL::SliceAdaptor
instead
=head1 DESCRIPTION
DEPRECATED - Use Bio::EnsEMBL::DBSQL::SliceAdaptor to create slices on clones
instead
=head1 AUTHOR - Ewan Birney
This modules is part of the Ensembl project http://www.ensembl.org
Email birney@ebi.ac.uk
=cut
package Bio::EnsEMBL::DBSQL::CloneAdaptor;
use vars qw(@ISA);
use strict;
use Bio::EnsEMBL::DBSQL::SliceAdaptor;
use Bio::EnsEMBL::Clone;
use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning );
@ISA = qw(Bio::EnsEMBL::DBSQL::SliceAdaptor);
=head2 new
Description: DEPRECATED. Use Bio::EnsEMBL::DBSQL::SliceAdaptor instead
=cut
sub new {
my $class = shift;
deprecate("Bio::EnsEMBL::DBSQL::CloneAdaptor is a deprecated class\n" .
"Use Bio::EnsEMBL::DBSQL::SliceAdaptor instead");
return $class->SUPER::new(@_);
}
=head2 fetch_by_accession
Description: DEPRECATED. Use SliceAdaptor::fetch_by_region instead
=cut
sub fetch_by_accession {
my ($self,$acc) = @_;
deprecate('Use SliceAdaptor::fetch_by_region instead');
#this unfortunately needs a version on the end to work
if(! ($acc =~ /\./)) {
my $sth = $self->prepare("SELECT sr.name " .
"FROM seq_region sr, coord_system cs " .
"WHERE cs.name = 'clone' " .
"AND cs.coord_system_id = sr.coord_system_id ".
"AND sr.name LIKE '$acc.%'");
$sth->execute();
if(!$sth->rows()) {
$sth->finish();
throw("Clone $acc not found in database");
}
($acc) = $sth->fetchrow_array();
$sth->finish();
}
my $clone = $self->