gnTranslator.h Source File

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

# gnTranslator.h

Go to the documentation of this file.

    00001
    00002 // File:            gnTranslator.h
    00003 // Purpose:         Translator for all Sequences
    00004 // Description:     Translates DNA and protein sequences
    00005 // Changes:
    00006 // Version:         libGenome 0.1.0
    00007 // Author:          Aaron Darling
    00008 // Last Edited:     April 15, 2001, 10:34:50pm
    00009 // Modified by:
    00010 // Copyright:       (c) Aaron Darling
    00011 // Licenses:        Proprietary
    00013 #ifndef _gnTranslator_h_
    00014 #define _gnTranslator_h_
    00015
    00016
    00017 #include "gn/gnDefs.h"
    00018
    00019 #include <string>
    00020 #include <vector>
    00021 #include "gn/gnClone.h"
    00022 #include "gn/gnBaseFilter.h"
    00023 #include "gn/gnCompare.h"
    00024
    00025
    00037 class GNDLLEXPORT gnTranslator : public gnBaseFilter
    00038 {
    00039 public:
    00040
    00041         static const gnTranslator *ProteinDNATranslator();
    00042         static const gnTranslator *ProteinRNATranslator();
    00043         static const gnTranslator *DNAProteinTranslator();
    00044         static const gnTranslator *RNAProteinTranslator();
    00045
    00046         enum gnTranslatorType{
    00047                 ProteinDNATranslatorType,
    00048                 ProteinRNATranslatorType,
    00049                 DNAProteinTranslatorType,
    00050                 RNAProteinTranslatorType,
    00051         };
    00052
    00053         gnTranslator();
    00054         gnTranslator( gnTranslatorType t_type );
    00055         gnTranslator( const gnTranslator& sf );
    00056
    00057         gnTranslator* Clone() const;
    00058
    00059         // gnSeqC
    00060         virtual gnSeqC Filter( const gnSeqC ch ) const;
    00061
    00062         virtual void Filter( gnSeqC** seq, uint32& len ) const;
    00063         // string
    00064         virtual void Filter( string &seq ) const;
    00065
    00066         // Default gnSeqC
    00071         void SetDefaultChar( const gnSeqC ch1 );
    00077         gnSeqC GetDefaultChar() const;
    00082         void UseDefaultChar( const boolean use = true);
    00088         void SetDefaultInputWidth( const uint32 defaultInputWidth);
    00094         uint32 GetDefaultInputWidth() const;
    00095
    00096         // fill map
    00104         void SetPair( const string& input, const string& output );
    00110         void RemovePair( const string& input );
    00116         void SetCompare( const gnCompare* comp );
    00117 private:
    00118         void CreateProteinDNATranslator();
    00119         void CreateProteinRNATranslator();
    00120         void CreateDNAProteinTranslator();
    00121         void CreateRNAProteinTranslator();
    00122
    00123         string m_name;
    00124
    00125         //for each entry in the input table there is a corresponding
    00126         //entry in the output table.
    00127         vector<string> m_inputTable, m_outputTable;
    00128
    00129         const gnCompare* compare;
    00130
    00131         boolean use_default;
    00132         gnSeqC m_defaultChar;
    00133         uint32 m_defaultInputWidth;
    00134 };//class gnTranslator
    00135
    00136 inline
    00137 gnTranslator* gnTranslator::Clone() const
    00138 {
    00139         return new gnTranslator(*this);
    00140 }
    00141
    00142 inline
    00143 void gnTranslator::SetDefaultChar( const gnSeqC ch1 )
    00144 {
    00145         m_defaultChar = ch1;
    00146         use_default = true;
    00147 }
    00148 inline
    00149 gnSeqC gnTranslator::GetDefaultChar() const
    00150 {
    00151         return m_defaultChar;
    00152 }
    00153
    00154 inline
    00155 void gnTranslator::UseDefaultChar(const boolean use)
    00156 {
    00157         use_default = use;
    00158 }
    00159
    00160 inline
    00161 void gnTranslator::SetDefaultInputWidth( const uint32 defaultInputWidth){
    00162         m_defaultInputWidth = defaultInputWidth;
    00163 }
    00164
    00165 inline
    00166 uint32 gnTranslator::GetDefaultInputWidth() const{
    00167         return m_defaultInputWidth;
    00168 }
    00169
    00170 inline
    00171 void gnTranslator::SetCompare( const gnCompare* comp ){
    00172         compare = comp;
    00173 }
    00174
    00175 #endif // _gnTranslator_h_