-// Helper functor to append created motifs to our Mussa analysis
-struct push_back_motif {
- Mussa::motif_set& motifs;
- boost::shared_ptr<AnnotationColors> color_mapper;
- std::string& seq_string;
- std::string& name;
- float& red;
- float& green;
- float& blue;
- float& alpha;
- int& parsed;
-
- push_back_motif(Mussa::motif_set& motifs_,
- boost::shared_ptr<AnnotationColors> color_mapper_,
- std::string& seq_,
- std::string& name_,
- float &red_, float &green_, float &blue_, float &alpha_,
- int &parsed_)
- : motifs(motifs_),
- color_mapper(color_mapper_),
- seq_string(seq_),
- name(name_),
- red(red_),
- green(green_),
- blue(blue_),
- alpha(alpha_),
- parsed(parsed_)
- {
- }
-
- void operator()(std::string::const_iterator,
- std::string::const_iterator) const
- {
- Sequence seq(seq_string, Sequence::nucleic_alphabet);
- // 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, alpha);
- color_mapper->appendInstanceColor("motif", seq.c_str(), c);
- alpha = 1.0;
- motifs.insert(seq);
- ++parsed;
- };
-};
-