-// Helper functor to append created motifs to our Mussa analysis
-struct push_back_motif {
- std::set<Sequence>& motif_set;
- boost::shared_ptr<AnnotationColors> color_mapper;
- std::string& seq_string;
- std::string& name;
- float& red;
- float& green;
- float& blue;
- float& alpha;
-
- push_back_motif(std::set<Sequence>& motif_set_,
- boost::shared_ptr<AnnotationColors> color_mapper_,
- std::string& seq_,
- std::string& name_,
- float &red_, float &green_, float &blue_, float &alpha_)
- : motif_set(motif_set_),
- color_mapper(color_mapper_),
- seq_string(seq_),
- name(name_),
- red(red_),
- green(green_),
- blue(blue_),
- alpha(alpha_)
- {
- }
-
- void operator()(std::string::const_iterator,
- std::string::const_iterator) const
- {
- Sequence seq(seq_string);
- // shouldn't we have a better field than "fasta header" and speices?
- seq.set_fasta_header(name);
- // we need to clear the name in case the next motif doesn't have one.
- name.clear();
- // be nice if glsequence was a subclass of sequence so we could
- // just attach colors directly to the motif.
- Color c(red, green, blue);
- color_mapper->appendInstanceColor("motif", seq.c_str(), c);
- motif_set.insert(seq);
- };
-};
-
-// I mostly split the ifstream out so I can use a stringstream to test it.