//the_paths.save("tmp.save");
}
-void Mussa::add_motif(const string& motif, const Color& color)
+void Mussa::add_motif(const Sequence& motif, const Color& color)
{
motif_sequences.insert(motif);
color_mapper->appendInstanceColor("motif", motif, color);
}
-void Mussa::set_motifs(const vector<string>& motifs,
+void Mussa::set_motifs(const vector<Sequence>& motifs,
const vector<Color>& colors)
{
if (motifs.size() != colors.size()) {
// clear out old motifs
(*seq_i)->clear_motifs();
// for all the motifs in our set, attach them to the current sequence
- for(set<string>::iterator motif_i = motif_sequences.begin();
+ for(set<Sequence>::iterator motif_i = motif_sequences.begin();
motif_i != motif_sequences.end();
++motif_i)
{
}
}
-const set<string>& Mussa::motifs() const
+const set<Sequence>& Mussa::motifs() const
{
return motif_sequences;
}
// manage motif lists
//! add a motif it wont be applied until update_sequences_motif is called
- void add_motif(const std::string& motifs, const Color& colors);
+ void add_motif(const Sequence& motifs, const Color& colors);
//! add vector of motifs and colors to our motif collection
/*! this will automatically call update_sequences_motif
* this depends on sets and color maps being unique
* (aka if you add the same item more than once it doesn't
* increase the size of the data structure)
*/
- void set_motifs(const std::vector<std::string>& motifs,
+ void set_motifs(const std::vector<Sequence>& motifs,
const std::vector<Color>& colors);
//! load motifs from an ifstream
/*! The file should look something like
//! load a list of motifs from a file named filename
void load_motifs(boost::filesystem::path filename);
//! return our motifs;
- const std::set<std::string>& motifs() const;
+ const std::set<Sequence>& motifs() const;
//! return color mapper
boost::shared_ptr<AnnotationColors> colorMapper();
NwayPaths the_paths;
//! motif list
- std::set<std::string> motif_sequences;
+ std::set<Sequence> motif_sequences;
//! color manager
boost::shared_ptr<AnnotationColors> color_mapper;
return valid_motif;
}
-void Sequence::add_motif(std::string a_motif)
+void Sequence::add_motif(const Sequence& a_motif)
{
std::vector<int> motif_starts = find_motif(a_motif);
std::string get_header() const;
//! add a motif to our list of motifs
//! \throws motif_normalize_error if there's something wrong with a_motif
- void add_motif(std::string a_motif);
+ void add_motif(const Sequence& a_motif);
//! clear our list of found motifs
void clear_motifs();
//! search a sequence for a_motif
BOOST_AUTO_TEST_CASE( mussa_add_motif )
{
- vector<string> motifs;
+ vector<Sequence> motifs;
motifs.push_back("AAGG");
vector<Color> colors;
colors.push_back(Color(1.0, 0.0, 0.0));
s1.clear_motifs();
BOOST_CHECK( s1.motifs().begin() == s1.motifs().end() );
+
+ /* FIXME: enable this when i find a way of passing storing the motif name
+ // does our annotation travel?
+ Sequence motif_seq(m);
+ motif_seq.set_header("hi");
+ s1.add_motif(motif_seq);
+
+ BOOST_CHECK_EQUAL(s1.motifs().size(), 2);
+ for(motif_i = s1.motifs().begin();
+ motif_i != s1.motifs().end();
+ ++motif_i)
+ {
+ BOOST_CHECK_EQUAL( motif_i->type, "motif" );
+ BOOST_CHECK_EQUAL( motif_i->name, "hi");
+ BOOST_CHECK_EQUAL( motif_i->sequence, m);
+ }
+ */
}
BOOST_AUTO_TEST_CASE( annot_test )
applyButton("set motifs")
{
assert (m != 0);
- const set<string> &motif = analysis->motifs();
+ const set<Sequence> &motif = analysis->motifs();
vector<string> motif_seq(motif.begin(), motif.end());
connect(&applyButton, SIGNAL(clicked()), this, SLOT(updateMotifs()));
analysis->colorMapper()->appendTypeColor("motif", motif_default);
// add our motifs back
- vector<string> motifs;
+ vector<Sequence> motifs;
vector<Color> colors;
for(std::vector<MotifDetail *>::iterator md_i = motif_details.begin();
++md_i)
{
if ((*md_i)->motif().size() > 0 && (*md_i)->enabled()) {
+ Sequence new_motif((*md_i)->motif());
+ new_motif.set_header((*md_i)->name());
motifs.push_back((*md_i)->motif());
colors.push_back((*md_i)->color());
}