Since Mussa forces all annotations to be at least 1 pixel, marking where the real
sequence is located is visually clearer.
void GlSeqBrowser::push_sequence(GlSequenceRef gs)
{
GlSequenceRef new_gs(new GlSequence(gs));
- // mark where the undefined sequence is
- new_gs->add_annotations_for_undefined_sequence(draw_narrow_track);
+ // mark where the sequence is
+ new_gs->add_annotations_for_defined_sequence(draw_track);
clear_links();
track_container.push_back(new_gs);
return empty_seq;
}
-void GlSequence::add_annotations_for_undefined_sequence(Drawable::draw_func_ptr draw)
+void GlSequence::add_annotations_for_defined_sequence(Drawable::draw_func_ptr draw)
{
Sequence::const_iterator start_i = begin();
Sequence::const_iterator seq_i = begin();
for(; seq_i != end_i; ++seq_i)
{
// need a better set of characters to serch for
- if (*seq_i == 'N' or *seq_i == 'n') {
+ if (not (*seq_i == 'N' or *seq_i == 'n')) {
if (start_block_i == end_i) {
start_block_i = seq_i;
}
void GlSequence::draw_box(GLfloat world_left, GLfloat world_right,
GLfloat left, GLfloat right,
- GLfloat height, GLfloat y, GLfloat z)
+ GLfloat height, GLfloat y, GLfloat z,
+ GLint primitive)
{
GLfloat pixel_width = pixelWidth(world_left, world_right);
GLfloat offset = height/2.0;
if ((right-left) < pixel_width) {
right = left + pixel_width;
}
- glBegin(GL_QUADS);
+ glBegin(primitive);
glVertex3f(left, top, z);
glVertex3f(left, bottom, z);
glVertex3f(right, bottom, z);
{
glColor3fv(color()->get());
// draw main sequence track
- draw_box(left, right, x(), x()+Sequence::size(), height(), y(), 0.0);
+ draw_box(left, right, x(), x()+Sequence::size(), height(), y(), 0.0, GL_LINE_LOOP);
}
void GlSequence::draw_annotations(GLfloat left, GLfloat right) const
float z( (parent_draw) ? parent_draw->z() : 10 );
float height( (parent_draw) ? parent_draw->height() : default_height );
- glColor3f(1.0, 1.0, 1.0);
- float hsmall = height * 3.0/4.0;
+ glColor3f(0.0, 0.0, 0.0);
+ float hsmall = height * 0.5;
GlSequence::draw_box(left, right, x+s->start(), x+s->stop(),
hsmall, y, z+10);
+}
+
+void draw_track(SeqSpanRef s, float left, float right)
+{
+ SeqSpanRef parent(s->parent());
+ DrawableRef parent_draw(parent->drawable());
+ float x( (parent_draw) ? parent_draw->x() : 0);
+ float y( (parent_draw) ? parent_draw->y() : 0);
+ float z( (parent_draw) ? parent_draw->z() : 10 );
+ float height( (parent_draw) ? parent_draw->height() : default_height );
+
+ glColor3f(0.0, 0.0, 0.0);
+ GlSequence::draw_box(left, right, x+s->start(), x+s->stop(),
+ height, y, z+10);
}
\ No newline at end of file
static DrawableRef copy_drawable(DrawableRef s);
//! search through sequence and add an annotation highlighting all the non AGCT characters
- void add_annotations_for_undefined_sequence(Drawable::draw_func_ptr draw=0);
+ void add_annotations_for_defined_sequence(Drawable::draw_func_ptr draw=0);
//! set our starting x (horizontal) coordinate
void setX(float x);
//! get our starting x (horizontal) coordinate
static
void draw_box(GLfloat world_left, GLfloat world_right,
GLfloat left, GLfloat right, GLfloat height,
- GLfloat y, GLfloat z);
+ GLfloat y, GLfloat z,
+ GLint primitive=GL_QUADS);
//! draw a track
/*! left and right are the edges of the current viewport
*/
void draw_sequence(GLfloat, GLfloat) const;
};
+void draw_track(SeqSpanRef ref, float left, float right);
void draw_narrow_track(SeqSpanRef ref, float left, float right);
#endif
BOOST_CHECK_EQUAL( *(s.color()), *c );
}
-BOOST_AUTO_TEST_CASE( glsequence_find_null_sequence )
+BOOST_AUTO_TEST_CASE( glsequence_find_real_sequence )
{
boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
- GlSequence s("AAAAAAAAAANNNNNANAN", cm);
+ GlSequence s("AAAAAAAAAANNNNNANNA", cm);
// 0123456789012345678
- s.add_annotations_for_undefined_sequence();
+ s.add_annotations_for_defined_sequence();
BOOST_CHECK_EQUAL(s.annotations().size(), 3);
std::vector<SeqSpanRef> annot(s.annotations().begin(), s.annotations().end());
- BOOST_CHECK_EQUAL(annot[0]->start(), 10);
- BOOST_CHECK_EQUAL(annot[0]->stop(), 15);
- BOOST_CHECK_EQUAL(annot[1]->start(), 16);
+ BOOST_CHECK_EQUAL(annot[0]->start(), 0);
+ BOOST_CHECK_EQUAL(annot[0]->stop(), 10);
+ BOOST_CHECK_EQUAL(annot[1]->start(), 15);
BOOST_CHECK_EQUAL(annot[1]->size(), 1);
BOOST_CHECK_EQUAL(annot[2]->start(), 18);
BOOST_CHECK_EQUAL(annot[2]->size(), 1);
SequenceBrowserWidget *b1 = new SequenceBrowserWidget(d);
b1->setSequences(seqs, cm );
QVERIFY( b1->sequences().size() == 2);
- QVERIFY( b1->sequences()[0]->annotations().size() == 1 );
+ // annotations().size() now always has the base
+ // where is the sequence annotation
+ QVERIFY( b1->sequences()[0]->annotations().size() == 2 );
QVERIFY( b1->sequences()[0]->seqspan() ==
b1->sequences()[0]->annotations().front()->parent() );
SequenceBrowserWidget *b2 = new SequenceBrowserWidget(d);
b2->setSequences(seqs, cm);
- QVERIFY( b2->sequences()[0]->annotations().size() == 1 );
+ QVERIFY( b2->sequences()[0]->annotations().size() == 2 );
QVERIFY( b2->sequences()[0]->seqspan() ==
b2->sequences()[0]->annotations().front()->parent() );
}