HACKISH: Display chipseq peak window track
[mussa.git] / alg / glsequence.hpp
index 7882d23a9340db77cbea53fdd2a3893726f46660..e486ca79e8096c61c0d2d45ef69e05091b0c5ba8 100644 (file)
@@ -36,7 +36,15 @@ public:
   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);
+  /**!search through our annotations and set the draw function for a particular "type"
+   * this is really a temporary solution to configuring annotation display styles
+   */
+  void update_annotation_draw_function(
+         std::string type, 
+         Drawable::draw_func_ptr draw, 
+         ColorRef color
+       );
   //! set our starting x (horizontal) coordinate
   void setX(float x);
   //! get our starting x (horizontal) coordinate
@@ -56,9 +64,22 @@ public:
   const ColorRef color() const;
   //! return our draw color
   ColorRef color();
+  //! return default gene color
+  static ColorRef default_gene_color();
+  //! return default track color
+  static ColorRef default_track_color();
+  //! return default chipseq color
+  static ColorRef default_chipseq_color();
+  
   //! return our annotation color mapper
   AnnotationColorsRef colorMapper() { return color_mapper; }
 
+  //! draw a from left to right +/- height/2
+  static
+  void draw_box(GLfloat world_left, GLfloat world_right, 
+                GLfloat left, GLfloat right, GLfloat height,
+                GLfloat y, GLfloat z,
+                GLint primitive=GL_QUADS);
   //! draw a track 
   /*! left and right are the edges of the current viewport
    */
@@ -67,7 +88,7 @@ public:
   //! get our right (horizontal) coordinate (size-x)
   float right() const;
   //! how long is our sequence track? (computed from the sequence)
-  GLfloat size() const;
+  Sequence::size_type size() const;
  
   //! return the left (lowest) base index that is fully visible
   Sequence::size_type leftbase(GLfloat left) const;
@@ -83,13 +104,15 @@ public:
   //! return a subsequence as a GlSequence (instead of a Sequence subsequence)
   GlSequence subseq(size_type start, size_type count) const;
   
+  //! Return the pixel width of the opengl viewport.
+  static int get_viewport_width_in_pixels();
   //! how big is a pixel in world coordinats
-  GLfloat pixelWidth(GLfloat, GLfloat) const;
+  static GLfloat pixelWidth(GLfloat, GLfloat);
   //! how big is a pixel in world coordinats (specifying viewport size)
-  GLfloat pixelWidth(GLfloat, GLfloat, int) const;
+  static GLfloat pixelWidth(GLfloat, GLfloat, int);
 
   //! are we close enough that it would make sense to view the base pairs?
-  bool is_sequence_renderable(GLfloat left, GLfloat right) const;
+  static bool is_sequence_renderable(GLfloat left, GLfloat right);
   //! are we close enough that it would make sense to view the base pairs?
   /*! though we don't actually check to see if there's sequence in our
    *  view, just that there's enough pixels to render something if 
@@ -99,24 +122,21 @@ public:
    *             coordinates
    *  \param[in] pixel_width allow setting the current viewport pixel width
    */
-  bool is_sequence_renderable(GLfloat, GLfloat, int) const;
+  static bool is_sequence_renderable(GLfloat, GLfloat, int);
 
   friend bool operator==(const GlSequence &left, const GlSequence &right);
 
 protected:
   AnnotationColorsRef color_mapper;
-  const GLfloat char_pix_per_world_unit;
 
   //! initalize a SeqSpanRef covering start, count
-  SeqSpanRef GlSequence::make_undefined_sequence_annotation(
+  SeqSpanRef make_drawable_annotation(
     Drawable::draw_func_ptr draw,
+    std::string name,
     size_type start,
-    size_type count);
+    size_type count,
+    ColorRef color);
 
-  //! Return the pixel width of the opengl viewport.
-  static int get_viewport_width_in_pixels();
-  //! draw a from left to right +/- height/2
-  void draw_box(GLfloat world_left, GLfloat world_right, GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
   //! draw sequence as a bar
   void draw_track(GLfloat, GLfloat) const;
   void draw_annotations(GLfloat, GLfloat) const;
@@ -125,4 +145,11 @@ protected:
    */
   void draw_sequence(GLfloat, GLfloat) const;
 };
+
+//! draw sequence track when we're far enough out not to see the AGCTs. 
+void draw_summarized_track(SeqSpanRef ref, float left, float right);
+//! draw a 1/4 width centered track 
+void draw_narrow_track(SeqSpanRef ref, float left, float right);
+//! draw a chipseq peak window track 
+void draw_chipseq_window(SeqSpanRef ref, float left, float right);
 #endif