//! indicate which elements of the path are reversed
std::vector<bool> reverseComplimented() const;
//! return the list of indexes normalized (to the left)
- std::vector<path_element> normalizedIndexes() const;
+ path_type normalizedIndexes() const;
//! extend our current path
//! (aka increment our window size by growth)
ConservedPath& extend(int growth=1);
//! either number of conserved bases or average entropy
double score;
//! offsets into each of our sequences representing the start of our window
- std::vector<path_element> track_indexes;
+ path_type track_indexes;
};
#endif
}
static void
-local_align_test(const Mussa::vector_sequence_type &seqs,
- const list<ConservedPath::path_type>& result,
- const list<vector<bool> >& reversed)
+two_way_local_align_test(const Mussa::vector_sequence_type &seqs,
+ const list<ConservedPath::path_type>& result,
+ const list<vector<bool> >& reversed)
{
map<char, vector <char> > m;
assign::insert(m)('A', assign::list_of('A')('T') )
BOOST_CHECK_EQUAL( first_basepair, complimented_second) ;
}
}
-
-BOOST_AUTO_TEST_CASE( local_alignment )
+BOOST_AUTO_TEST_CASE( two_way_local_alignment )
{
string s0("GCGCATAT");
string s1("AAAAAAAT");
analysis.set_window(4);
analysis.analyze();
NwayPaths npath = analysis.paths();
+ BOOST_REQUIRE_EQUAL( npath.pathz.size(), 2 );
+
list<ConservedPath::path_type> result;
list<vector<bool> > reversed;
list<ConservedPath>::iterator pathz_i = npath.pathz.begin();
result,
reversed);
- local_align_test(analysis.sequences(), result, reversed);
+ two_way_local_align_test(analysis.sequences(), result, reversed);
++pathz_i;
result.clear();
selected_paths.end(),
result,
reversed);
- local_align_test(analysis.sequences(), result, reversed);
-
+ two_way_local_align_test(analysis.sequences(), result, reversed);
+}
+BOOST_AUTO_TEST_CASE( three_way_local_alignment )
+{
+ string s0("AGCAGGGAGGGTTTAAATGGCACCCAGCAGTTGGTGTGAGG");
+ string s1("AGCGGGAAGGGTTTAAATGGCACCGGGCAGTTGGCGTGAGG");
+ string s2("CAGCGCCGGGGTTTAAATGGCACCGAGCAGTTGGCGCAGGG");
+
+ Mussa analysis;
+ analysis.append_sequence(s0);
+ analysis.append_sequence(s1);
+ analysis.append_sequence(s2);
+ analysis.set_threshold(23);
+ analysis.set_window(30);
+ analysis.analyze();
+ NwayPaths npath = analysis.paths();
+ BOOST_CHECK_EQUAL( npath.refined_pathz.size(), 1 );
+
+ list<ConservedPath::path_type> result;
+ list<vector<bool> > reversed;
+ // grab 1 path (since there's only one)
+ list<ConservedPath>::iterator pathz_i = npath.pathz.begin();
+ list<ConservedPath> selected_paths;
+ selected_paths.push_back(*pathz_i);
+ analysis.createLocalAlignment(selected_paths.begin(),
+ selected_paths.end(),
+ result,
+ reversed);
+
+ for(std::list<ConservedPath::path_type>::iterator result_i = result.begin();
+ result_i != result.end();
+ ++result_i)
+ {
+ std::cout << "path ";
+ ConservedPath::path_element first_element = *(result_i->begin());
+ for (ConservedPath::path_type::iterator element_i = result_i->begin();
+ element_i != result_i->end();
+ ++element_i)
+ {
+ BOOST_CHECK_EQUAL( *element_i, first_element );
+ BOOST_CHECK_EQUAL( s0[*element_i], s1[*element_i] );
+ BOOST_CHECK_EQUAL( s1[*element_i], s2[*element_i] );
+ BOOST_CHECK_EQUAL( s0[*element_i], s2[*element_i] );
+ std::cout << *element_i << " " << s0[*element_i];
+ }
+ std::cout << std::endl;
+ }
}
BOOST_AUTO_TEST_CASE( subanalysis )