ensembl-hive  2.8.1
Bio::EnsEMBL::IdMapping::Serialisable Class Reference
+ Inheritance diagram for Bio::EnsEMBL::IdMapping::Serialisable:

Public Member Functions

public Bio::EnsEMBL::IdMapping::Serialisable new ()
 
public String write_to_file ()
 
public Bio::EnsEMBL::IdMapping::Serialisable read_from_file ()
 
public String dump_path ()
 
public String cache_file_name ()
 
public String cache_file ()
 
public Boolean loaded ()
 

Detailed Description

Synopsis

# instantiate an object which extends Serialisable
my $object = YourObject->new(
-DUMP_PATH => '/tmp',
-CACHE_FILE => 'object_cache.ser',
);
# serialise object to file
my $filesize = $object->write_to_file;
print LOG "Serialised object to file of size $filesize.\n";
# later, create another object defining the same serialisation
# location. specifying -LOAD_AUTO will automatically load it from the
# serialisation file.
my $object1 = YourObject->new(
-DUMP_PATH => '/tmp',
-CACHE_FILE => 'object_cache.ser',
-LOAD_AUTO => 1,
);
# alternatively, manually load the object from file
$object1->load_from_file;

Description

This is the base class for serialisable objects used by the
stable Id mapping.  It's essentially an OO wrapper for Storable,
providing a method to store (write_to_file(()) and one to retrieve
(read_from_file()) serialised objects.

This class is not instantiated itself, but rather extended by
implementing classes.

Definition at line 45 of file Serialisable.pm.

Member Function Documentation

◆ cache_file()

public String Bio::EnsEMBL::IdMapping::Serialisable::cache_file ( )
  Example     :
my $cache_file = $object->cache_file;
  Description : Returns the path and name of the serialised object file.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ cache_file_name()

public String Bio::EnsEMBL::IdMapping::Serialisable::cache_file_name ( )
  Arg[1]      : String - file name for serialisation
  Example     :
$object->cache_file_name('object_cache.ser');
  Description : Getter/setter for the file name for serialisation.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ dump_path()

public String Bio::EnsEMBL::IdMapping::Serialisable::dump_path ( )
  Arg[1]      : String - dump path for serialisation
  Example     :
$object->dump_path('/tmp');
  Description : Getter/setter for the dump path for serialisation.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ loaded()

public Boolean Bio::EnsEMBL::IdMapping::Serialisable::loaded ( )
  Arg[1]      : Boolean - "loaded" status
  Example     :
if ($object->loaded) {
@section autotoc_md13 do something with the object that was loaded from a file
} else {
@section autotoc_md14 the object wasn't loaded but is new, so fill it
}
  Description : Indicates whether a given object was loaded from its serialised
                state on disk.
  Return type : Boolean - TRUE if loaded from disk, FALSE otherwise
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ new()

public Bio::EnsEMBL::IdMapping::Serialisable Bio::EnsEMBL::IdMapping::Serialisable::new ( )
  Arg [DUMP_PATH] : String - path for object serialisation
  Arg [CACHE_FILE] : String - filename of serialised object
  Arg [AUTO_LOAD] : Boolean - determines whether object should be automatically
                    loaded on instantiation
  Description : Constructor.
  Return type : Bio::EnsEMBL::IdMapping::Serialisable implementing object
  Exceptions  : thrown on missing argument
  Caller      : implementing subclass
  Status      : At Risk
              : under development
 
Code:
click to view

◆ read_from_file()

public Bio::EnsEMBL::IdMapping::Serialisable Bio::EnsEMBL::IdMapping::Serialisable::read_from_file ( )
  Example     :
$object->read_from_file;
  Description : Reads a serialised object from file (determined by
                $self->cache_file).
  Return type : Bio::EnsEMBL::IdMapping::Serialisable implementing object
  Exceptions  : thrown on I/O errors
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ write_to_file()

public String Bio::EnsEMBL::IdMapping::Serialisable::write_to_file ( )
  Example     :
my $filesize = $object->write_to_file;
  Description : Serialises an object to a file (determined by
                $self->cache_file).
  Return type : String - size of serialisation file
  Exceptions  : thrown on I/O errors
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::IdMapping::Serialisable::cache_file_name
public String cache_file_name()
Bio::EnsEMBL::IdMapping::Serialisable::dump_path
public String dump_path()
Bio::EnsEMBL::IdMapping::Serialisable::cache_file
public String cache_file()
Bio::EnsEMBL::IdMapping::Serialisable::loaded
public Boolean loaded()
Bio::EnsEMBL::IdMapping::Serialisable::read_from_file
public Bio::EnsEMBL::IdMapping::Serialisable read_from_file()
Bio::EnsEMBL::IdMapping::Serialisable::write_to_file
public String write_to_file()