ensembl-hive  2.7.0
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric Class Reference
+ Inheritance diagram for Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric:

Public Member Functions

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

Detailed Description

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:

  - inherit from Bio::EnsEMBL::IdMapping::BaseObject
  - implement all methods listed in METHODS below (see method POD for
    signatures)

Definition at line 69 of file EnsemblGeneric.pm.

Member Function Documentation

◆ calculate_version()

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 or if number of exons changed
  • translation: if translated sequence 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

◆ increment_stable_id()

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

◆ initial_stable_id()

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

◆ is_valid()

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

The documentation for this class was generated from the following file:
map
public map()
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::calculate_version
public String calculate_version()
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::initial_stable_id
public String initial_stable_id()
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::is_valid
public Boolean is_valid()
Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric::increment_stable_id
public String increment_stable_id()