Christopher Fields > BioPerl > Bio::Tools::IUPAC



Annotate this POD


New  12
Open  4
View/Report Bugs
Module Version: 1.006924   Source  


Bio::Tools::IUPAC - Generates unique sequence objects or regular expressions from an ambiguous IUPAC sequence


 use Bio::PrimarySeq;
 use Bio::Tools::IUPAC;

 # Get the IUPAC code for proteins
 my %iupac_prot = Bio::Tools::IUPAC->new->iupac_iup;

 # Create a sequence with degenerate residues
 my $ambiseq = Bio::PrimarySeq->new(-seq => 'ARTCGUTGN', -alphabet => 'dna');

 # Create all possible non-degenerate sequences
 my $iupac = Bio::Tools::IUPAC->new(-seq => $ambiseq);
 while ($uniqueseq = $iupac->next_seq()) {
     # process the unique Bio::Seq object.

 # Get a regular expression that matches all possible sequences
 my $regexp = $iupac->regexp();


Bio::Tools::IUPAC is a tool that manipulates sequences with ambiguous residues following the IUPAC conventions. Non-standard characters have the meaning described below:

      Cornish-Bowden (1985) Nucl. Acids Res. 13: 3021-3030

    Symbol       Meaning      Nucleic Acid
     A            A           Adenine
     C            C           Cytosine
     G            G           Guanine
     T            T           Thymine
     U            U           Uracil
     M          A or C        aMino
     R          A or G        puRine
     W          A or T        Weak
     S          C or G        Strong
     Y          C or T        pYrimidine
     K          G or T        Keto
     V        A or C or G     not T (closest unused char after T)
     H        A or C or T     not G (closest unused char after G)
     D        A or G or T     not C (closest unused char after C)
     B        C or G or T     not A (closest unused char after A)
     X      G or A or T or C  Unknown (very rarely used)
     N      G or A or T or C  Unknown (commonly used)

      Biochem J. 1984 Apr 15; 219(2): 345-373
      Eur J Biochem. 1993 Apr 1; 213(1): 2

    Symbol           Meaning
    A        Alanine
    B        Aspartic Acid, Asparagine
    C        Cysteine
    D        Aspartic Acid
    E        Glutamic Acid
    F        Phenylalanine
    G        Glycine
    H        Histidine
    I        Isoleucine
    J        Isoleucine/Leucine
    K        Lysine
    L        Leucine
    M        Methionine
    N        Asparagine
    O        Pyrrolysine
    P        Proline
    Q        Glutamine
    R        Arginine
    S        Serine
    T        Threonine
    U        Selenocysteine
    V        Valine
    W        Tryptophan
    X        Unknown
    Y        Tyrosine
    Z        Glutamic Acid, Glutamine
    *        Terminator

There are a few things Bio::Tools::IUPAC can do for you:


Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.                  - General discussion  - About the mailing lists


Please direct usage questions or support issues to the mailing list:

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

AUTHOR - Aaron Mackey ^



The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


 Title   : new
 Usage   : Bio::Tools::IUPAC->new($seq);
 Function: Create a new IUPAC object, which acts as a sequence stream (akin to
 Args    : an ambiguously coded sequence object that has a specified 'alphabet'
 Returns : a Bio::Tools::IUPAC object.


 Title   : next_seq
 Usage   : $iupac->next_seq();
 Function: returns the next unique sequence object
 Args    : none.
 Returns : a Bio::Seq object


 Title   : iupac
 Usage   : my %symbols = $iupac->iupac;
 Function: Returns a hash of symbols -> symbol components of the right type
           for the given sequence, i.e. it is the same as iupac_iup() if
           Bio::Tools::IUPAC was given a proteic sequence, or iupac_iub() if the 
           sequence was nucleic. For example, the key 'M' has the value ['A', 'C'].
 Args    : none
 Returns : Hash


 Title   : iupac_amb
 Usage   : my %symbols = $iupac->iupac_amb;
 Function: Same as iupac() but only contains a mapping between ambiguous residues
           and the ambiguous residues they map to. For example, the key 'N' has
           the value ['R', 'Y', 'K', 'M', 'S', 'W', 'B', 'D', 'H', 'V', 'N'],
           i.e. it matches all other ambiguous residues.
 Args    : none
 Returns : Hash


 Title   : iupac_iup
 Usage   : my %aasymbols = $iupac->iupac_iup;
 Function: Returns a hash of PROTEIN symbols -> non-ambiguous symbol components
 Args    : none
 Returns : Hash


 Title   : iupac_iup_amb
 Usage   : my %aasymbols = $iupac->iupac_iup_amb;
 Function: Returns a hash of PROTEIN symbols -> ambiguous symbol components
 Args    : none
 Returns : Hash


 Title   : iupac_iub
 Usage   : my %dnasymbols = $iupac->iupac_iub;
 Function: Returns a hash of DNA symbols -> non-ambiguous symbol components
 Args    : none
 Returns : Hash


 Title   : iupac_iub_amb
 Usage   : my %dnasymbols = $iupac->iupac_iub;
 Function: Returns a hash of DNA symbols -> ambiguous symbol components
 Args    : none
 Returns : Hash


 Title   : iupac_rev_iub
 Usage   : my %dnasymbols = $iupac->iupac_rev_iub;
 Function: Returns a hash of nucleotide combinations -> IUPAC code
           (a reverse of the iupac_iub hash).
 Args    : none
 Returns : Hash


 Title   : count
 Usage   : my $total = $iupac->count();
 Function: Calculates the number of unique, unambiguous sequences that
           this ambiguous sequence could generate
 Args    : none
 Return  : int


 Title   : regexp
 Usage   : my $re = $iupac->regexp();
 Function: Converts the ambiguous sequence into a regular expression that
           matches all of the corresponding ambiguous and non-ambiguous sequences.
           You can further manipulate the resulting regular expression with the
           Bio::Tools::SeqPattern module. After you are done building your
           regular expression, you might want to compile it and make it case-
              $re = qr/$re/i;
 Args    : 1 to match RNA: T and U characters will match interchangeably
 Return  : regular expression
syntax highlighting: