File: TVirtualGel.h

package info (click to toggle)
gentle 1.9%2Bcvs20100605%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,172 kB
  • ctags: 6,217
  • sloc: cpp: 41,569; ansic: 3,978; sh: 1,420; makefile: 264
file content (118 lines) | stat: -rw-r--r-- 4,329 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/** \file
	\brief Contains the TVirtualGel class, as well as the TGelLane and TMyGelControl helper classes
*/
#ifndef _TVIRTUAL_GEL_H_
#define _TVIRTUAL_GEL_H_

#include "main.h"
#include "ChildBase.h"

class TMyGelControl ;

/**	\class TGelLane
	\brief This class represents a lane on a virtual gel
*/
class TGelLane
	{
	public :
	TGelLane () ; ///< Constructor
	virtual ~TGelLane () {} ///< Dummy destructor
	
	virtual void clear () ; ///< Clears the lane data
	virtual void setMarker ( wxString _name ) ; ///< Sets a default marker
	virtual void add ( int size , int weight = 1 ) ; ///< Adds a weightenend band
	virtual void add ( int size , wxString title ) ; ///< Adds a labeled band
	virtual void add ( int size , int weight , wxString title ) ; ///< Adds a band with weight and label
	wxString name , type ;
	wxArrayInt vi , vw ;
	wxArrayString vs ;
	double unit_volume ;
	wxRect pos ; ///< The outer border of the lane
	} ;    

/**	\class TVirtualGel
	\brief The virtual gel module
*/
class TVirtualGel : public ChildBase
    {
    public :
    TVirtualGel(wxWindow *parent, const wxString& title) ; ///< Constructor
    
    virtual void initme () ; ///< Initialization
    virtual wxString getName () ; ///< Returns the gel module name

    virtual void OnPercent ( wxCommandEvent &ev ) ; ///< Gel percent setting change event handler
    virtual void OnLabel ( wxCommandEvent &ev ) ; ///< Show labels event handler
    virtual void OnMarker ( wxCommandEvent &ev ) ; ///< Show labels event handler
    virtual void OnPrint ( wxCommandEvent &ev ) ; ///< Print event handler

    TMyGelControl *right ; ///< Pointer to the actual gel
    wxChoice *ch_percent , *ch_marker ; ///< Gel concentration choice box
    wxCheckBox *cb_label ; ///< Show labels check box
    vector <TGelLane> lanes ; ///< The lanes on the gel
    wxString type ; ///< Gel type (unused yet)
    double percent ; ///< Gel concentration
    int cutoff , maxband ;
    
    DECLARE_EVENT_TABLE()
    } ;
    
/**	\class TMyGelControl
	\brief This class handles a single virtual gel for TVirtualGel, using TGelLane lanes
*/
class TMyGelControl : public wxControl
    {
    public :
    TMyGelControl ( wxWindow *parent , int id = -1 ) ; ///< Constructor

    virtual void OnDraw(wxDC& dc) ; ///< Draw event handler
    virtual void OnPaint(wxPaintEvent& event) ; ///< Paint event handler

    virtual void OnEvent(wxMouseEvent& event); ///< Mouse event handler
    virtual void OnSaveAsBitmap(wxCommandEvent &event); ///< Save image handler
    virtual void OnCopy(wxCommandEvent &event); ///< Copy event handler
    virtual void OnPrint(wxCommandEvent &event); ///< Print event handler
    virtual void OnDummy(wxCommandEvent& WXUNUSED(event)){}; ///< Dummy event handler
    
    virtual int getLanePos ( int size , int height , float perc = 0 ) ;
    virtual double fix_percent ( int size , float perc = 0 ) ;
    
    virtual void drawBand ( wxDC &dc , TGelLane &lane , int band ) ; ///< Draws a gel band
    
    bool printing ; ///< Is the current output going to printer?
    TVirtualGel *vg ; ///< Pointer to the parent module

    DECLARE_EVENT_TABLE()
    } ;


class TRestrictionIdentifier : public TVirtualGel
{
    public :
    TRestrictionIdentifier(wxWindow *parent, const wxString& title) ; ///< Constructor
    virtual void initme () ; ///< Initialization
    
    virtual void OnDNAListChange(wxCommandEvent &event);
    virtual void OnEnzymeListChange(wxCommandEvent &event);
    virtual wxString getName () ; ///< Returns the gel module name
    virtual void otherChildrenChanged () ;

    private:
    void listDNA () ;
    void recalcEnzymes() ;
    void addRestrictionLane ( wxString en , TVector *v ) ;
    wxArrayInt getRestrictionFragments ( wxString en , TVector *v ) ;
    bool check4separation ( wxString en ) ;
    bool arrays_are_separate ( const wxArrayInt &a1 , const wxArrayInt &a2 ) ;
    bool arrays_differ ( const wxArrayInt &a1 , const wxArrayInt &a2 , int bp , int percent ) ;
    
    wxCheckListBox *dna_list ;
    wxListBox *enzymes_list ;
    wxChoice *bp_list , *percent_list , *group_list ;
    vector <MyChild*> dna_items ;
    bool running ;
    
    DECLARE_EVENT_TABLE()
} ;

#endif