Bio::EnsEMBL::ExternalData::DAS
Source
Toolbar
Summary
Bio::EnsEMBL::ExternalData::DAS::Source
Package variables
No package variables defined.
Included modules
Synopsis
Description
An object representation of a DAS source.
Methods
Methods description
Arg [1] : Optional value to set (arrayref) Description: Get/Setter for the Ensembl coordinate systems supported by the source Returntype : arrayref of Bio::EnsEMBL::ExternalData::DAS::CoordSystem objects Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the source description Returntype : scalar Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the DSN Returntype : scalar Exceptions : If the DSN is missing Status : Stable |
Arg [1] : Bio::EnsEMBL::ExternalData::DAS::Source The source to compare to for equality. Example : if($source1->equals($source2)) { ... } Description: Compares 2 DAS sources and returns true if they are equivalent. The definition of equivalent is sharing the same full URL and coordinate systems. Returntype : 0 or 1 Exceptions : none Caller : general Status : Stable |
Args : none Description: Getter for the source URL (including DSN) Returntype : scalar Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the source homepage URL Returntype : scalar Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the source label Returntype : scalar Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the logic name Returntype : scalar Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the source maintainer email address Returntype : scalar Status : Stable |
Arg [1] : Whole or part name string Description: Determines whether the Source name matches a name filter. Matches the dsn and label against a regex. Returntype : 1 or 0 Status : Stable |
Arg [1] : Species string Description: Determines whether the Source supports a species with at least one of its coordinate systems. Returntype : 1 or 0 Status : Stable |
Arg [..] : List of named arguments: -URL - The URL (excluding source name) for the source. -DSN - The source name. -COORDS - (optional) The coordinate systems supported by the source. This is an arrayref of Bio::EnsEMBL::ExternalData::DAS::CoordSystem objects. -LOGIC_NAME - (optional) The logic name of the source. -LABEL - (optional) The display name of the source. -DESCRIPTION - (optional) The description of the source. -HOMEPAGE - (optional) A URL link to a page with more information about the source. -MAINTAINER - (optional) A contact email address for the source. Example : $src = Bio::EnsEMBL::ExternalData::DAS::Source->new( -DSN => 'astd_exon_human_36', -URL => 'http://www.ebi.ac.uk/das-srv/genomicdas/das', -COORDS => [ $cs1, $cs2 ], -LABEL => 'ASTD transcripts', -DESCRIPTION => 'Transcripts from the ASTD database...', -HOMEPAGE => 'http://www.ebi.ac.uk/astd', -MAINTAINER => 'andy.jenkinson@ebi.ac.uk', ); Description: Creates a new Source object representing a DAS source. Returntype : Bio::EnsEMBL::ExternalData::DAS::Source Exceptions : If the URL or DSN are missing or incorrect Caller : general Status : Stable |
Arg [1] : Optional value to set Description: Get/Setter for the server URL (excluding DSN) Returntype : scalar Exceptions : If the URL is missing or of an incorrect format Status : Stable |
Methods code
sub coord_systems
{ my $self = shift;
if ( @_ ) {
$self->{coords} = shift;
}
return $self->{coords} || []; } |
sub description
{ my $self = shift;
if ( @_ ) {
$self->{description} = shift;
}
return $self->{description} || $self->label; } |
sub dsn
{ my $self = shift;
if ( @_ ) {
my $dsn = shift || throw("No DSN specified");
$self->{dsn} = $dsn;
}
return $self->{dsn}; } |
sub equals
{ my ( $this, $that ) = @_;
if ($this->full_url eq $that->full_url) {
my @this_cs = sort { $a->to_string cmp $b->to_string } @{ $this->coord_systems };
my @that_cs = sort { $a->to_string cmp $b->to_string } @{ $that->coord_systems };
if ( scalar @this_cs != scalar @that_cs ) {
return 0;
}
while (my $this_cs = shift @this_cs ) {
my $that_cs = shift @that_cs;
( $this_cs && $that_cs && $this_cs->equals( $that_cs ) ) || return 0;
}
return 1;
}
return 0;
}
1; } |
sub full_url
{ my $self = shift;
return $self->url . q(/). $self->dsn; } |
sub homepage
{ my $self = shift;
if ( @_ ) {
$self->{homepage} = shift;
}
return $self->{homepage}; } |
sub label
{ my $self = shift;
if ( @_ ) {
$self->{label} = shift;
}
return $self->{label} || $self->dsn; } |
sub logic_name
{ my $self = shift;
if ( @_ ) {
$self->{logic_name} = shift;
}
return $self->{logic_name} || $self->dsn; } |
sub maintainer
{ my $self = shift;
if ( @_ ) {
$self->{maintainer} = shift;
}
return $self->{maintainer}; } |
sub matches_name
{ my ($self, $name) = @_;
return (join '', $self->dsn, $self->label) =~ m/$name/ ? 1 : 0;
} |
sub matches_species
{ my ($self, $species) = @_;
if (grep { $_->matches_species( $species ) } @{ $self->coord_systems || [] }) {
return 1;
}
return 0; } |
sub new
{ my $class = shift;
my $self = {};
bless $self, $class;
my ($name, $label, $url, $dsn, $coords, $desc, $homepage, $maintainer) =
rearrange(['LOGIC_NAME', 'LABEL', 'URL', 'DSN', 'COORDS', 'DESCRIPTION', 'HOMEPAGE', 'MAINTAINER'], @_);
$self->url ( $url ); $self->dsn ( $dsn ); $self->logic_name ( $name );
$self->label ( $label );
$self->description ( $desc );
$self->maintainer ( $maintainer );
$self->homepage ( $homepage );
$self->coord_systems ( $coords );
return $self; } |
sub url
{ my $self = shift;
if ( @_ ) {
$_[0] || throw("No URL specified");
my ($url) = $_[0] =~ m{(.+/das)1?/*$};
$url || throw("URL is not of correct format: $_[0]");
$self->{url} = $url;
}
return $self->{url}; } |
General documentation