}
}
+void FLPs::validate_sequence(const Sequence& seq) const
+{
+ if (seq.size() < window_size) {
+ ostringstream msg;
+ msg << "Sequence " << seq.get_name() << " of length " << seq.size()
+ << " must be longer than window size " << window_size;
+ throw seqcomp_error(msg.str());
+ }
+}
void
FLPs::seqcomp(const Sequence& sseq1, const Sequence& sseq2, bool is_RC)
int start_i, seq1_i, seq2_i, win_i; // loop variables
int matches; // number of matches in to a window
int i2_offset;
- Sequence::const_iterator seq1 = sseq1.begin();
- Sequence::const_iterator seq2 = sseq2.begin();
-
- int seq1_win_num = sseq1.size() - window_size + 1;
- int seq2_win_num = sseq2.size() - window_size + 1;
+ std::string sseq1_str(sseq1.get_sequence());
+ std::string sseq2_str(sseq2.get_sequence());
+ const char *seq1 = sseq1_str.c_str();
+ const char *seq2 = sseq2_str.c_str();
+
+ validate_sequence(sseq1);
+ validate_sequence(sseq2);
+
+ size_type seq1_win_num = sseq1.size() - window_size + 1;
+ size_type seq2_win_num = sseq2.size() - window_size + 1;
alloc_matches(sseq1.size());
if (seq1_win_num != size()) {
ostringstream msg;