Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# gnTranslator Class Reference

The gnTranslator class facilitates the translation of ambiguous DNA and RNA sequences to protein sequence. More...

`#include <gnTranslator.h>`

Inheritance diagram for gnTranslator::

List of all members.

## Public Types
enum | gnTranslatorType { ProteinDNATranslatorType, ProteinRNATranslatorType, DNAProteinTranslatorType, RNAProteinTranslatorType }
## Public Methods
| gnTranslator ()
| gnTranslator (gnTranslatorType t_type)
| gnTranslator (const gnTranslator &sf)
gnTranslator* | Clone () const
virtual gnSeqC | Filter (const gnSeqC ch) const
| Filter the given character. More...
virtual void | Filter (gnSeqC **seq, uint32 &len) const
| Filter the given character array. More...
virtual void | Filter (string &seq) const
| Filters the given string. More...
void | SetDefaultChar (const gnSeqC ch1)
| Sets the default character to insert when no valid translation exists. More...
gnSeqC | GetDefaultChar () const
| Gets the default character which is inserted into the destination sequence when no valid translation exists. More...
void | UseDefaultChar (const boolean use=true)
| Set whether the default character is inserted upon translation failure. More...
void | SetDefaultInputWidth (const uint32 defaultInputWidth)
| Set the expected number of characters in each unit of translation. More...
uint32 | GetDefaultInputWidth () const
| Get the expected number of characters in each unit of translation. More...
void | SetPair (const string &input, const string &output)
| Set a translation mapping. More...
void | RemovePair (const string &input)
| Removes a translation mapping. More...
void | SetCompare (const gnCompare *comp)
| Set the comparator to use. More...
## Static Public Methods
const gnTranslator* | ProteinDNATranslator ()
const gnTranslator* | ProteinRNATranslator ()
const gnTranslator* | DNAProteinTranslator ()
const gnTranslator* | RNAProteinTranslator ()
## Private Methods
void | CreateProteinDNATranslator ()
void | CreateProteinRNATranslator ()
void | CreateDNAProteinTranslator ()
void | CreateRNAProteinTranslator ()
## Private Attributes
string | m_name
vector<string> | m_inputTable
vector<string> | m_outputTable
const gnCompare* | compare
boolean | use_default
gnSeqC | m_defaultChar
uint32 | m_defaultInputWidth

## Detailed Description

The gnTranslator class facilitates the translation of ambiguous DNA and RNA sequences to protein sequence.

It can also perform reverse translation from Protein to RNA or DNA though the utility of this functionality is somewhat questionable since it does not assign nucleotides probabilistically. Do not attempt to instantiate this class unless you are defining a new translation type. Instead use the static member access functions ProteinDNATranslator(), ProteinRNATranslator(), DNAProteinTranslator(), and RNAProteinTranslator() In general, the gnFastTranslator class should be used instead of this one.

See also:
  gnFastTranslator

Definition at line 37 of file gnTranslator.h.

## Member Enumeration Documentation

enum gnTranslator::gnTranslatorType

  | Enumeration values:
  ProteinDNATranslatorType |
  ProteinRNATranslatorType |
  DNAProteinTranslatorType |
  RNAProteinTranslatorType |
Definition at line 46 of file gnTranslator.h.

## Constructor & Destructor Documentation

gnTranslator::gnTranslator ( | )

| Definition at line 35 of file gnTranslator.cpp. Referenced by Clone(), DNAProteinTranslator(), ProteinDNATranslator(), ProteinRNATranslator(), and RNAProteinTranslator().

gnTranslator::gnTranslator ( | gnTranslatorType t_type )

| Definition at line 52 of file gnTranslator.cpp.

gnTranslator::gnTranslator ( | const gnTranslator & sf )

| Definition at line 42 of file gnTranslator.cpp.

## Member Function Documentation

gnTranslator * gnTranslator::Clone ( | ) const`[inline, virtual]`

| Reimplemented from gnBaseFilter. Definition at line 137 of file gnTranslator.h.

void gnTranslator::CreateDNAProteinTranslator ( | )`[private]`

| Definition at line 225 of file gnTranslator.cpp. Referenced by gnTranslator().

void gnTranslator::CreateProteinDNATranslator ( | )`[private]`

| Definition at line 161 of file gnTranslator.cpp. Referenced by gnTranslator().

void gnTranslator::CreateProteinRNATranslator ( | )`[private]`

| Definition at line 193 of file gnTranslator.cpp. Referenced by gnTranslator().

void gnTranslator::CreateRNAProteinTranslator ( | )`[private]`

| Definition at line 288 of file gnTranslator.cpp. Referenced by gnTranslator().

const gnTranslator * gnTranslator::DNAProteinTranslator ( | )`[static]`

| Definition at line 25 of file gnTranslator.cpp. Referenced by main().

void gnTranslator::Filter ( | string & seq ) const`[virtual]`

  | Filters the given string. Parameters:
  seq | The string to filter
Reimplemented from gnBaseFilter. Definition at line 113 of file gnTranslator.cpp.

void gnTranslator::Filter ( | gnSeqC ** seq,
| uint32 & len ) const`[virtual]`

  | Filter the given character array. Parameters:
  seq | A pointer to the character array
  len | the length of the character array to filter
Returns: The filtered character Reimplemented from gnBaseFilter. Definition at line 82 of file gnTranslator.cpp.

gnSeqC gnTranslator::Filter ( | const gnSeqC ch ) const`[virtual]`

  | Filter the given character. Parameters:
  ch | The character to filter
Returns: The filtered character Reimplemented from gnBaseFilter. Definition at line 73 of file gnTranslator.cpp. Referenced by main().

gnSeqC gnTranslator::GetDefaultChar ( | ) const`[inline]`

  | Gets the default character which is inserted into the destination sequence when no valid translation exists. Parameters:
  ch1 | The default character
Definition at line 149 of file gnTranslator.h.

uint32 gnTranslator::GetDefaultInputWidth ( | ) const`[inline]`

| Get the expected number of characters in each unit of translation. For DNA to Protein, for instance, this is 3 because each codon is 3 characters of input. Returns: The expected input width Definition at line 166 of file gnTranslator.h.

const gnTranslator * gnTranslator::ProteinDNATranslator ( | )`[static]`

| Definition at line 17 of file gnTranslator.cpp.

const gnTranslator * gnTranslator::ProteinRNATranslator ( | )`[static]`

| Definition at line 21 of file gnTranslator.cpp.

const gnTranslator * gnTranslator::RNAProteinTranslator ( | )`[static]`

| Definition at line 29 of file gnTranslator.cpp.

void gnTranslator::RemovePair ( | const string & input )

  | Removes a translation mapping. RemovePair removes the translation mapping corresponding to the given input string. Parameters:
  input | The input string to delete
Definition at line 150 of file gnTranslator.cpp.

void gnTranslator::SetCompare ( | const gnCompare * comp )`[inline]`

  | Set the comparator to use. Ambiguous base matching is facilitated using a gnCompare object. This must be set to allow sequences to be compared. Parameters:
  comp | A pointer to the gnCompare object to use.
Definition at line 171 of file gnTranslator.h. Referenced by CreateDNAProteinTranslator(), CreateProteinDNATranslator(), CreateProteinRNATranslator(), and CreateRNAProteinTranslator().

void gnTranslator::SetDefaultChar ( | const gnSeqC ch1 )`[inline]`

  | Sets the default character to insert when no valid translation exists. Parameters:
  ch1 | The default character
Definition at line 143 of file gnTranslator.h. Referenced by CreateDNAProteinTranslator(), CreateProteinDNATranslator(), CreateProteinRNATranslator(), and CreateRNAProteinTranslator().

void gnTranslator::SetDefaultInputWidth ( | const uint32 defaultInputWidth )`[inline]`

  | Set the expected number of characters in each unit of translation. For DNA to Protein, for instance, this is 3 because each codon is 3 characters of input. Parameters:
  The | expected input width
Definition at line 161 of file gnTranslator.h.

void gnTranslator::SetPair ( | const string & input,
| const string & output )

  | Set a translation mapping. The first value is the input, the second value is the output. During translation, any occurrences of the first string will be transformed to the second string. A gnCompare object is used to facilitate ambiguity matching. Parameters:
  input | The input string
  output | The string to output every time the input string is encountered
Definition at line 141 of file gnTranslator.cpp. Referenced by CreateDNAProteinTranslator(), CreateProteinDNATranslator(), CreateProteinRNATranslator(), and CreateRNAProteinTranslator().

void gnTranslator::UseDefaultChar ( | const boolean use = true )`[inline]`

  | Set whether the default character is inserted upon translation failure. Parameters:
  use | True if the default character should be used.
Definition at line 155 of file gnTranslator.h.

## Member Data Documentation

const gnCompare * gnTranslator::compare`[private]`

| Definition at line 129 of file gnTranslator.h.

gnSeqC gnTranslator::m_defaultChar`[private]`

| Definition at line 132 of file gnTranslator.h.

uint32 gnTranslator::m_defaultInputWidth`[private]`

| Definition at line 133 of file gnTranslator.h.

vector< string > gnTranslator::m_inputTable<string>`[private]`

| Definition at line 127 of file gnTranslator.h.

string gnTranslator::m_name`[private]`

| Reimplemented from gnBaseFilter. Definition at line 123 of file gnTranslator.h.

vector< string > gnTranslator::m_outputTable`[private]`

| Definition at line 127 of file gnTranslator.h.

boolean gnTranslator::use_default`[private]`

| Definition at line 131 of file gnTranslator.h.

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

- gnTranslator.h
- gnTranslator.cpp