gnPosSpecificTranslator.h Source File

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

# gnPosSpecificTranslator.h

Go to the documentation of this file.

    00001 /////////////////////////////////////////////////////////////////////////////
    00002 // File:            gnPosSpecificTranslator.h
    00003 // Purpose:         Special case ORF translation
    00004 // Description:     Used to translate sequences differently based on the position of
    00005 //                                      input characters.  Useful for tranlating genes because the first
    00006 //                                      codon is translated differently
    00007 // Changes:
    00008 // Version:         libGenome 0.5.1
    00009 // Author:          Aaron Darling
    00010 // Modified by:
    00011 // Copyright:       (c) Aaron Darling
    00012 // Licenses:        See COPYING file for details
    00013 /////////////////////////////////////////////////////////////////////////////
    00014 #ifndef _gnPosSpecificTranslator_h_
    00015 #define _gnPosSpecificTranslator_h_
    00016
    00017
    00018 #include "gn/gnDefs.h"
    00019
    00020 #include <string>
    00021 #include <vector>
    00022 #include <map>
    00023 #include "gn/gnClone.h"
    00024 #include "gn/gnBaseFilter.h"
    00025 #include "gn/gnFastTranslator.h"
    00026
    00027 /**
    00028  * Used to translate sequences differently based on the position of
    00029  * input characters.  Useful for tranlating genes because the first
    00030  * codon is translated differently.
    00031  */
    00032 class GNDLLEXPORT gnPosSpecificTranslator : public gnBaseFilter
    00033 {
    00034 public:
    00035
    00036         static const gnPosSpecificTranslator *ProteinDNATranslator();
    00037         static const gnPosSpecificTranslator *DNAProteinTranslator();
    00038
    00039         enum gnTranslatorType{
    00040                 ProteinDNATranslatorType,
    00041                 DNAProteinTranslatorType,
    00042         };
    00043
    00044         gnPosSpecificTranslator();
    00045         gnPosSpecificTranslator( gnTranslatorType t_type );
    00046         gnPosSpecificTranslator( const gnPosSpecificTranslator& sf );
    00047         gnPosSpecificTranslator& operator= (const gnPosSpecificTranslator& sf);
    00048         gnPosSpecificTranslator* Clone() const;
    00049
    00050
    00051         // gnSeqC
    00052         virtual gnSeqC Filter( const gnSeqC ch ) const;
    00053
    00054         virtual void Filter( gnSeqC** seq, uint32& len ) const;
    00055         // string
    00056         virtual void Filter( string &seq ) const;
    00057
    00058 private:
    00059         gnTranslatorType m_type;        // defines the type of translator this is
    00060         const gnBaseFilter* filter;             // this is the filter used to do the translation
    00061         void CreateProteinDNATranslator();
    00062         void CreateDNAProteinTranslator();
    00063
    00064 };//class gnPosSpecificTranslator
    00065
    00066 inline
    00067 gnPosSpecificTranslator* gnPosSpecificTranslator::Clone() const
    00068 {
    00069         return new gnPosSpecificTranslator(*this);
    00070 }
    00071
    00072 #endif // _gnPosSpecificTranslator_h_