sub equals
{ my $self = shift;
my $cs = shift;
unless ( $cs && ref($cs) &&
( $cs->isa('Bio::EnsEMBL::ExternalData::DAS::CoordSystem') ||
$cs->isa('Bio::EnsEMBL::CoordSystem') ) ) {
throw('Argument must be a CoordSystem');
}
return ( $self->{'version'} eq $cs->version() &&
$self->{'name'} eq $cs->name() &&
$self->matches_species( $cs->species ) ) ? 1 : 0; } |
sub matches_species
{ my ($self, $species) = @_;
if ( !$species || !$self->species || $self->species eq $species ) {
return 1;
}
return 0;
}
1; } |
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my ($name, $version, $species, $label) = rearrange(['NAME','VERSION','SPECIES','LABEL'], @_);
$name || throw('The NAME argument is required');
$version ||= '';
$species ||= '';
if (!$label) {
$label = join ' ', map { ucfirst $_ } grep { $_ } (split /_/, $name), $version;
}
my $self = {
'name' => $name,
'version' => $version,
'species' => $species,
'label' => $label,
};
bless $self, $class;
return $self; } |
sub new_from_hashref
{ my $caller = shift;
my $hash = shift;
my $class = ref($caller) || $caller;
return $class->new( -name => $hash->{'name'},
-version => $hash->{'version'},
-species => $hash->{'species'},
-label => $hash->{'label'}); } |
sub new_from_string
{ my $caller = shift;
my $string = shift;
my $class = ref($caller) || $caller;
my ($name, $version, $species, $label) = split /:/, $string, 4;
return $class->new( -name => $name,
-version => $version,
-species => $species,
-label => $label); } |
sub to_string
{ my $self = shift;
return join ':', $self->name, $self->version, $self->species, $self->label; } |