00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _GappedAligner_h_
00010 #define _GappedAligner_h_
00011
00012 #ifdef HAVE_CONFIG_H
00013 #include "config.h"
00014 #endif
00015
00016 #include "libGenome/gnSequence.h"
00017 #include "libMems/GappedAlignment.h"
00018 #include "libMems/Match.h"
00019
00020 namespace mems {
00021
00022 class GappedAligner {
00023 public:
00024 GappedAligner(){ max_alignment_length = 10000; }
00025 GappedAligner& operator=( const GappedAligner& ga )
00026 {
00027 max_alignment_length = ga.max_alignment_length;
00028 return *this;
00029 }
00035 void SetMaxAlignmentLength( gnSeqI len ){max_alignment_length = len;}
00036 virtual boolean Align( GappedAlignment& cr, Match* r_begin, Match* r_end, std::vector< genome::gnSequence* >& seq_table ) = 0;
00037 protected:
00038 gnSeqI max_alignment_length;
00039 };
00040
00041
00042
00043
00044
00045 boolean getInterveningCoordinates( std::vector< genome::gnSequence* >& seq_table, Match* r_begin, Match* r_end, uint seqI, int64& gap_lend, int64& gap_rend );
00046
00047 inline
00048 boolean getInterveningCoordinates( std::vector< genome::gnSequence* >& seq_table, Match* r_begin, Match* r_end, uint seqI, int64& gap_lend, int64& gap_rend ){
00049
00050 if( (r_end != NULL && r_end->Start( seqI ) == NO_MATCH) ||
00051 (r_begin != NULL && r_begin->Start( seqI ) == NO_MATCH) ){
00052 gap_lend = 0;
00053 gap_rend = 0;
00054 return true;
00055 }
00056
00057
00058 gap_rend = r_end != NULL ? r_end->Start( seqI ) : seq_table[ seqI ]->length() + 1;
00059 gap_lend = r_begin != NULL ? r_begin->End( seqI ) + 1 : 1;
00060 if( gap_rend < 0 || gap_lend < 0 ){
00061 gap_rend = r_begin != NULL ? -r_begin->Start( seqI ) : seq_table[ seqI ]->length() + 1;
00062 gap_lend = r_end != NULL ? -r_end->Start( seqI ) + r_end->Length() : 1;
00063 }
00064 if( gap_rend <= 0 || gap_lend <= 0 ){
00065
00066 genome::ErrorMsg( "Error constructing intervening coordinates" );
00067 }
00068 return true;
00069 }
00070
00071 }
00072
00073 #endif // _GappedAligner_h_