Archive Ensembl HomeArchive Ensembl Home
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric Class Reference
Inheritance diagram for Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric:

List of all members.


Class Summary

Synopsis

  # inject the confiured StableIdGenerator plugin
  my $stable_id_generator = $conf-\>param('plugin_stable_id_generator');
  inject($stable_id_generator);

  # create a new StableIdGenerator object
  my $generator_instance = $stable_id_generator-\>new(
    -LOGGER =\> $self-\>logger,
    -CONF   =\> $self-\>conf,
    -CACHE  =\> $self-\>cache
  );

  # determine starting stable ID for new assignments
  my $new_stable_id = $generator_instance-\>initial_stable_id('gene');

  # loop over genes
  foreach my $target_gene (@all_target_genes) {

    # if the stable Id for this gene was mapped, assign it
    if ( $mapping_exists{ $target_gene-\>id } ) {
      my $source_gene = $mappings{ $target_gene-\>id };
      $target_gene-\>stable_id( $source_gene-\>stable_id );

      # calculate and set version
      my $version =
        $generator_instance-\>calculate_version( $source_gene,
        $target_gene );
      $target_gene-\>version($version);

      # no mapping exists, assign a new stable Id
    } else {
      $target_gene-\>stable_id($new_stable_id);
      $target_gene-\>version('1');

    # increment the stable Id (to be assigned to the next unmapped gene)
      $new_stable_id =
        $generator_instance-\>increment_stable_id($new_stable_id);
    }
  }

Description

This is the default implementation for a StableIdGenerator, which
is used by Bio::EnsEMBL::IdMapping::StableIdMapper to generate new
stable Ids and increment versions on mapped stable Ids.  Refer to the
documentation in this module if you would like to implement your own
StableIdGenerator.
The stable Id mapping application allows you to plugin your own
implementation by specifying it with the --plugin_stable_id_generator
configuration parameter.
Requirements for a StableIdGenerator plugin:

 

Definition at line 69 of file EnsemblGeneric.pm.

Available Methods

public
Bio::EnsEMBL::IdMapping::Cache 
cache ()
public String calculate_version ()
public
Bio::EnsEMBL::Utils::ConfParser 
conf ()
public Int dump_table_to_file ()
public SQLStatement fetch_value_from_db ()
public Boolean file_exists ()
public Filehandle get_filehandle ()
public String increment_stable_id ()
public String initial_stable_id ()
public Boolean is_valid ()
public Bio::EnsEMBL::Utils::Logger logger ()
public $this new ()
public Int upload_file_into_table ()

Method Documentation

public Bio::EnsEMBL::IdMapping::Cache Bio::EnsEMBL::IdMapping::BaseObject::cache ( ) [inherited]
  Arg[1]      : (optional) Bio::EnsEMBL::IdMapping::Cache - the cache to set
  Example     : $object->cache->read_from_file('source');
  Description : Getter/setter for cache object
  Return type : Bio::EnsEMBL::IdMapping::Cache
  Exceptions  : none
  Caller      : constructor
  Status      : At Risk
              : under development
 
Code:
click to view
public String Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::calculate_version ( )
  Arg[1]      : Bio::EnsEMBL::IdMapping::TinyFeature $s_obj - source object
  Arg[2]      : Bio::EnsEMBL::IdMapping::TinyFeature $t_obj - target object
  Example     : my $version = $generator->calculate_version($source_gene,
                  $target_gene);
                $target_gene->version($version);
  Description : Determines the version for a mapped stable Id. For Ensembl
                genes, the rules for incrementing the version number are:

  • exons: if exon sequence changed
  • transcript: if spliced exon sequence changed
  • translation: if transcript changed
  • gene: if any of its transcript changed Return type : String - the version to be used Exceptions : thrown on wrong argument Caller : Bio::EnsEMBL::IdMapping::StableIdMapper::map_stable_ids() Status : At Risk : under development
 
Code:
click to view
public Bio::EnsEMBL::Utils::ConfParser Bio::EnsEMBL::IdMapping::BaseObject::conf ( ) [inherited]
  Arg[1]      : (optional) Bio::EnsEMBL::Utils::ConfParser - the configuration
                to set
  Example     : my $basedir = $object->conf->param('basedir');
  Description : Getter/setter for configuration object
  Return type : Bio::EnsEMBL::Utils::ConfParser
  Exceptions  : none
  Caller      : constructor
  Status      : At Risk
              : under development
 
Code:
click to view
public Int Bio::EnsEMBL::IdMapping::BaseObject::dump_table_to_file ( ) [inherited]
  Arg[1]      : String $dbtype - db type (source|target)
  Arg[2]      : String $table - name of table to dump
  Arg[3]      : String $filename - name of dump file
  Arg[4]      : Boolean $check_existing - turn on test for existing dump
  Example     : my $rows_dumped = $object->dump_table_to_file('source',
                  'stable_id_event', 'stable_id_event_existing.txt');
  Description : Dumps the contents of a db table to a tab-delimited file. The
                dump file will be written to a subdirectory called 'tables'
                under the basedir from your configuration.
  Return type : Int - the number of rows dumped
  Exceptions  : thrown on wrong or missing arguments
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public SQLStatement Bio::EnsEMBL::IdMapping::BaseObject::fetch_value_from_db ( ) [inherited]
  Arg[1]      : DBI::db $dbh - a DBI database handle
  Arg[2]      : String $sql - SQL statement to execute
  Example     : my $num_genes = $object->fetch_value_from_db($dbh,
                  'SELECT count(*) FROM gene');
  Description : Executes an SQL statement on a db handle and returns the first
                column of the first row returned. Useful for queries returning a
                single value, like table counts.
  Return type : Return type of SQL statement
  Exceptions  : thrown on wrong or missing arguments
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public Boolean Bio::EnsEMBL::IdMapping::BaseObject::file_exists ( ) [inherited]
  Arg[1]      : String $filename - filename to test
  Arg[2]      : Boolean $path_append - turn on pre-pending of basedir
  Example     : unless ($object->file_exists('gene_mappings.ser', 1)) {
                  $object->do_gene_mapping;
                }
  Description : Tests if a file exists and has non-zero size.
  Return type : Boolean
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public Filehandle Bio::EnsEMBL::IdMapping::BaseObject::get_filehandle ( ) [inherited]
  Arg[1]      : String $filename - filename for filehandle
  Arg[2]      : String $path_append - append subdirectory name to basedir
  Arg[3]      : String $mode - filehandle mode (<|>|>>)
  Example     : my $fh = $object->get_filehandle('mapping_stats.txt', 'stats',
                  '>');
                print $fh "Stats:\\n";
  Description : Returns a filehandle to a file for reading or writing. The file
                is qualified with the basedir defined in the configuration and
                an optional subdirectory name.
  Return type : filehandle
  Exceptions  : thrown on missing filename
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public String Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::increment_stable_id ( )
  Arg[1]      : String $stable_id - the stable Id to increment
  Example     : $next_stable_id = $generator->increment_stable_id(
                  $current_stable_id);
  Description : Increments the stable Id used for new assigments. This method is
                called after each new stable Id assigment to generate the next
                stable Id to be used.
  Return type : String - the next new stable Id
  Exceptions  : thrown on missing or malformed argument
  Caller      : Bio::EnsEMBL::IdMapping::StableIdMapper::map_stable_ids()
  Status      : At Risk
              : under development
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::IdMapping::StableIdGenerator::AedesAegypti, Bio::EnsEMBL::IdMapping::StableIdGenerator::AedesAegypti, and Bio::EnsEMBL::IdMapping::StableIdGenerator::PristionchusPacificus.

public String Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::initial_stable_id ( )
  Arg[1]      : String $type - an entity type (gene|transcript|translation|exon)
  Example     : my $new_stable_id = $generator->initial_stable_id('gene');
  Description : Determine the initial stable Id to use for new assignments. This
                method is called once at the beginning of stable Id mapping.
  Return type : String - a stable Id of appropriate type
  Exceptions  : none
  Caller      : Bio::EnsEMBL::IdMapping::StableIdMapper::map_stable_ids()
  Status      : At Risk
              : under development
 
Code:
click to view
public Boolean Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::is_valid ( )
  Arg[1]      : String $stable_id - the stable Id to check
  Example     : unless ($generator->is_valid($stable_id)) {
                  die "Invalid stable Id: $stable_id.\\n";
                }
  Description : Tests a stable Id to be valid (according to the Ensembl stable
                Id format definition).
  Return type : Boolean - TRUE if valid, FALSE otherwise
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::IdMapping::StableIdGenerator::AedesAegypti, Bio::EnsEMBL::IdMapping::StableIdGenerator::AedesAegypti, and Bio::EnsEMBL::IdMapping::StableIdGenerator::PristionchusPacificus.

public Bio::EnsEMBL::Utils::Logger Bio::EnsEMBL::IdMapping::BaseObject::logger ( ) [inherited]
  Arg[1]      : (optional) Bio::EnsEMBL::Utils::Logger - the logger to set
  Example     : $object->logger->info("Starting ID mapping.\\n");
  Description : Getter/setter for logger object
  Return type : Bio::EnsEMBL::Utils::Logger
  Exceptions  : none
  Caller      : constructor
  Status      : At Risk
              : under development
 
Code:
click to view
public $this Bio::EnsEMBL::IdMapping::BaseObject::new ( ) [inherited]
  Arg [LOGGER]: Bio::EnsEMBL::Utils::Logger $logger - a logger object
  Arg [CONF]  : Bio::EnsEMBL::Utils::ConfParser $conf - a configuration object
  Arg [CACHE] : Bio::EnsEMBL::IdMapping::Cache $cache - a cache object
  Example     : my $object = Bio::EnsEMBL::IdMapping::BaseObjectSubclass->new(
                  -LOGGER => $logger,
                  -CONF   => $conf,
                  -CACHE  => $cache
                );
  Description : Constructor
  Return type : implementing subclass type
  Exceptions  : thrown on wrong or missing arguments
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::IdMapping::StableIdMapper.

public Int Bio::EnsEMBL::IdMapping::BaseObject::upload_file_into_table ( ) [inherited]
  Arg[1]      : String $dbtype - db type (source|target)
  Arg[2]      : String $table - name of table to upload the data to
  Arg[3]      : String $filename - name of dump file
  Arg[4]      : Boolean $no_check_empty - don't check if table is empty
  Example     : my $rows_uploaded = $object->upload_file_into_table('target',
                  'stable_id_event', 'stable_id_event_new.txt');
  Description : Uploads a tab-delimited data file into a db table. The data file
                will be taken from a subdirectory 'tables' under your configured
                basedir. If the db table isn't empty and $no_check_empty isn't
                set, no data is uploaded (and a warning is issued).
  Return type : Int - the number of rows uploaded
  Exceptions  : thrown on wrong or missing arguments
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

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