Archive Ensembl HomeArchive Ensembl Home
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor Class Reference
Inheritance diagram for Bio::EnsEMBL::DBSQL::CoordSystemAdaptor:

List of all members.


Class Summary

Synopsis

  use Bio::EnsEMBL::Registry;

  Bio::EnsEMBL::Registry-\>load_registry_from_db(
    -host =\> 'ensembldb.ensembl.org',
    -user =\> 'anonymous'
  );

  $csa = Bio::EnsEMBL::Registry-\>get_adaptor( "human", "core",
    "coordsystem" );

  #
  # Get all coord systems in the database:
  #
  foreach my $cs ( @{ $csa-\>fetch_all() } ) {
    print $cs-\>name, ' ', $cs-\>version, "\n";
  }

  #
  # Fetching by name:
  #

  # use the default version of coord_system 'chromosome' (e.g. NCBI33):
  $cs = $csa-\>fetch_by_name('chromosome');

  # get an explicit version of coord_system 'chromosome':
  $cs = $csa-\>fetch_by_name( 'chromsome', 'NCBI34' );

  # get all coord_systems of name 'chromosome':
  foreach $cs ( @{ $csa-\>fetch_all_by_name('chromosome') } ) {
    print $cs-\>name, ' ', $cs-\>version, "\n";
  }

  #
  # Fetching by rank:
  #
  $cs = $csa-\>fetch_by_rank(2);

  #
  # Fetching the pseudo coord system 'toplevel'
  #

  # Get the default top_level coord system:
  $cs = $csa-\>fetch_top_level();

  # can also use an alias in fetch_by_name:
  $cs = $csa-\>fetch_by_name('toplevel');

  # can also request toplevel using rank=0
  $cs = $csa-\>fetch_by_rank(0);

  #
  # Fetching by sequence level:
  #

  # Get the coord system which is used to store sequence:
  $cs = $csa-\>fetch_sequence_level();

  # can also use an alias in fetch_by_name:
  $cs = $csa-\>fetch_by_name('seqlevel');

  #
  # Fetching by id
  #
  $cs = $csa-\>fetch_by_dbID(1);

Description

This adaptor allows the querying of information from the coordinate
system adaptor.
Note that many coordinate systems do not have a concept of a version
for the entire coordinate system (though they may have a per-sequence
version).  The 'chromosome' coordinate system usually has a version
(i.e. the assembly version) but the clonal coordinate system does not
(despite having individual sequence versions).  In the case where a
coordinate system does not have a version an empty string ('') is used
instead.
 

Definition at line 91 of file CoordSystemAdaptor.pm.

Available Methods

protected _cache_mapping_paths ()
protected _cache_seq_region_mapping ()
protected _columns ()
protected _default_where_clause ()
protected _fetch_all_by_attrib ()
protected _fetch_by_attrib ()
protected _final_clause ()
protected _left_join ()
protected _list_dbIDs ()
protected _objs_from_sth ()
protected _straight_join ()
protected _tables ()
public Listref bind_param_generic_fetch ()
public
Bio::EnsEMBL::DBSQL::DBAdaptor 
db ()
public
Bio::EnsEMBL::DBSQL::DBConnection 
dbc ()
public dump_data ()
public Listref fetch_all ()
public Reference fetch_all_by_attrib ()
public Listref fetch_all_by_dbID_list ()
public Listref fetch_all_by_name ()
public Bio::EnsEMBL::CoordSystem fetch_by_attrib ()
public Bio::EnsEMBL::CoordSystem fetch_by_dbID ()
public Bio::EnsEMBL::CoordSystem fetch_by_name ()
public Bio::EnsEMBL::CoordSystem fetch_by_rank ()
public Bio::EnsEMBL::CoordSystem fetch_sequence_level ()
public A fetch_top_level ()
public Listref generic_fetch ()
public get_dumped_data ()
public Reference get_mapping_path ()
public Boolean is_multispecies ()
public Scalar last_insert_id ()
public
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor 
new ()
public DBI::StatementHandle prepare ()
public Int species_id ()
public void store ()
public Reference store_mapping_path ()

Method Documentation

protected Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_cache_mapping_paths ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_cache_seq_region_mapping ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_default_where_clause ( ) [inherited]
protected Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_fetch_all_by_attrib ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_fetch_by_attrib ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_final_clause ( ) [inherited]

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::DBSQL::ExonAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, and Bio::EnsEMBL::DBSQL::PredictionExonAdaptor.

protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_list_dbIDs ( ) [inherited]

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_straight_join ( ) [inherited]

Undocumented method

Code:
click to view
public Listref Bio::EnsEMBL::DBSQL::BaseAdaptor::bind_param_generic_fetch ( ) [inherited]
 Arg [1]   : (optional)  scalar $param
              This is the parameter to bind
 Arg [2]   : (optional) int $sql_type
              Type of the parameter (from DBI (:sql_types))
 Example   :  $adaptor->bind_param_generic_fetch($stable_id,SQL_VARCHAR);
              $adaptor->generic_fetch();
 Description:  When using parameters for the query, will call the bind_param to avoid
               some security issues. If there are no arguments, will return the bind_parameters
 ReturnType : listref
 Exceptions:  if called with one argument
 
Code:
click to view
public Bio::EnsEMBL::DBSQL::DBAdaptor Bio::EnsEMBL::DBSQL::BaseAdaptor::db ( ) [inherited]
  Arg [1]    : (optional) Bio::EnsEMBL::DBSQL::DBAdaptor $obj 
               the database this adaptor is using.
  Example    : $db = $adaptor->db();
  Description: Getter/Setter for the DatabaseConnection that this adaptor is 
               using.
  Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
  Exceptions : none
  Caller     : Adaptors inherited from BaseAdaptor
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::DBSQL::DBConnection Bio::EnsEMBL::DBSQL::BaseAdaptor::dbc ( ) [inherited]
  Arg [1]    : (optional) Bio::EnsEMBL::DBSQL::DBConnection $obj 
               the database this adaptor is using.
  Example    : $db = $adaptor->db();
  Description: Getter/Setter for the DatabaseConnection that this adaptor is 
               using.
  Returntype : Bio::EnsEMBL::DBSQL::DBConnection
  Exceptions : none
  Caller     : Adaptors inherited from BaseAdaptor
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::DBSQL::BaseAdaptor::dump_data ( ) [inherited]

Undocumented method

Code:
click to view
public Listref Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all ( )
  Arg [1]    : none
  Example    : foreach my $cs (@{$csa->fetch_all()}) {
                 print $cs->name(), ' ', $cs->version(), "\\n";
               }
  Description: Retrieves every coordinate system defined in the DB.
               These will be returned in ascending order of rank. I.e.
               The highest coordinate system with rank=1 would be first in the
               array.
  Returntype : listref of Bio::EnsEMBL::CoordSystems
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view

Reimplemented from Bio::EnsEMBL::DBSQL::BaseAdaptor.

public Reference Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_attrib ( )
  Arg [1]    : string attrib
  Example    : $csa->fetch_all_by_attrib('default_version');
  Description: Retrieves all CoordSystem object from the database that have the specified
               attrib.
  Returntype : reference to a list of Bio::EnsEMBL::CoordSystem objects
  Exceptions : throw when attrib not present
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Listref Bio::EnsEMBL::DBSQL::BaseAdaptor::fetch_all_by_dbID_list ( ) [inherited]
  Arg [1]    : listref of integers $id_list
               The unique database identifiers for the features to
               be obtained.
  Arg [2]    : optional - Bio::EnsEMBL::Slice to map features onto.
  Example    : @feats = @{$adaptor->fetch_all_by_dbID_list([1234, 2131, 982]))};
  Description: Returns the features created from the database
               defined by the the IDs in contained in the provided
               ID list $id_list.  The features will be returned
               in their native coordinate system.  That is, the
               coordinate system in which they are stored in the
               database.  In order to convert the features to a
               particular coordinate system use the transfer() or
               transform() method.  If none of the features are
               found in the database a reference to an empty list is
               returned.
  Returntype : listref of Bio::EnsEMBL::Features
  Exceptions : thrown if $id arg is not provided
               does not exist
  Caller     : general
  Status     : Stable
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::DBSQL::OntologyTermAdaptor.

public Listref Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_name ( )
  Arg [1]    : string $name
               The name of the coordinate system to retrieve.  This can be
               the name of an actual coordinate system or an alias for a
               coordinate system.  Valid aliases are 'toplevel' and 'seqlevel'.
  Example    : foreach my $cs (@{$csa->fetch_all_by_name('chromosome')}){
                 print $cs->name(), ' ', $cs->version();
               }
  Description: Retrieves all coordinate systems of a particular name
  Returntype : listref of Bio::EnsEMBL::CoordSystem objects
  Exceptions : throw if no name argument provided
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_attrib ( )
  Arg [1]    : string attrib
  Arg [2]    : (optional) string version
  Example    : $csa->fetch_by_attrib('default_version','NCBIM37');
  Description: Retrieves a CoordSystem object from the database that have the specified
               attrib and version, if no version is specified, returns the default version
  Returntype : Bio::EnsEMBL::CoordSystem object
  Exceptions : throw when attrib not present
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_dbID ( )
  Arg [1]    : int dbID
  Example    : $cs = $csa->fetch_by_dbID(4);
  Description: Retrieves a coord_system via its internal
               identifier, or undef if no coordinate system with the provided
               id exists.
  Returntype : Bio::EnsEMBL::CoordSystem or undef
  Exceptions : thrown if no coord_system exists for specified dbID
  Caller     : general
  Status     : Stable
 
Code:
click to view

Reimplemented from Bio::EnsEMBL::DBSQL::BaseAdaptor.

public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_name ( )
  Arg [1]    : string $name
               The name of the coordinate system to retrieve.  Alternatively
               this may be an alias for a real coordinate system.  Valid
               aliases are 'toplevel' and 'seqlevel'.
  Arg [2]    : string $version (optional)
               The version of the coordinate system to retrieve.  If not
               specified the default version will be used.
  Example    : $coord_sys = $csa->fetch_by_name('clone');
               $coord_sys = $csa->fetch_by_name('chromosome', 'NCBI33');
               # toplevel is an pseudo coord system representing the highest
               # coord system in a given region
               # such as the chromosome coordinate system
               $coord_sys = $csa->fetch_by_name('toplevel');
               #seqlevel is an alias for the sequence level coordinate system
               #such as the clone or contig coordinate system
               $coord_sys = $csa->fetch_by_name('seqlevel');
  Description: Retrieves a coordinate system by its name
  Returntype : Bio::EnsEMBL::CoordSystem
  Exceptions : throw if no name argument provided
               warning if no version provided and default does not exist
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_rank ( )
  Arg [1]    : int $rank
  Example    : my $cs = $coord_sys_adaptor->fetch_by_rank(1);
  Description: Retrieves a CoordinateSystem via its rank. 0 is a special
               rank reserved for the pseudo coordinate system 'toplevel'.
               undef is returned if no coordinate system of the specified rank
               exists.
  Returntype : Bio::EnsEMBL::CoordSystem
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_sequence_level ( )
  Arg [1]    : none
  Example    : ($id, $name, $version) = $csa->fetch_sequence_level();
  Description: Retrieves the coordinate system at which sequence
               is stored at.
  Returntype : Bio::EnsEMBL::CoordSystem
  Exceptions : throw if no sequence_level coord system exists at all
               throw if multiple sequence_level coord systems exists
  Caller     : general
  Status     : Stable
 
Code:
click to view
public A Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_top_level ( )
  Arg [1]    : none
  Example    : $cs = $csa->fetch_top_level();
  Description: Retrieves the toplevel pseudo coordinate system.
  Returntype : a Bio::EnsEMBL::CoordSystem object
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Listref Bio::EnsEMBL::DBSQL::BaseAdaptor::generic_fetch ( ) [inherited]
  Arg [1]    : (optional) string $constraint
               An SQL query constraint (i.e. part of the WHERE clause)
  Arg [2]    : (optional) Bio::EnsEMBL::AssemblyMapper $mapper
               A mapper object used to remap features
               as they are retrieved from the database
  Arg [3]    : (optional) Bio::EnsEMBL::Slice $slice
               A slice that features should be remapped to
  Example    : $fts = $a->generic_fetch('contig_id in (1234, 1235)', 'Swall');
  Description: Performs a database fetch and returns feature objects in
               contig coordinates.
  Returntype : listref of Bio::EnsEMBL::SeqFeature in contig coordinates
  Exceptions : none
  Caller     : BaseFeatureAdaptor, ProxyDnaAlignFeatureAdaptor::generic_fetch
  Status     : Stable
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::DBSQL::DataFileAdaptor.

public Bio::EnsEMBL::DBSQL::BaseAdaptor::get_dumped_data ( ) [inherited]

Undocumented method

Code:
click to view
public Reference Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_mapping_path ( )
  Arg [1]    : Bio::EnsEMBL::CoordSystem $cs1
  Arg [2]    : Bio::EnsEMBL::CoordSystem $cs2
  Example    : foreach my $cs @{$csa->get_mapping_path($cs1,$cs2);
  Description: Given two coordinate systems this will return a mapping path
               between them if one has been defined.  Allowed Mapping paths are
               explicitly defined in the meta table.  The following is an
               example:
          mysql> select * from meta where meta_key = 'assembly.mapping';
          +---------+------------------+--------------------------------------+
          | meta_id | meta_key         | meta_value                           |
          +---------+------------------+--------------------------------------+
          |      20 | assembly.mapping | chromosome:NCBI34|contig             |
          |      21 | assembly.mapping | clone|contig                         |
          |      22 | assembly.mapping | supercontig|contig                   |
          |      23 | assembly.mapping | chromosome:NCBI34|contig|clone       |
          |      24 | assembly.mapping | chromosome:NCBI34|contig|supercontig |
          |      25 | assembly.mapping | supercontig|contig|clone             |
          +---------+------------------+--------------------------------------+
               For a one-step mapping path to be valid there needs to be
               a relationship between the two coordinate systems defined in
               the assembly table.  Two step mapping paths work by building
               on the one-step mapping paths which are already defined.
               The first coordinate system in a one step mapping path must
               be the assembled coordinate system and the second must be
               the component.
               Example of use:
               my $cs1 = $cs_adaptor->fetch_by_name('contig');
               my $cs2 = $cs_adaptor->fetch_by_name('chromosome');
               my @path = @{$cs_adaptor->get_mapping_path($cs1,$cs2)};
               if(!@path) {
                 print "No mapping path.";
               }
               elsif(@path == 2) {
                 print "2 step mapping path.";
                 print "Assembled = " . $path[0]->name() . "\\n";
                 print "Component = " . $path[1]->name() . "\\n";
               } else {
                 print "Multi step mapping path\\n";
               }
  Returntype : reference to a list of Bio::EnsEMBL::CoordSystem objects
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Boolean Bio::EnsEMBL::DBSQL::BaseAdaptor::is_multispecies ( ) [inherited]
  Arg [1]    : (optional) boolean $arg
  Example    : if ($adaptor->is_multispecies()) { }
  Description: Getter/Setter for the is_multispecies boolean of
               to use for this adaptor.
  Returntype : boolean
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view
public Scalar Bio::EnsEMBL::DBSQL::BaseAdaptor::last_insert_id ( ) [inherited]
  Arg [1]     : (optional) $field the name of the field the inserted ID was pushed 
                into
  Arg [2]     : (optional) HashRef used to pass extra attributes through to the 
                DBD driver
  Description : Delegating method which uses DBI to extract the last inserted 
                identifier. If using MySQL we just call the DBI method 
                DBI::last_insert_id() since MySQL ignores any extra
                arguments. See DBI for more information about this 
                delegated method. 
  Example     : my $id = $self->last_insert_id('my_id'); my $other_id = $self->last_insert_id();
  Returntype  : Scalar or undef
 
Code:
click to view
public Bio::EnsEMBL::DBSQL::CoordSystemAdaptor Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::new ( )
  Arg [1]    : See BaseAdaptor for arguments (none specific to this
               subclass)
  Example    : $cs = $db->get_CoordSystemAdaptor(); #better than new()
  Description: Creates a new CoordSystem adaptor and caches the contents
               of the coord_system table in memory.
  Returntype : Bio::EnsEMBL::DBSQL::CoordSystemAdaptor
  Exceptions : none
  Caller     :
  Status     : Stable
 
Code:
click to view

Reimplemented from Bio::EnsEMBL::DBSQL::BaseAdaptor.

public DBI::StatementHandle Bio::EnsEMBL::DBSQL::BaseAdaptor::prepare ( ) [inherited]
  Arg [1]    : string $string
               a SQL query to be prepared by this adaptors database
  Example    : $sth = $adaptor->prepare("select yadda from blabla")
  Description: provides a DBI statement handle from the adaptor. A convenience
               function so you dont have to write $adaptor->db->prepare all the
               time
  Returntype : DBI::StatementHandle
  Exceptions : none
  Caller     : Adaptors inherited from BaseAdaptor
  Status     : Stable
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::DBSQL::SliceAdaptor, and Bio::EnsEMBL::External::BlastAdaptor.

public Int Bio::EnsEMBL::DBSQL::BaseAdaptor::species_id ( ) [inherited]
  Arg [1]    : (optional) int $species_id
               The internal ID of the species in a multi-species database.
  Example    : $db = $adaptor->db();
  Description: Getter/Setter for the internal ID of the species in a
               multi-species database.  The default species ID is 1.
  Returntype : Integer
  Exceptions : none
  Caller     : Adaptors inherited from BaseAdaptor
  Status     : Stable
 
Code:
click to view
public void Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store ( )
  Arg [1]    : Bio::EnsEMBL::CoordSystem
  Example    : $csa->store($coord_system);
  Description: Stores a CoordSystem object in the database.
  Returntype : none
  Exceptions : Warning if CoordSystem is already stored in this database.
  Caller     : none
  Status     : Stable
 
Code:
click to view
public Reference Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store_mapping_path ( )
  Arg [1]    : Bio::EnsEMBL::CoordSystem $cs1
  Arg [2]    : Bio::EnsEMBL::CoordSystem $cs2
  Arg [3..n] : Bio::EnsEMBL::CoordSystems $cs3..$csN
  Example    : my $pathref = $csa->store_mapping_path($cs1,$cs2);
  Description: Given two or more coordinate systems this will store 
               mapping paths between them in the database.
               The 'rank' attrib of the CoordSystems is used to
               determine the assembled/component relationships between
               them.
               For example, if $cs1 represents chrs of version
               V1, $cs2 represents contigs, and $cs3 clones then, unless
               they already exist, the following entries will be created 
               in the meta table;
               +------------------+---------------------+ 
               | meta_key         | meta_value          |
               +------------------+---------------------+ 
               | assembly.mapping | chr:V1|clone        |
               | assembly.mapping | clone|contig        |
               | assembly.mapping | chr:V1|clone|contig |
               +------------------+---------------------+
               For a one-step mapping path to be valid there needs to be
               a relationship between the two coordinate systems defined in
               the assembly table.  Two step mapping paths work by building
               on the one-step mapping paths which are already defined.
               The first coordinate system in a one step mapping path must
               be the assembled coordinate system and the second must be
               the component.
  Returntype : reference to a list of lists of new meta_value mapping strings
               created for assembly.mapping
  Exceptions : CoordSystems with no rank/duplicated rank
  Caller     : general
  Status     : Experimental
 
Code:
click to view

The documentation for this class was generated from the following file: