Archive Ensembl HomeArchive Ensembl Home
Bio::EnsEMBL::Utils::AssemblyProjector Class Reference

List of all members.


Class Summary

Synopsis

  # connect to an old database
  my $dba_old = new Bio::EnsEMBL::DBSQL::DBAdaptor(
    -host   =\> 'ensembldb.ensembl.org',
    -port   =\> 3306,
    -user   =\> ensro,
    -dbname =\> 'mus_musculus_core_46_36g',
    -group  =\> 'core_old',
  );

  # connect to the new database containing the mapping between old and
  # new assembly
  my $dba_new = new Bio::EnsEMBL::DBSQL::DBAdaptor(
    -host   =\> 'ensembldb.ensembl.org',
    -port   =\> 3306,
    -user   =\> ensro,
    -dbname =\> 'mus_musculus_core_47_37',
    -group  =\> 'core_new',
  );

  my $assembly_projector = Bio::EnsEMBL::Utils::AssemblyProjector-\>new(
    -OLD_ASSEMBLY    =\> 'NCBIM36',
    -NEW_ASSEMBLY    =\> 'NCBIM37',
    -ADAPTOR         =\> $dba_new,
    -EXTERNAL_SOURCE =\> 1,
    -MERGE_FRAGMENTS =\> 1,
    -CHECK_LENGTH    =\> 0,
  );

  # fetch a slice on the old assembly
  my $slice_adaptor = $dba_old-\>get_SliceAdaptor;
  my $slice =
    $slice_adaptor-\>fetch_by_region( 'chromosome', 1, undef, undef,
    undef, 'NCBIM36' );

  my $new_slice = $assembly_projector-\>old_to_new($slice);

  print $new_slice-\>name, " (", $assembly_projector-\>last_status, ")\n";

Description

This class implements some utility functions for converting coordinates
between assemblies. A mapping between the two assemblies has to present
the database for this to work, see the 'Related Modules' section below
on how to generate the mapping.
In addition to the "raw" projecting of features and slices, the methods
in this module also apply some sensible rules to the results of the
projection (like discarding unwanted results or merging fragmented
projections). These are the rules (depending on configuration):
Discard the projected feature/slice if:
  1. it doesn't project at all (no segments returned)
  2. [unless MERGE_FRAGMENTS is set] the projection is fragmented (more
     than one segment)
  3. [if CHECK_LENGTH is set] the projection doesn't have the same
     length as the original feature/slice
  4. all segments are on same chromosome and strand
If a projection fails any of these rules, undef is returned instead of
a projected feature/slice. You can use the last_status() method to find
out about the results of the rules tests.
Also note that when projecting features, only a shallow projection is
performed, i.e. other features attached to your features (e.g. the
transcripts of a gene) are not projected automatically, so it will be
the responsability of the user code project all levels of features
involved.
 

Definition at line 82 of file AssemblyProjector.pm.

Available Methods

public adaptor ()
public check_length ()
public external_source ()
public last_status ()
public merge_fragments ()
public A new ()
public new_assembly ()
public Same new_to_old ()
public old_assembly ()
public Same old_to_new ()
public Same project ()

Method Documentation

public Bio::EnsEMBL::Utils::AssemblyProjector::adaptor ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::check_length ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::external_source ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::last_status ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::merge_fragments ( )

Undocumented method

Code:
click to view
public A Bio::EnsEMBL::Utils::AssemblyProjector::new ( )
  Arg [ADAPTOR]         : Bio::EnsEMBL::DBSQL::DBAdaptor $adaptor - a db adaptor
                          for a database containing the assembly mapping
  Arg [EXTERNAL_SOURCE] : (optional) Boolean $external_source - indicates if
                          source is from a different database
  Arg [OLD_ASSEMBLY]    : name of the old assembly
  Arg [OLD_ASSEMBLY]    : name of the new assembly
  Arg [OBJECT_TYPE]     : (optional) object type ('slice' or 'feature')
  Arg [MERGE_FRAGMENTS] : (optional) Boolean - determines if segments are merged
                          to return a single object spanning all segments
                          (default: true)
  Arg [CHECK_LENGTH]    : (optional) Boolean - determines if projected objects
                          have to have same length as original (default: false)
  Example     : my $ap = Bio::EnsEMBL::Utils::AssemblyProjector->new(
                  -DBADAPTOR    => $dba,
                  -OLD_ASSEMBLY => NCBIM36,
                  -NEW_ASSEMBLY => NCBIM37,
                );
  Description : Constructor.
  Return type : a Bio::EnsEMBL::Utils::AssemblyProjector object
  Exceptions  : thrown on missing arguments
                thrown on invalid OBJECT_TYPE
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::new_assembly ( )

Undocumented method

Code:
click to view
public Same Bio::EnsEMBL::Utils::AssemblyProjector::new_to_old ( )
  Arg[1]      : Bio::EnsEMBL::Slice or Bio::EnsEMBL::Feature $object -
                the object to project
  Example     : my $old_slice = $assembly_projector->new_to_old($new_slice, 1);
  Description : Projects a Slice or Feature from new to old assembly.
                This method is just a convenience wrapper for $self->project.
  Return type : same a Arg 1, or undef
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public Bio::EnsEMBL::Utils::AssemblyProjector::old_assembly ( )

Undocumented method

Code:
click to view
public Same Bio::EnsEMBL::Utils::AssemblyProjector::old_to_new ( )
  Arg[1]      : Bio::EnsEMBL::Slice or Bio::EnsEMBL::Feature $object -
                the object to project
  Example     : my $new_slice = $assembly_projector->old_to_new($old_slice);
  Description : Projects a Slice or Feature from old to new assembly.
                This method is just a convenience wrapper for $self->project.
  Return type : same a Arg 1, or undef
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view
public Same Bio::EnsEMBL::Utils::AssemblyProjector::project ( )
  Arg[1]      : Bio::EnsEMBL::Slice or Bio::EnsEMBL::Feature $object -
                the object to project
  Arg[2]      : String $to_assembly - assembly to project to
  Example     : my $new_slice = $assembly_projector->project($old_slice, 
                  'NCBIM37');
  Description : Projects a Slice or Feature to the specified assembly.
                Several tests are performed on the result to discard unwanted
                results. All projection segments have to be on the same
                seq_region and strand. If -MERGE_FRAGMENTS is set, gaps will be
                bridged by creating a single object from first_segment_start to
                last_segment_end. If -CHECK_LENGTH is set, the projected object
                will have to have the same length as the original. You can use
                the last_status() method to find out what the result of some of
                these rule tests were. Please see the comments in the code for
                more details about these rules.
                The return value of this method will always be a single object,
                or undef if the projection fails any of the rules.
                Note that when projecting features, only a "shallow" projection
                is performed, i.e. attached features aren't projected
                automatically! (e.g. if you project a gene, its transcripts will
                have to be projected manually before storing the new gene)
  Return type : same a Arg 1, or undef if projection fails any of the rules
  Exceptions  : thrown on invalid arguments
  Caller      : general, $self->old_to_new, $self->new_to_old
  Status      : At Risk
              : under development
 
Code:
click to view

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