ensembl-hive  2.7.0
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor Class Reference
+ Inheritance diagram for Bio::EnsEMBL::DBSQL::CoordSystemAdaptor:

Public Member Functions

public Bio::EnsEMBL::DBSQL::CoordSystemAdaptor new ()
 
protected _cache_seq_region_mapping ()
 
protected _cache_mapping_paths ()
 
public Listref fetch_all ()
 
public Bio::EnsEMBL::CoordSystem fetch_by_rank ()
 
public Bio::EnsEMBL::CoordSystem fetch_by_name ()
 
public Listref fetch_all_by_name ()
 
public ArrayRef fetch_all_by_version ()
 
public Bio::EnsEMBL::CoordSystem fetch_by_dbID ()
 
public Bio::EnsEMBL::CoordSystem fetch_top_level ()
 
public Bio::EnsEMBL::CoordSystem fetch_sequence_level ()
 
public String get_default_version ()
 
public Listref get_all_versions ()
 
public Reference get_mapping_path ()
 
public Reference store_mapping_path ()
 
public Reference store_multiple_mapping_path ()
 
public Bio::EnsEMBL::CoordSystem fetch_by_attrib ()
 
public Reference fetch_all_by_attrib ()
 
public void store ()
 
public void remove ()
 
- Public Member Functions inherited from Bio::EnsEMBL::DBSQL::BaseAdaptor
public Bio::EnsEMBL::DBSQL::BaseAdaptor new ()
 
public DBI::StatementHandle prepare ()
 
public Bio::EnsEMBL::DBSQL::DBAdaptor db ()
 
public Bio::EnsEMBL::DBSQL::DBConnection dbc ()
 
public Boolean is_multispecies ()
 
public Int species_id ()
 
protected _list_dbIDs ()
 
protected _straight_join ()
 
protected _can_straight_join ()
 
public Listref bind_param_generic_fetch ()
 
protected _bind_param_generic_fetch ()
 
public String generate_in_constraint ()
 
public Listref generic_fetch ()
 
public Int generic_count ()
 
protected _generate_sql ()
 
public Bio::EnsEMBL::Feature fetch_by_dbID ()
 
protected _uncached_fetch_by_dbID ()
 
public Listref fetch_all_by_dbID_list ()
 
protected _uncached_fetch_all_by_dbID_list ()
 
protected ArrayRef _uncached_fetch_all_by_id_list ()
 
public fetch_all ()
 
public Scalar last_insert_id ()
 
public insert_ignore_clause ()
 
protected Bio::EnsEMBL::DBSQL::Support::BaseCache _id_cache ()
 
protected Boolean _no_id_cache ()
 
public Boolean ignore_cache_override ()
 
public Int schema_version ()
 
protected _tables ()
 
protected _columns ()
 
protected _default_where_clause ()
 
protected _left_join ()
 
protected _final_clause ()
 
protected _objs_from_sth ()
 
protected _build_id_cache ()
 
protected _logic_name_to_constraint ()
 

Detailed Description

Synopsis

-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.

Member Function Documentation

◆ _cache_mapping_paths()

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

Undocumented method

Code:
click to view

◆ _cache_seq_region_mapping()

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

Undocumented method

Code:
click to view

◆ fetch_all()

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

◆ fetch_all_by_attrib()

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

◆ fetch_all_by_name()

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

◆ fetch_all_by_version()

public ArrayRef Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_version ( )
  Arg [1]    : string $version
               The version of the coordinate systems to retrieve.
  Example    :
foreach my $cs (@{$csa->fetch_all_by_version('GRCh37')}){
print $cs->name(), ' ', $cs->version();
}
  Description: Retrieves all coordinate systems of a particular version
  Returntype : ArrayRef of Bio::EnsEMBL::CoordSystem objects
  Exceptions : throw if no name argument provided
  Caller     : general
  Status     : Stable
 
Code:
click to view

◆ fetch_by_attrib()

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

◆ fetch_by_dbID()

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

◆ fetch_by_name()

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');
@section autotoc_md4 toplevel is an pseudo coord system representing the highest
@section autotoc_md5 coord system in a given region
@section autotoc_md6 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

◆ fetch_by_rank()

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

◆ fetch_sequence_level()

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

◆ fetch_top_level()

public Bio::EnsEMBL::CoordSystem Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_top_level ( )
  Arg [1]    : none
  Example    :
$cs = $csa->fetch_top_level();
  Description: Retrieves the toplevel pseudo coordinate system.
  Returntype : Bio::EnsEMBL::CoordSystem object
  Exceptions : none
  Caller     : general
  Status     : Stable
 
Code:
click to view

◆ get_all_versions()

public Listref Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_all_versions ( )
  Arg [1]    : none
  Example    :
@versions = $csa->get_all_versions();
  Description: Retrieves all the available versions of assemblies
  Returntype : Listref of versions (strings)
  Exceptions : throw if no version is defined
  Caller     : general
  Status     : Stable
 
Code:
click to view

◆ get_default_version()

public String Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_default_version ( )
  Arg [1]    : none
  Example    :
$version = $csa->get_default_version();
  Description: Retrieves the default version of the assembly
  Returntype : String
  Exceptions : throw if no default version is defined
  Caller     : general
  Status     : Stable
 
Code:
click to view

◆ get_mapping_path()

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

◆ new()

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

◆ remove()

public void Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::remove ( )
  Arg [1]    : Bio::EnsEMBL::CoordSystem
  Example    :
$csa->remove($coord_system);
  Description: Removes a CoordSystem object from the database.
  Returntype : none
  Exceptions : Warning if CoordSystem is not stored in this database.
  Caller     : none
  Status     : Stable
 
Code:
click to view

◆ store()

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

◆ store_mapping_path()

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::CoordSystem $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.
               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

◆ store_multiple_mapping_path()

public Reference Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store_multiple_mapping_path ( )
  Arg [1]    : Bio::EnsEMBL::CoordSystem $cs1
  Arg [2]    : Bio::EnsEMBL::CoordSystem $cs2
  Arg [3..n] : Bio::EnsEMBL::CoordSystem $cs3..$csN
  Example    :
my $pathref = $csa->store_multiple_mapping_path($cs1,$cs2);
  Description: Given two or more coordinate systems this will store 
               multiple mapping paths between them in the database.
               Works similarly to the store_mapping_path method
               But will presume every coord system can be mapped in multiple
               ways to the other coord systems
               This is represented by the use of '#' instead of '|'
               in the mapping key
  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:
Bio::EnsEMBL::Registry::get_adaptor
public Adaptor get_adaptor()
map
public map()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::remove
public void remove()
Bio::EnsEMBL::CoordSystem::new
public Bio::EnsEMBL::CoordSystem new()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_attrib
public Bio::EnsEMBL::CoordSystem fetch_by_attrib()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_cache_mapping_paths
protected _cache_mapping_paths()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store_mapping_path
public Reference store_mapping_path()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all
public Listref fetch_all()
Bio::EnsEMBL::CoordSystem
Definition: CoordSystem.pm:40
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_version
public ArrayRef fetch_all_by_version()
Bio::EnsEMBL::Registry
Definition: Registry.pm:113
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_all_versions
public Listref get_all_versions()
Bio::EnsEMBL::CoordSystem::version
public String version()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_rank
public Bio::EnsEMBL::CoordSystem fetch_by_rank()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store_multiple_mapping_path
public Reference store_multiple_mapping_path()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::_cache_seq_region_mapping
protected _cache_seq_region_mapping()
Bio::EnsEMBL::Registry::load_registry_from_db
public Int load_registry_from_db()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_mapping_path
public Reference get_mapping_path()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_name
public Bio::EnsEMBL::CoordSystem fetch_by_name()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_by_dbID
public Bio::EnsEMBL::CoordSystem fetch_by_dbID()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_name
public Listref fetch_all_by_name()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_all_by_attrib
public Reference fetch_all_by_attrib()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_sequence_level
public Bio::EnsEMBL::CoordSystem fetch_sequence_level()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::store
public void store()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::fetch_top_level
public Bio::EnsEMBL::CoordSystem fetch_top_level()
Bio::EnsEMBL::DBSQL::CoordSystemAdaptor::get_default_version
public String get_default_version()