ensembl-hive  2.8.1
AssemblyMapper::BlastzAligner Class Reference

Public Member Functions

public A new ()
 
public String create_tempdir ()
 
public void remove_tempdir ()
 
public void write_sequence ()
 
public void run_blastz ()
 
public void lav_to_axt ()
 
public void find_best_alignment ()
 
public void parse_blastz_output ()
 
public void cleanup_tmpfiles ()
 
public void found_match ()
 
public void adjust_coords ()
 
public filter_overlaps ()
 
public void write_assembly ()
 
public Int stats_incr ()
 
public void init_stats ()
 
public Int get_stats ()
 
public void log_block_stats ()
 
public void log_overall_stats ()
 
protected Values _by_chr_num ()
 
public String AUTOLOAD ()
 

Detailed Description

Synopsis

my $support = new Bio::EnsEMBL::Utils::ConversionSupport($SERVERROOT);
my $aligner = BlastzAligner->new(-SUPPORT => $support);
# create a tempdir for storing input and output
$aligner->create_tempdir;
# write sequences to fasta and nib files
$aligner->write_sequence(
$alt_slice,
$support->param('altassembly'),
"alt_sequence.1"
);
$aligner->write_sequence(
$ref_slice,
$support->param('assembly'),
"ref_sequence.1"
);
# run blastz
$aligner->run_blastz("alt_sequence.1", "ref_sequence.1");

Description

This modules contains helper functions to generate a whole genome alignment
between two closely related assemblies using blastz from scratch. Alignments
are then stored in an Ensembl assembly table.

The module is part of a series of scripts to create a mapping between two
assemblies. See "Related scripts" below for an overview of the whole process.

Definition at line 43 of file BlastzAligner.pm.

Member Function Documentation

◆ _by_chr_num()

protected Values AssemblyMapper::BlastzAligner::_by_chr_num ( )
  Example     :
my @sorted = sort _by_chr_num qw(X, 6-COX, 14, 7);
  Description : Subroutine to use in sort for sorting chromosomes. Sorts
                numerically, then alphabetically
  Return type : values to be used by sort
  Exceptions  : none
  Caller      : internal
 
Code:
click to view

◆ adjust_coords()

public void AssemblyMapper::BlastzAligner::adjust_coords ( )
  Arg[1]      : Int $A_start - start of alternatvie block in chromosomal coords
  Arg[2]      : Int $A_end - end of alternative block in chromosomal coords
  Arg[3]      : Arrayref $R_coords - list of start/end pairs of reference
                blocks in chromosomal coords
  Example     :
my $R_coords = [ [1, 1000], [3000, 5000] ];
$aligner->adjust_coords(1, 30000000, $R_coords);
  Description : Adjusts coordinates of blastz alignments to chromosomal coords.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ AUTOLOAD()

public String AssemblyMapper::BlastzAligner::AUTOLOAD ( )
  Arg[1]      : (optional) String/Object - attribute to set
  Example     :
# setting a attribute
$self->attr($val);
@section autotoc_md0 getting the attribute
$self->attr;
@section autotoc_md1 undefining an attribute
$self->attr(undef);
  Description : lazy function generator for getters/setters
  Return type : String/Object
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ cleanup_tmpfiles()

public void AssemblyMapper::BlastzAligner::cleanup_tmpfiles ( )
  Arg[1-N]    : (optional) list @files - additional tmp files to delete
  Example     :
$self->cleanup_tmpfiles('e_seq.fa', 'v_seq.fa');
  Description : deletes temporary files
  Return type : none
  Exceptions  : Warning if file cannot be deleted
  Caller      : general
  Status      : stable
 
Code:
click to view

◆ create_tempdir()

public String AssemblyMapper::BlastzAligner::create_tempdir ( )
  Arg[1]      : String $tmpdir - temporary directory name
  Example     :
$aligner->create_tempdir;
  Description : Creates a temporary directory in /tmp with a semi-random name
                (username.timestamp.randomnumber). Alternatively, you can pass
                it the name of a directory to use.
  Return type : String - name of the tempdir created
  Exceptions  : Thrown if tempdir can't be created
  Caller      : general
 
Code:
click to view

◆ filter_overlaps()

public AssemblyMapper::BlastzAligner::filter_overlaps ( )
  Description : 
Deprecated:
. This filtering algorithm didn't work well. Please run the separate script fix_overlaps.pl.
 
Code:
click to view

◆ find_best_alignment()

public void AssemblyMapper::BlastzAligner::find_best_alignment ( )
  Example     :
$aligner->find_best_alignment;
  Description : Finds the best set of non-overlapping alignments by running
                axtBest.
  Return type : none
  Exceptions  : thrown if axtBest fails
  Caller      : general
 
Code:
click to view

◆ found_match()

public void AssemblyMapper::BlastzAligner::found_match ( )
  Arg[1]      : Boolean $match_flag - flag indicating if last bp was a match
  Arg[2]      : Int $j - current bp position in the alignment
  Arg[3]      : Hashref $coords - alignment coordinates and strand from blastz
                output
  Description : Populates a datastructure describing blocks of alignment.
  Return type : none
  Exceptions  : none
  Caller      : internal
 
Code:
click to view

◆ get_stats()

public Int AssemblyMapper::BlastzAligner::get_stats ( )
  Arg[1]      : String $code - stats code
  Example     :
my $num_mismatches = $aligner->get_stats('mismatch');
  Description : Stats getter.
  Return type : Int - stats value
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ init_stats()

public void AssemblyMapper::BlastzAligner::init_stats ( )
  Arg[1]      : Array @codes - stats codes to initialise
  Example     :
$aligner->init_stats('match', 'mismatch', 'alignments');
  Description : Initialises stats (i.e. sets to 0).
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ lav_to_axt()

public void AssemblyMapper::BlastzAligner::lav_to_axt ( )
  Example     :
$aligner->lav_to_axt;
  Description : Converts blastz output from lav to axt format. Target and query
                sequences must be present in nib format in the temporary
                directory for this to work.
  Return type : none
  Exceptions  : thrown if lavToAxt fails
  Caller      : general
 
Code:
click to view

◆ log_block_stats()

public void AssemblyMapper::BlastzAligner::log_block_stats ( )
  Arg[1]      : Int $indent - indentation level
  Example     :
$aligner->log_block_stats(3);
  Description : Logs stats for an alignment block.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ log_overall_stats()

public void AssemblyMapper::BlastzAligner::log_overall_stats ( )
  Example     :
$aligner->log_overall_stats;
  Description : Logs overall alignment stats.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ new()

public A AssemblyMapper::BlastzAligner::new ( )
  Arg[-SUPPORT] : a Bio::EnsEMBL::Utils::ConversionSupport object
  Example       :
$SERVERROOT);
my $aligner = BlastzAligner->new(-SUPPORT => $support);
  Description   : object constructor method
  Return type   : a BlastzAligner object
  Exceptions    : none
  Caller        : general
 
Code:
click to view

◆ parse_blastz_output()

public void AssemblyMapper::BlastzAligner::parse_blastz_output ( )
  Example     :
$aligner->parse_blastz_output;
  Description : Reads a blastz alignment result from an axt file and creates
                a datastructure containing ungapped alignments from it. Note
                that mismatches are allowed, but separate stats will be
                collected for them.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ remove_tempdir()

public void AssemblyMapper::BlastzAligner::remove_tempdir ( )
  Example     :
$aligner->remove_tempdir;
  Description : Removes a temporary directory created by $self->create_tempdir.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ run_blastz()

public void AssemblyMapper::BlastzAligner::run_blastz ( )
  Arg[1]      : String $A_basename - basename of alternative fasta file
  Arg[2]      : String $R_basename - basename of reference fasta file
  Example     :
$aligner->run_blastz('alt_seq.1', 'ref_seq.1');
  Description : Runs blastz between an alternative and multiple reference
                sequences.
  Return type : none
  Exceptions  : thrown if blastz fails
  Caller      : general
 
Code:
click to view

◆ stats_incr()

public Int AssemblyMapper::BlastzAligner::stats_incr ( )
  Arg[1]      : String $code - stats code
  Arg[2]      : Int $incr - number by which stats should be incremented
  Example     :
$aligner->stats_incr('total_alignments', 1);
  Description : Increments stats.
  Return type : Int - stat value after increment
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ write_assembly()

public void AssemblyMapper::BlastzAligner::write_assembly ( )
  Arg[1]      : Bio::*::DBSQL::DBAdaptor $R_dba - reference database adaptor
  Example     :
my $R_dba = $support->get_database('ensembl');
$aligner->write_assembly($R_dba);
  Description : Writes assembly entries for blastz alignments to the database.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ write_sequence()

public void AssemblyMapper::BlastzAligner::write_sequence ( )
  Arg[1]      : Bio::EnsEMBL::Slice $slice - slice for which to write sequence
  Arg[2]      : String $assembly - assembly name
  Arg[3]      : String $basename1 - basename of single sequence file
  Arg[4]      : (optional) String $basename2 - basename of multiple sequence
                file
  Example     :
$aligner->write_sequence($slice, 'NCBI35', 'e_seq.1');
  Description : Writes a slice's sequence to a fasta file and converts it to nib
                format. Optionally appends the sequence to another
                multi-sequence fasta file.
  Return type : none
  Exceptions  : thrown if faToNib or file appending fails
  Caller      : general
 
Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::Utils::ConversionSupport
Definition: ConversionSupport.pm:39
AssemblyMapper::BlastzAligner::write_assembly
public void write_assembly()
map
public map()
AssemblyMapper::BlastzAligner::create_tempdir
public String create_tempdir()
AssemblyMapper::BlastzAligner::filter_overlaps
public filter_overlaps()
AssemblyMapper::BlastzAligner::log_overall_stats
public void log_overall_stats()
AssemblyMapper::BlastzAligner::found_match
public void found_match()
AssemblyMapper::BlastzAligner::remove_tempdir
public void remove_tempdir()
AssemblyMapper::BlastzAligner::run_blastz
public void run_blastz()
AssemblyMapper::BlastzAligner::get_stats
public Int get_stats()
AssemblyMapper::BlastzAligner::write_sequence
public void write_sequence()
AssemblyMapper::BlastzAligner::init_stats
public void init_stats()
AssemblyMapper::BlastzAligner::stats_incr
public Int stats_incr()
AssemblyMapper::BlastzAligner::lav_to_axt
public void lav_to_axt()
AssemblyMapper::BlastzAligner::cleanup_tmpfiles
public void cleanup_tmpfiles()
AssemblyMapper::BlastzAligner::parse_blastz_output
public void parse_blastz_output()
AssemblyMapper::BlastzAligner::adjust_coords
public void adjust_coords()
AssemblyMapper::BlastzAligner::_by_chr_num
protected Values _by_chr_num()
AssemblyMapper::BlastzAligner::log_block_stats
public void log_block_stats()
AssemblyMapper::BlastzAligner::find_best_alignment
public void find_best_alignment()
compare
public compare()
AssemblyMapper::BlastzAligner::AUTOLOAD
public String AUTOLOAD()