/** ** Copyright (c) 2007-2010 Illumina, Inc. ** ** This software is covered by the "Illumina Genome Analyzer Software ** License Agreement" and the "Illumina Source Code License Agreement", ** and certain third party copyright/licenses, and any user of this ** source file is bound by the terms therein (see accompanying files ** Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ** Illumina_Source_Code_License_Agreement.pdf and third party ** copyright/license notices). ** ** This file is part of the Consensus Assessment of Sequence And VAriation ** (CASAVA) software package. ** **/ #ifndef TRIMMER_H #define TRIMMER_H #include "TrimmerErrors.h" class CTrimmer { public: /**************************************************************************** Function: Default Constructor Arguments: None Globals: None ****************************************************************************/ CTrimmer() : m_Adaptor(0) , m_AdaptorLength(0) , m_Read(0) , m_ReadLength(0) , m_ScoreMatrix(0) , m_PathMatrix(0) , m_Reverser(0) {}; /**************************************************************************** Function: Destructor Description: Deallocates and resets all member variables. ****************************************************************************/ virtual ~CTrimmer(); /**************************************************************************** Function: Setup Description: Arguments: Input: Output: Globals: None ****************************************************************************/ int Setup(const char adaptorString[], // Null terminated string const int similarityMatrix[NSYMBOLS][NSYMBOLS]); /**************************************************************************** Function: Run Description: Arguments: Input: Output: Globals: None ****************************************************************************/ int Run(const char readString[], // Null terminated string int & suffixPosition, int & maxScore); /**************************************************************************** Function: GetMatch Description: Accessor Arguments: Input: Output: Globals: None ****************************************************************************/ const char * GetMatch() const; // Null terminated string private: int m_SimilarityMatrix[NSYMBOLS][NSYMBOLS]; // Wikipedia contributors, "Similarity matrix," Wikipedia, The Free Encyclopedia, // http://en.wikipedia.org/w/index.php?title=Similarity_matrix&oldid=160829209 /************************************************************************* * Enumeration of symbols: L, A, C, G, T, N * 0 = L (L is for lambda, the null character) * 1 = A * 2 = C * 3 = G * 4 = T * 5 = N *************************************************************************/ int * m_Adaptor; int m_AdaptorLength; int * m_Read; int m_ReadLength; int ** m_ScoreMatrix; unsigned char ** m_PathMatrix; char * m_Reverser; void getCode(const char anyString[], int * anyCode) const; int initAdaptor(const char adaptorString[]); // Null terminated string void initSimilarityMatrix(const int similarityMatrix[NSYMBOLS][NSYMBOLS]); int initScoreMatrix(); void makeScoreMatrix(); int getMaxScoreAndLocation(int & iMax, // m_ScoreMatrix[iMax, jMax] is a max element int & jMax) const; // along its outer boundary int getSuffixPosition(int i, // m_ScoreMatrix[i, j] is a max element int j); // along its outer boundary void deallocRun(); }; /* ******* */ /* Inlines */ /* ******* */ inline const char * CTrimmer::GetMatch() const {return m_Reverser;} #endif // TRIMMER_H