#include <MatchAligner.h>
Inheritance diagram for MatchAlignerTranslatedProtein:


Public Member Functions | |
| MatchAlignerTranslatedProtein (int isQueryProtein=true, int numCols=80, int bandExtension=0, ostream &outputStream=cout) | |
| virtual void | formatAlignment (Alignment &alignment, const char *pQuery, int queryStart, int queryEnd, const char *pSubject, int subjectStart, int subjectEnd) |
Definition at line 338 of file MatchAligner.h.
| MatchAlignerTranslatedProtein::MatchAlignerTranslatedProtein | ( | int | isQueryProtein = true, |
|
| int | numCols = 80, |
|||
| int | bandExtension = 0, |
|||
| ostream & | outputStream = cout | |||
| ) |
Definition at line 675 of file MatchAligner.cpp.
00678 : 00679 MatchAlignerTranslated( numCols, 00680 bandExtension, 00681 isQueryProtein, 00682 !isQueryProtein, 00683 outputStream ) 00684 { 00685 } // ~MatchAlignerTranslatedProtein::MatchAlignerTranslatedProtein
| void MatchAlignerTranslatedProtein::formatAlignment | ( | Alignment & | alignment, | |
| const char * | pQuery, | |||
| int | queryStart, | |||
| int | queryEnd, | |||
| const char * | pSubject, | |||
| int | subjectStart, | |||
| int | subjectEnd | |||
| ) | [virtual] |
Reimplemented from MatchAligner.
Definition at line 691 of file MatchAligner.cpp.
References alignBreakFrameShiftQuery, alignBreakFrameShiftSubject, alignBreakGapQuery, alignBreakGapSubject, alignBreakMismatch, MatchAligner::matchChar(), MatchAligner::numCols_, MatchAligner::outputAlignmentColumn(), MatchAligner::outputAlignmentLine(), MatchAligner::outputStream_, MatchAligner::pBufSeq1_, MatchAligner::pCursorAlign_, MatchAligner::pCursorSeq1_, MatchAligner::pCursorSeq2_, and Alignment::totalScore_.
00694 { 00695 00696 outputStream_ << "Alignment score: " << alignment.totalScore_ << endl; 00697 00698 int queryNext(queryStart), subjectNext(subjectStart); 00699 int* pProteinNext; 00700 int* pDNANext; 00701 00702 const char* pProteinChar; 00703 const char* pDNAChar; 00704 00705 char queryChar, subjectChar, matchChar, codonChar; 00706 00707 char* pProteinOut; 00708 char* pDNAOut; 00709 00710 AlignBreakType proteinGap, DNAGap, DNAFrameShift; 00711 00712 00713 if (isQueryProtein_) 00714 { 00715 pProteinNext = &queryNext; 00716 pDNANext = &subjectNext; 00717 pProteinChar = pQuery; 00718 pDNAChar = pSubject; 00719 pProteinOut = &queryChar; 00720 pDNAOut = &subjectChar; 00721 proteinGap = alignBreakGapQuery; 00722 DNAGap = alignBreakGapSubject; 00723 DNAFrameShift = alignBreakFrameShiftSubject; 00724 } // ~if 00725 else 00726 { 00727 pProteinNext = &subjectNext; 00728 pDNANext = &queryNext; 00729 pProteinChar = pSubject; 00730 pDNAChar = pQuery; 00731 pProteinOut = &subjectChar; 00732 pDNAOut = &queryChar; 00733 proteinGap = alignBreakGapSubject; 00734 DNAGap = alignBreakGapQuery; 00735 DNAFrameShift = alignBreakFrameShiftQuery; 00736 } // ~else 00737 00738 pCursorSeq1_ = &pBufSeq1_[numCols_]; // triggers reset to start of line 00739 00740 *pBufSeq1_='\0'; // ensures 3 null strings are printed at first line break 00741 00742 Alignment::iterator i(alignment.begin()); 00743 00744 while( i!=alignment.end() ) 00745 { 00746 // cout << queryNext << " " << subjectNext << endl; 00747 00748 if (i->numMatches>0) 00749 { 00750 codonChar = getCodon( pDNAChar ); 00751 matchChar = (codonChar==toupper(*pProteinChar)) ? '|' : 'x'; 00752 codonChar = (matchChar=='|') ? '|' : codonChar; 00753 00754 // matchChar = (gResidueNames[ ttCodon[ ttDNA[ *(pDNAChar) ] << 4 00755 // | ttDNA[ *(pDNAChar+1) ] << 2 00756 // | ttDNA[ *(pDNAChar+2) ] ] ] 00757 // == toupper(*pProteinChar)) 00758 // ? '|' : 'x'; 00759 00760 00761 *pProteinOut = *(pProteinChar++); 00762 *pDNAOut = *(pDNAChar++); 00763 00764 outputAlignmentColumn 00765 (queryChar, codonChar, subjectChar, queryNext, subjectNext ); 00766 (*pProteinNext)++; 00767 (*pDNANext)++; 00768 00769 *pProteinOut = '.'; 00770 *pDNAOut = *(pDNAChar++); 00771 outputAlignmentColumn 00772 (queryChar, matchChar, subjectChar, queryNext, subjectNext ); 00773 (*pDNANext)++; 00774 00775 *pDNAOut = *(pDNAChar++); 00776 outputAlignmentColumn 00777 (queryChar, matchChar, subjectChar, queryNext, subjectNext ); 00778 (*pDNANext)++; 00779 00780 00781 i->numMatches--; 00782 } 00783 else 00784 { 00785 #ifdef XXX 00786 if (i->breakType==alignBreakMismatch) 00787 { 00788 // outputAlignmentColumn 00789 // (*(pQuery++), 'x', *(pSubject++), queryNext++, subjectNext++ ); 00790 *pProteinOut = *(pProteinChar++); 00791 *pDNAOut = *(pDNAChar++); 00792 outputAlignmentColumn 00793 (queryChar, 'x', subjectChar, queryNext++, subjectNext++ ); 00794 00795 *pProteinOut = '.'; 00796 *pDNAOut = *(pDNAChar++); 00797 outputAlignmentColumn 00798 (queryChar, 'x', subjectChar, queryNext++, subjectNext++ ); 00799 00800 *pDNAOut = *(pDNAChar++); 00801 outputAlignmentColumn 00802 (queryChar, 'x', subjectChar, queryNext++, subjectNext++ ); 00803 00804 } // ~if 00805 else 00806 #endif 00807 if (i->breakType==DNAFrameShift) 00808 { 00809 *pProteinOut = '-'; 00810 *pDNAOut = *(pDNAChar++); 00811 outputAlignmentColumn 00812 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00813 queryNext += 1 * (!isQueryProtein_); 00814 subjectNext += 1 * ( isQueryProtein_); 00815 00816 } // ~else if 00817 else if (i->breakType==proteinGap) 00818 { 00819 00820 *pProteinOut = '-'; 00821 *pDNAOut = *(pDNAChar++); 00822 outputAlignmentColumn 00823 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00824 queryNext += 1 * (!isQueryProtein_); 00825 subjectNext += 1 * ( isQueryProtein_); 00826 00827 *pDNAOut = *(pDNAChar++); 00828 outputAlignmentColumn 00829 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00830 queryNext += 1 * (!isQueryProtein_); 00831 subjectNext += 1 * ( isQueryProtein_); 00832 00833 *pDNAOut = *(pDNAChar++); 00834 outputAlignmentColumn 00835 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00836 queryNext += 1 * (!isQueryProtein_); 00837 subjectNext += 1 * ( isQueryProtein_); 00838 00839 } // ~else if 00840 else if (i->breakType==DNAGap) 00841 { 00842 00843 *pProteinOut = *(pProteinChar++); 00844 *pDNAOut = '-'; 00845 00846 outputAlignmentColumn 00847 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00848 queryNext += 1 * (isQueryProtein_); 00849 subjectNext += 1 * (!isQueryProtein_); 00850 00851 *pProteinOut = '.'; 00852 outputAlignmentColumn 00853 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00854 outputAlignmentColumn 00855 (queryChar, ' ', subjectChar, queryNext, subjectNext ); 00856 00857 } // ~else if 00858 i++; 00859 } // ~else 00860 00861 } // ~while 00862 00863 *pCursorSeq1_='\0'; 00864 *pCursorSeq2_='\0'; 00865 *pCursorAlign_='\0'; 00866 00867 outputAlignmentLine(); 00868 00869 00870 } // ~void MatchAlignerTranslatedProtein::formatAlignment
Here is the call graph for this function:

1.5.2