Bio::Align AlignI
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::Align::AlignI - An interface for describing sequence alignments.
Package variables
No package variables defined.
Included modules
Bio::Root::RootI
Inherit
Bio::Root::RootI
Synopsis
# get a Bio::Align::AlignI somehow - typically using Bio::AlignIO system
    print "aln is ", $aln->length, "\n";
Description
This interface describes the basis for alignment objects.
Methods
add_seqDescriptionCode
remove_seqDescriptionCode
purgeDescriptionCode
sort_alphabeticallyDescriptionCode
each_seqDescriptionCode
each_alphabeticallyDescriptionCode
each_seq_with_idDescriptionCode
get_seq_by_posDescriptionCode
selectDescriptionCode
select_noncontDescriptionCode
sliceDescriptionCode
map_charsDescriptionCode
uppercaseDescriptionCode
match_lineDescriptionCode
matchDescriptionCode
unmatchDescriptionCode
idDescriptionCode
missing_charDescriptionCode
match_charDescriptionCode
gap_charDescriptionCode
symbol_charsDescriptionCode
consensus_stringDescriptionCode
consensus_iupacDescriptionCode
is_flushDescriptionCode
lengthDescriptionCode
maxname_length
No description
Code
no_residuesDescriptionCode
no_sequencesDescriptionCode
percentage_identityDescriptionCode
column_from_residue_numberDescriptionCode
displaynameDescriptionCode
set_displayname_countDescriptionCode
set_displayname_flatDescriptionCode
set_displayname_normalDescriptionCode
Methods description
add_seqcode    nextTop
 Title     : add_seq
 Usage     : $myalign->add_seq($newseq);
 Function  : Adds another sequence to the alignment. *Does not* align
             it - just adds it to the hashes.
 Returns   : nothing
 Argument  : a Bio::LocatableSeq object
             order (optional)
See Bio::LocatableSeq for more information.
remove_seqcodeprevnextTop
 Title     : remove_seq
 Usage     : $aln->remove_seq($seq);
 Function  : Removes a single sequence from an alignment
 Returns   :
 Argument  : a Bio::LocatableSeq object
purgecodeprevnextTop
 Title   : purge
 Usage   : $aln->purge(0.7);
 Function:

           Removes sequences above whatever %id.

           This function will grind on large alignments. Beware!
           (perhaps not ideally implemented)

 Example :
 Returns : An array of the removed sequences
 Argument:
sort_alphabeticallycodeprevnextTop
 Title     : sort_alphabetically
 Usage     : $ali->sort_alphabetically
 Function  : 

             Changes the order of the alignemnt to alphabetical on name 
             followed by numerical by number.

 Returns   : 
 Argument  :
each_seqcodeprevnextTop
 Title     : each_seq
 Usage     : foreach $seq ( $align->each_seq() ) 
 Function  : Gets an array of Seq objects from the alignment
 Returns   : an array
 Argument  :
each_alphabeticallycodeprevnextTop
 Title     : each_alphabetically
 Usage     : foreach $seq ( $ali->each_alphabetically() )
 Function  :

             Returns an array of sequence object sorted alphabetically 
             by name and then by start point.
             Does not change the order of the alignment

 Returns   : 
 Argument  :
each_seq_with_idcodeprevnextTop
 Title     : each_seq_with_id
 Usage     : foreach $seq ( $align->each_seq_with_id() ) 
 Function  : 

             Gets an array of Seq objects from the
             alignment, the contents being those sequences
             with the given name (there may be more than one)

 Returns   : an array
 Argument  : a seq name
get_seq_by_poscodeprevnextTop
 Title     : get_seq_by_pos
 Usage     : $seq = $aln->get_seq_by_pos(3) # third sequence from the alignment
 Function  : 

             Gets a sequence based on its position in the alignment.
             Numbering starts from 1.  Sequence positions larger than
             no_sequences() will thow an error.

 Returns   : a Bio::LocatableSeq object
 Argument  : positive integer for the sequence osition
selectcodeprevnextTop
 Title     : select
 Usage     : $aln2 = $aln->select(1, 3) # three first sequences
 Function  : 

             Creates a new alignment from a continuous subset of
             sequences.  Numbering starts from 1.  Sequence positions
             larger than no_sequences() will thow an error.

 Returns   : a Bio::SimpleAlign object
 Argument  : positive integer for the first sequence
             positive integer for the last sequence to include (optional)
select_noncontcodeprevnextTop
 Title     : select_noncont
 Usage     : $aln2 = $aln->select_noncont(1, 3) # first and 3rd sequences
 Function  : 

             Creates a new alignment from a subset of
             sequences.  Numbering starts from 1.  Sequence positions
             larger than no_sequences() will thow an error.

 Returns   : a Bio::SimpleAlign object
 Args      : array of integers for the sequences
slicecodeprevnextTop
 Title     : slice
 Usage     : $aln2 = $aln->slice(20, 30)
 Function  : 

             Creates a slice from the alignment inclusive of start and
             end columns.  Sequences with no residues in the slice are
             excluded from the new alignment and a warning is printed.
             Slice beyond the length of the sequence does not do
             padding.

 Returns   : a Bio::SimpleAlign object
 Argument  : positive integer for start column 
             positive integer for end column
map_charscodeprevnextTop
 Title     : map_chars
 Usage     : $ali->map_chars('\.','-')
 Function  : 

             Does a s/$arg1/$arg2/ on the sequences. Useful for gap
             characters

             Notice that the from (arg1) is interpretted as a regex,
             so be careful about quoting meta characters (eg
             $ali->map_chars('.','-') wont do what you want)

 Returns   : 
 Argument  : 'from' rexexp
             'to' string
uppercasecodeprevnextTop
 Title     : uppercase()
 Usage     : $ali->uppercase()
 Function  : Sets all the sequences to uppercase
 Returns   : 
 Argument  :
match_linecodeprevnextTop
 Title    : match_line()
 Usage    : $align->match_line()
 Function : Generates a match line - much like consensus string
            except that a line indicating the '*' for a match.
 Argument : (optional) Match line characters ('*' by default)
            (optional) Strong match char (':' by default)
            (optional) Weak match char ('.' by default)
matchcodeprevnextTop
 Title     : match()
 Usage     : $ali->match()
 Function  : 

             Goes through all columns and changes residues that are
             identical to residue in first sequence to match '.'
             character. Sets match_char.
USE WITH CARE: Most MSE formats do not support match characters in sequences, so this is mostly for output only. NEXUS format (Bio::AlignIO::nexus) can handle
it.
Returns : 1 Argument : a match character, optional, defaults to '.'
unmatchcodeprevnextTop
 Title     : unmatch()
 Usage     : $ali->unmatch()
 Function  : 

             Undoes the effect of method match. Unsets match_char.
Returns : 1 Argument : a match character, optional, defaults to '.'
idcodeprevnextTop
 Title     : id
 Usage     : $myalign->id("Ig")
 Function  : Gets/sets the id field of the alignment
 Returns   : An id string
 Argument  : An id string (optional)
missing_charcodeprevnextTop
 Title     : missing_char
 Usage     : $myalign->missing_char("?")
 Function  : Gets/sets the missing_char attribute of the alignment
             It is generally recommended to set it to 'n' or 'N' 
             for nucleotides and to 'X' for protein. 
 Returns   : An missing_char string,
 Argument  : An missing_char string (optional)
match_charcodeprevnextTop
 Title     : match_char
 Usage     : $myalign->match_char('.')
 Function  : Gets/sets the match_char attribute of the alignment
 Returns   : An match_char string,
 Argument  : An match_char string (optional)
gap_charcodeprevnextTop
 Title     : gap_char
 Usage     : $myalign->gap_char('-')
 Function  : Gets/sets the gap_char attribute of the alignment
 Returns   : An gap_char string, defaults to '-'
 Argument  : An gap_char string (optional)
symbol_charscodeprevnextTop
 Title   : symbol_chars
 Usage   : my @symbolchars = $aln->symbol_chars;
 Function: Returns all the seen symbols (other than gaps)
 Returns : array of characters that are the seen symbols
 Argument: boolean to include the gap/missing/match characters
consensus_stringcodeprevnextTop
 Title     : consensus_string
 Usage     : $str = $ali->consensus_string($threshold_percent)
 Function  : Makes a strict consensus 
 Returns   : 
 Argument  : Optional treshold ranging from 0 to 100.
             The consensus residue has to appear at least threshold %
             of the sequences at a given location, otherwise a '?'
             character will be placed at that location.
             (Default value = 0%)
consensus_iupaccodeprevnextTop
 Title     : consensus_iupac
 Usage     : $str = $ali->consensus_iupac()
 Function  : 

             Makes a consensus using IUPAC ambiguity codes from DNA
             and RNA. The output is in upper case except when gaps in
             a column force output to be in lower case.

             Note that if your alignment sequences contain a lot of
             IUPAC ambiquity codes you often have to manually set
             alphabet.  Bio::PrimarySeq::_guess_type thinks they
indicate a protein sequence.
Returns : consensus string Argument : none Throws : on protein sequences
is_flushcodeprevnextTop
 Title     : is_flush
 Usage     : if( $ali->is_flush() )
           : 
           :
 Function  : Tells you whether the alignment 
           : is flush, ie all of the same length
           : 
           :
 Returns   : 1 or 0
 Argument  :
lengthcodeprevnextTop
 Title     : length()
 Usage     : $len = $ali->length() 
 Function  : Returns the maximum length of the alignment.
             To be sure the alignment is a block, use is_flush
 Returns   : 
 Argument  :
no_residuescodeprevnextTop
 Title     : no_residues
 Usage     : $no = $ali->no_residues
 Function  : number of residues in total in the alignment
 Returns   : integer
 Argument  :
no_sequencescodeprevnextTop
 Title     : no_sequences
 Usage     : $depth = $ali->no_sequences
 Function  : number of sequence in the sequence alignment
 Returns   : integer
 Argument  : None
percentage_identitycodeprevnextTop
 Title   : percentage_identity
 Usage   : $id = $align->percentage_identity
 Function: The function uses a fast method to calculate the average 
           percentage identity of the alignment
 Returns : The average percentage identity of the alignment
 Argument: None
column_from_residue_numbercodeprevnextTop
 Title   : column_from_residue_number
 Usage   : $col = $ali->column_from_residue_number( $seqname, $resnumber)
 Function:

           This function gives the position in the alignment
           (i.e. column number) of the given residue number in the
           sequence with the given name. For example, for the
           alignment

  	     Seq1/91-97 AC..DEF.GH
  	     Seq2/24-30 ACGG.RTY..
  	     Seq3/43-51 AC.DDEFGHI

           column_from_residue_number( "Seq1", 94 ) returns 5.
           column_from_residue_number( "Seq2", 25 ) returns 2.
           column_from_residue_number( "Seq3", 50 ) returns 9.

           An exception is thrown if the residue number would lie
           outside the length of the aligment
           (e.g. column_from_residue_number( "Seq2", 22 )

	  Note: If the the parent sequence is represented by more than
	  one alignment sequence and the residue number is present in
	  them, this method finds only the first one.

 Returns : A column number for the position in the alignment of the
           given residue in the given sequence (1 = first column)
 Args    : A sequence id/name (not a name/start-end)
           A residue number in the whole sequence (not just that
           segment of it in the alignment)
displaynamecodeprevnextTop
 Title     : displayname
 Usage     : $myalign->displayname("Ig", "IgA")
 Function  : Gets/sets the display name of a sequence in the alignment
           :
 Returns   : A display name string
 Argument  : name of the sequence
             displayname of the sequence (optional)
set_displayname_countcodeprevnextTop
 Title     : set_displayname_count
 Usage     : $ali->set_displayname_count
 Function  : 

             Sets the names to be name_# where # is the number of
             times this name has been used.

 Returns   : None 
 Argument  : None
set_displayname_flatcodeprevnextTop
 Title     : set_displayname_flat
 Usage     : $ali->set_displayname_flat()
 Function  : Makes all the sequences be displayed as just their name,
             not name/start-end
 Returns   : 1
 Argument  : None
set_displayname_normalcodeprevnextTop
 Title     : set_displayname_normal
 Usage     : $ali->set_displayname_normal() 
 Function  : Makes all the sequences be displayed as name/start-end
 Returns   : None
 Argument  : None
Methods code
add_seqdescriptionprevnextTop
sub add_seq {
    my ($self) = @_;
    $self->throw_not_implemented();
}
remove_seqdescriptionprevnextTop
sub remove_seq {
    my ($self) = @_;
    $self->throw_not_implemented();
}
purgedescriptionprevnextTop
sub purge {
    my ($self) = @_;
    $self->throw_not_implemented();
}
sort_alphabeticallydescriptionprevnextTop
sub sort_alphabetically {
    my ($self) = @_;
    $self->throw_not_implemented();
}
each_seqdescriptionprevnextTop
sub each_seq {
    my ($self) = @_;
    $self->throw_not_implemented();
}
each_alphabeticallydescriptionprevnextTop
sub each_alphabetically {
    my($self) = @_;
    $self->throw_not_implemented();
}
each_seq_with_iddescriptionprevnextTop
sub each_seq_with_id {
    my ($self) = @_;
    $self->throw_not_implemented();
}
get_seq_by_posdescriptionprevnextTop
sub get_seq_by_pos {
    my ($self) = @_;
    $self->throw_not_implemented();
}
selectdescriptionprevnextTop
sub select {
    my ($self) = @_;
    $self->throw_not_implemented();
}
select_noncontdescriptionprevnextTop
sub select_noncont {
    my ($self) = @_;
    $self->throw_not_implemented();
}
slicedescriptionprevnextTop
sub slice {
    my ($self) = @_;
    $self->throw_not_implemented();
}
map_charsdescriptionprevnextTop
sub map_chars {
    my ($self) = @_;
    $self->throw_not_implemented();
}
uppercasedescriptionprevnextTop
sub uppercase {
    my ($self) = @_;
    $self->throw_not_implemented();
}
match_linedescriptionprevnextTop
sub match_line {
    my ($self) = @_;
    $self->throw_not_implemented();
}
matchdescriptionprevnextTop
sub match {
    my ($self) = @_;
    $self->throw_not_implemented();
}
unmatchdescriptionprevnextTop
sub unmatch {
    my ($self) = @_;
    $self->throw_not_implemented();
}
iddescriptionprevnextTop
sub id {
    my ($self) = @_;
    $self->throw_not_implemented();
}
missing_chardescriptionprevnextTop
sub missing_char {
    my ($self) = @_;
    $self->throw_not_implemented();
}
match_chardescriptionprevnextTop
sub match_char {
    my ($self) = @_;
    $self->throw_not_implemented();
}
gap_chardescriptionprevnextTop
sub gap_char {
    my ($self) = @_;
    $self->throw_not_implemented();
}
symbol_charsdescriptionprevnextTop
sub symbol_chars {
    my ($self) = @_;
    $self->throw_not_implemented();
}
consensus_stringdescriptionprevnextTop
sub consensus_string {
    my ($self) = @_;
    $self->throw_not_implemented();
}
consensus_iupacdescriptionprevnextTop
sub consensus_iupac {
    my ($self) = @_;
    $self->throw_not_implemented();
}
is_flushdescriptionprevnextTop
sub is_flush {
    my ($self) = @_;
    $self->throw_not_implemented();
}
lengthdescriptionprevnextTop
sub length {
    my ($self) = @_;
    $self->throw_not_implemented();
}
maxname_lengthdescriptionprevnextTop
sub maxname_length {
    my ($self) = @_;
    $self->throw_not_implemented();
}
no_residuesdescriptionprevnextTop
sub no_residues {
    my ($self) = @_;
    $self->throw_not_implemented();
}
no_sequencesdescriptionprevnextTop
sub no_sequences {
    my ($self) = @_;
    $self->throw_not_implemented();
}
percentage_identitydescriptionprevnextTop
sub percentage_identity {
    my ($self) = @_;
    $self->throw_not_implemeneted();
}
column_from_residue_numberdescriptionprevnextTop
sub column_from_residue_number {
    my ($self) = @_;
    $self->throw_not_implemented();
}
displaynamedescriptionprevnextTop
sub displayname {
    my ($self) = @_;
    $self->throw_not_implemented();
}
set_displayname_countdescriptionprevnextTop
sub set_displayname_count {
    my ($self) = @_;
    $self->throw_not_implemented();
}
set_displayname_flatdescriptionprevnextTop
sub set_displayname_flat {
    my ($self) = @_;
    $self->throw_not_implemented();
}
set_displayname_normaldescriptionprevnextTop
sub set_displayname_normal {
    my ($self) = @_;
    $self->throw_not_implemented();
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org              - General discussion
  http://bioperl.org/MailList.shtml  - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
email or the web:
  bioperl-bugs@bioperl.org
  http://bioperl.org/bioperl-bugs/
AUTHOR - Jason StajichTop
Email jason@bioperl.org
CONTRIBUTORSTop
Ewan Birney, birney@ebi.ac.uk
Heikki Lehvaslaiho, heikki@ebi.ac.uk
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
Modifier methodsTop
These methods modify the MSE by adding, removing or shuffling complete
sequences.
Sequence selection methodsTop
Methods returning one or more sequences objects.
Create new alignmentsTop
The result of these methods are horizontal or vertical subsets of the
current MSE.
Change sequences within the MSETop
These methods affect characters in all sequences without changeing the
alignment.
MSE attibutesTop
Methods for setting and reading the MSE attributes.
Note that the methods defining character semantics depend on the user
to set them sensibly. They are needed only by certain input/output
methods. Unset them by setting to an empty string ('').
Alignment descriptorsTop
These read only methods describe the MSE in various ways.
maxdisplayname_lengthTop
 Title     : maxdisplayname_length
 Usage     : $ali->maxdisplayname_length()
 Function  : 

             Gets the maximum length of the displayname in the
             alignment. Used in writing out various MSE formats.

 Returns   : integer
 Argument  :
Alignment positionsTop
Methods to map a sequence position into an alignment column and back.
column_from_residue_number() does the former. The latter is really a
property of the sequence object and can done using
Bio::LocatableSeq::location_from_column:
    # select somehow a sequence from the alignment, e.g.
    my $seq = $aln->get_seq_by_pos(1);
    #$loc is undef or Bio::LocationI object
    my $loc = $seq->location_from_column(5);
Sequence namesTop
Methods to manipulate the display name. The default name based on the
sequence id and subsequence positions can be overridden in various
ways.