All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class diana.sequence.AminoAcidSequence

java.lang.Object
   |
   +----diana.sequence.AminoAcidSequence

public class AminoAcidSequence
extends Object
Objects of this class represent a string of amino acids.

Version:
$Id: AminoAcidSequence.java,v 1.24 2003/11/18 14:38:16 kmr Exp $

Variable Index

 o amino_acid_symbol_count
The number of amino acid symbols, not including stop codons: 20.
 o codon_translation_array
This table is used for fast lookup of codon translations by getCodonTranslation ().
 o HYDROPHOBIC_AA
Used by getAminoAcidType ().
 o ILLEGAL_AA
Used by getAminoAcidType ().
 o NEGATIVELY_CHARGED_AA
Used by getAminoAcidType ().
 o POLAR_UNCHARGED_AA
Used by getAminoAcidType ().
 o POSITIVELY_CHARGED_AA
Used by getAminoAcidType ().
 o SPECIAL_AA
Used by getAminoAcidType ().
 o STOP_AA
Used by getAminoAcidType ().
 o symbol_count
The number of amino acid symbols, including stop codons and a symbol for unknown (---): 23.
 o UNKNOWN_AA
Used by getAminoAcidType ().

Constructor Index

 o AminoAcidSequence(String)
Create a new AminoAcidSequence object from a string containing single character amino acids symbols.

Method Index

 o checkForMatch(AminoAcidSequence)
Search the subject_sequence for this AminoAcidSequence as a substring.
 o containsStopCodon()
Return true if and only if this sequence contains a stop codon.
 o elementAt(int)
Return the one letter codon code of the codon at the given index (counting from zero).
 o findMatch(Bases, Marker, boolean)
Find the next occurrence of this seqeuence on either Strand of the given Bases object.
 o getAminoAcidType(char)
Returns one of POLAR_UNCHARGED_AA, POSITIVELY_CHARGED_AA, NEGATIVELY_CHARGED_AA, HYDROPHOBIC_AA, SPECIAL_AA or STOP_AA depending on the aa_char argument.
 o getCodonTranslation(char, char, char)
Translate a single codon into the corresponding single letter amino acid code.
 o getCodonTranslation(String)
Translate a single codon into the corresponding single letter amino acid code.
 o getMolecularWeight()
Return the total molecular weight of the amino acids in this AminoAcidSequence..
 o getOneLetterCode(String)
Return the one letter abbreviation for the given three letter amino acid name.
 o getSymbolFromIndex(int)
Given an index return a one letter codon symbol.
 o getSymbolIndex(char)
Return an integer from 0 to 22 representing the index of a codon symbol.
 o getThreeLetterAbbreviation(char)
Return the three letter abbreviation for the given one letter amino acid code.
 o getThreeLetterAbbreviation(int)
Return the three letter abbreviation for the given index code.
 o getTranslation(String, boolean)
Translate a sequence of bases into the corresponding single letter amino acid codes.
 o isLegalCodon(char)
Return true if and only if the given one letter code symbol is the a legal amino acid or stop symbol.
 o isStopCodon(char)
Return true if and only if the given amino acid symbol is the translation of a stop codon.
 o length()
Return the number of units in this amino acid sequence.
 o reverseComplementSearchBackwardFor(String, int)
Search backward for this AminoAcidSequence in the reverse complement of the given String of bases.
 o reverseComplementSearchFor(String, int, boolean)
Search for this AminoAcidSequence in the reverse complement of the given String of bases.
 o reverseComplementSearchForwardFor(String, int)
Search forward for this AminoAcidSequence in the reverse complement of the given String of bases.
 o searchBackwardFor(String, int)
Search backward for this AminoAcidSequence in the given String of bases.
 o searchFor(String, int, boolean)
Search for this AminoAcidSequence in the given String of bases.
 o searchForwardFor(String, int)
Search forward for this AminoAcidSequence in the given String of bases.
 o toString()
Return a string representation of this object.

Variables

 o codon_translation_array
 public static final char codon_translation_array[]
This table is used for fast lookup of codon translations by getCodonTranslation (). There is one entry for each codon and the entries are in this order: TTT, TTC, TTA, TTG, TCT, TCC, ...

 o POLAR_UNCHARGED_AA
 public static final int POLAR_UNCHARGED_AA
Used by getAminoAcidType ().

 o POSITIVELY_CHARGED_AA
 public static final int POSITIVELY_CHARGED_AA
Used by getAminoAcidType ().

 o NEGATIVELY_CHARGED_AA
 public static final int NEGATIVELY_CHARGED_AA
Used by getAminoAcidType ().

 o HYDROPHOBIC_AA
 public static final int HYDROPHOBIC_AA
Used by getAminoAcidType ().

 o SPECIAL_AA
 public static final int SPECIAL_AA
Used by getAminoAcidType ().

 o STOP_AA
 public static final int STOP_AA
Used by getAminoAcidType ().

 o UNKNOWN_AA
 public static final int UNKNOWN_AA
Used by getAminoAcidType ().

 o ILLEGAL_AA
 public static final int ILLEGAL_AA
Used by getAminoAcidType ().

 o symbol_count
 public static final int symbol_count
The number of amino acid symbols, including stop codons and a symbol for unknown (---): 23.

 o amino_acid_symbol_count
 public static final int amino_acid_symbol_count
The number of amino acid symbols, not including stop codons: 20.

Constructors

 o AminoAcidSequence
 public AminoAcidSequence(String amino_acid_string)
Create a new AminoAcidSequence object from a string containing single character amino acids symbols.

Methods

 o getTranslation
 public static AminoAcidSequence getTranslation(String bases,
                                                boolean unknown_is_x)
Translate a sequence of bases into the corresponding single letter amino acid codes.

Parameters:
bases - The bases to translated. If the string length is not a multiple of three the last codon is incomplete and will not be translated.
unknown_is_x - If this parameter is true codons that contain ambiguous bases will be translated as 'x', if false they will be translated as '.'
Returns:
The translated sequence in one letter abbreviated form.
 o getCodonTranslation
 public static char getCodonTranslation(String codon_string)
Translate a single codon into the corresponding single letter amino acid code.

Parameters:
codon_string - A three character lowercase String containing the bases to translate.
Returns:
The translated sequence in one letter abbreviated form. The return value will be '.' if the codon_string isn't a codon (eg. it contains more or less than three letters or the letters aren't from "CTAG")
 o getCodonTranslation
 public static char getCodonTranslation(char first_letter,
                                        char second_letter,
                                        char third_letter)
Translate a single codon into the corresponding single letter amino acid code.

Parameters:
first_letter - The first base of the codon.
second_letter - The second base of the codon.
third_letter - The third base of the codon.
Returns:
The translated sequence in one letter abbreviated form. The return value will be '.' if the letters do not form a codon.
 o length
 public int length()
Return the number of units in this amino acid sequence.

 o elementAt
 public char elementAt(int index)
Return the one letter codon code of the codon at the given index (counting from zero).

 o getMolecularWeight
 public float getMolecularWeight()
Return the total molecular weight of the amino acids in this AminoAcidSequence..

 o toString
 public String toString()
Return a string representation of this object. This string will contain the one character amino acid codes for each acid in sequence.

Overrides:
toString in class Object
 o checkForMatch
 public boolean checkForMatch(AminoAcidSequence subject_sequence)
Search the subject_sequence for this AminoAcidSequence as a substring. 'X' AAs are treated as wildcards in both sequences.

 o findMatch
 public MarkerRange findMatch(Bases bases,
                              Marker search_start_marker,
                              boolean search_backwards)
Find the next occurrence of this seqeuence on either Strand of the given Bases object. This method searches both strands simultaneously by searching the underlying Bases object directly.

Parameters:
bases - This holds the Strand objects to search.
search_start_marker - The match that will be returned will be after this base Marker position. Position 1 on the reverse strand is considered to be after position 1 on the forward strand, forward position 2 is after reverse position 1, reverse position 2 is after forward position 2, etc. This scheme allows the caller to iterate through all matches.
search_end_position - The search will not extend past this position.
search_backwards - If true the search will move from last base to first base, otherwise first to last.
Returns:
A MarkerRange covering the matching bases or null if there is no match in the given range.
 o searchFor
 public int searchFor(String bases_string,
                      int start_index,
                      boolean search_backwards)
Search for this AminoAcidSequence in the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
search_backwards - If true the search will move from last base to first base, otherwise first to last.
Returns:
The index of the match or -1 if there is no match.
 o searchForwardFor
 public int searchForwardFor(String bases_string,
                             int start_index)
Search forward for this AminoAcidSequence in the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
Returns:
The index of the match or -1 if there is no match.
 o searchBackwardFor
 public int searchBackwardFor(String bases_string,
                              int start_index)
Search backward for this AminoAcidSequence in the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
Returns:
The index of the match or -1 if there is no match.
 o reverseComplementSearchFor
 public int reverseComplementSearchFor(String bases_string,
                                       int start_index,
                                       boolean search_backwards)
Search for this AminoAcidSequence in the reverse complement of the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
search_backwards - If true the search will move from last base to first base, otherwise first to last.
Returns:
The index of the match or -1 if there is no match.
 o reverseComplementSearchForwardFor
 public int reverseComplementSearchForwardFor(String bases_string,
                                              int start_index)
Search forward for this AminoAcidSequence in the reverse complement of the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
Returns:
The index of the match or -1 if there is no match.
 o reverseComplementSearchBackwardFor
 public int reverseComplementSearchBackwardFor(String bases_string,
                                               int start_index)
Search backward for this AminoAcidSequence in the reverse complement of the given String of bases. The String is treated as a sequence of bases and this AminoAcidSequence is searched for in each of the three reading frames.

Parameters:
bases_string - Search this String for the amino acid sequence.
start_index - This is the index in bases_string where the search should start.
Returns:
The index of the match or -1 if there is no match.
 o containsStopCodon
 public boolean containsStopCodon()
Return true if and only if this sequence contains a stop codon.

 o isStopCodon
 public static boolean isStopCodon(char amino_acid_char)
Return true if and only if the given amino acid symbol is the translation of a stop codon. ie #, * or +.

 o isLegalCodon
 public static boolean isLegalCodon(char one_letter_code)
Return true if and only if the given one letter code symbol is the a legal amino acid or stop symbol.

 o getAminoAcidType
 public static int getAminoAcidType(char aa_char)
Returns one of POLAR_UNCHARGED_AA, POSITIVELY_CHARGED_AA, NEGATIVELY_CHARGED_AA, HYDROPHOBIC_AA, SPECIAL_AA or STOP_AA depending on the aa_char argument.

 o getOneLetterCode
 public static char getOneLetterCode(String three_letter_code)
Return the one letter abbreviation for the given three letter amino acid name.

Returns:
A one letter code or -1 if three_letter_code can't be understood.
 o getThreeLetterAbbreviation
 public static String getThreeLetterAbbreviation(char one_letter_code)
Return the three letter abbreviation for the given one letter amino acid code.

 o getThreeLetterAbbreviation
 public static String getThreeLetterAbbreviation(int index)
Return the three letter abbreviation for the given index code.

 o getSymbolIndex
 public static int getSymbolIndex(char one_letter_code)
Return an integer from 0 to 22 representing the index of a codon symbol.

 o getSymbolFromIndex
 public static char getSymbolFromIndex(int index)
Given an index return a one letter codon symbol. This method is the inverse of getSymbolIndex ().


All Packages  Class Hierarchy  This Package  Previous  Next  Index