#include <stdexcept>
using namespace std;
-GlSequence::GlSequence(const Sequence &s)
+GlSequence::GlSequence(const Sequence &s, AnnotationColors& cm)
: seq(s),
seq_x(0.0),
seq_y(0.0),
seq_z(1.0),
seq_height(12.0),
+ color_mapper(cm),
drawColor(0.0, 0.0, 0.0),
char_pix_per_world_unit(5.0)
{
}
-GlSequence::GlSequence(const GlSequence &s)
+GlSequence::GlSequence(const GlSequence &s)
: seq(s.seq),
seq_x(s.seq_x),
seq_y(s.seq_y),
seq_z(s.seq_z),
seq_height(s.seq_height),
+ color_mapper(s.color_mapper),
drawColor(s.drawColor),
char_pix_per_world_unit(s.char_pix_per_world_unit)
{
seq_y = s.seq_y;
seq_z = s.seq_z;
seq_height = s.seq_height;
+ color_mapper = s.color_mapper;
drawColor = s.drawColor;
assert(char_pix_per_world_unit == s.char_pix_per_world_unit);
}
// draw annotations
glLineWidth(seq_height);
GLfloat annotation_z = seq_z + 1.0;
- std::list<annot> annots = seq.annotations();
+ const std::list<annot>& annots = seq.annotations();
+ const std::list<motif>& motifs = seq.motifs();
for (std::list<annot>::const_iterator annot_itor = annots.begin();
annot_itor != annots.end();
++annot_itor, ++annotation_z)
draw_box(seq_x+annot_itor->start, seq_x+annot_itor->end,
seq_height, annotation_z);
}
+ // if motifs?
+ for (std::list<motif>::const_iterator motifs_itor = motifs.begin();
+ motifs_itor != motifs.end();
+ ++motifs_itor, ++annotation_z)
+ {
+ glColor3fv(color_mapper.lookup("motif", motifs_itor->sequence).get());
+ draw_box(seq_x+motifs_itor->start, seq_x+motifs_itor->end,
+ seq_height, annotation_z);
+ }
+
}
+
const int PT = 1;
const int STROKE = 2;
const int END =3;