Bio::EnsEMBL::ExternalData::DAS Source
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::ExternalData::DAS::Source
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw )
Synopsis
  $src = Bio::EnsEMBL::ExternalData::DAS::Source->new(
-DSN => 'astd_exon_human_36',
-URL => 'http://www.ebi.ac.uk/das-srv/genomicdas/das',
-COORDS => [ 'chromosome:NCBI36, 'uniprot_peptide' ],
#...etc
);
Description
An object representation of a DAS source.
Methods
coord_systemsDescriptionCode
descriptionDescriptionCode
dsnDescriptionCode
equalsDescriptionCode
full_urlDescriptionCode
homepageDescriptionCode
labelDescriptionCode
logic_nameDescriptionCode
maintainerDescriptionCode
matches_nameDescriptionCode
matches_speciesDescriptionCode
newDescriptionCode
urlDescriptionCode
Methods description
coord_systemscode    nextTop
  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
descriptioncodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the source description
Returntype : scalar
Status : Stable
dsncodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the DSN
Returntype : scalar
Exceptions : If the DSN is missing
Status : Stable
equalscodeprevnextTop
  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
full_urlcodeprevnextTop
  Args       : none
Description: Getter for the source URL (including DSN)
Returntype : scalar
Status : Stable
homepagecodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the source homepage URL
Returntype : scalar
Status : Stable
labelcodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the source label
Returntype : scalar
Status : Stable
logic_namecodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the logic name
Returntype : scalar
Status : Stable
maintainercodeprevnextTop
  Arg [1]    : Optional value to set
Description: Get/Setter for the source maintainer email address
Returntype : scalar
Status : Stable
matches_namecodeprevnextTop
  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
matches_speciescodeprevnextTop
  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
newcodeprevnextTop
  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
urlcodeprevnextTop
  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
coord_systemsdescriptionprevnextTop
sub coord_systems {
  my $self = shift;
  if ( @_ ) {
    $self->{coords} = shift;
  }
  return $self->{coords} || [];
}
descriptiondescriptionprevnextTop
sub description {
  my $self = shift;
  if ( @_ ) {
    $self->{description} = shift;
  }
  return $self->{description} || $self->label;
}
dsndescriptionprevnextTop
sub dsn {
  my $self = shift;
  if ( @_ ) {
    my $dsn = shift || throw("No DSN specified");
    $self->{dsn} = $dsn;
  }
  return $self->{dsn};
}
equalsdescriptionprevnextTop
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;
}
full_urldescriptionprevnextTop
sub full_url {
  my $self = shift;
  return $self->url . q(/). $self->dsn;
}
homepagedescriptionprevnextTop
sub homepage {
  my $self = shift;
  if ( @_ ) {
    $self->{homepage} = shift;
  }
  return $self->{homepage};
}
labeldescriptionprevnextTop
sub label {
  my $self = shift;
  if ( @_ ) {
    $self->{label} = shift;
  }
  return $self->{label} || $self->dsn;
}
logic_namedescriptionprevnextTop
sub logic_name {
  my $self = shift;
  if ( @_ ) {
    $self->{logic_name} = shift;
  }
  return $self->{logic_name} || $self->dsn;
}
maintainerdescriptionprevnextTop
sub maintainer {
  my $self = shift;
  if ( @_ ) {
    $self->{maintainer} = shift;
  }
  return $self->{maintainer};
}
matches_namedescriptionprevnextTop
sub matches_name {
  my ($self, $name) = @_;
  return (join '', $self->dsn, $self->label) =~ m/$name/ ? 1 : 0;
}
matches_speciesdescriptionprevnextTop
sub matches_species {
  my ($self, $species) = @_;
  if (grep { $_->matches_species( $species ) } @{ $self->coord_systems || [] }) {
    return 1;
  }
  return 0;
}
newdescriptionprevnextTop
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 ); # Checks and applies some formatting
$self->dsn ( $dsn ); # Checks
$self->logic_name ( $name ); $self->label ( $label ); $self->description ( $desc ); $self->maintainer ( $maintainer ); $self->homepage ( $homepage ); $self->coord_systems ( $coords ); return $self;
}
urldescriptionprevnextTop
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
AUTHORTop
Andy Jenkinson <aj@ebi.ac.uk>