Skip to content

Commit

Permalink
Merge pull request #76 from smoe/optics
Browse files Browse the repository at this point in the history
optics: whitespace and maybe introduced const
  • Loading branch information
magnusmanske authored Jan 3, 2024
2 parents bbfbb00 + 3da2bcd commit bb89ad0
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 267 deletions.
425 changes: 210 additions & 215 deletions AutoAnnotate.cpp

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions AutoAnnotate.h
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
/** \file
\brief Contains the AutoAnnotate class
\brief Contains the AutoAnnotate class
*/
#ifndef __AUTOANNOTATE__
#define __AUTOANNOTATE__

#include "main.h"

class MyChild ;
/** \brief The AutoAnnotate class scans database(s) for known features in the current sequence
/** \brief The AutoAnnotate class scans database(s) for known features in the current sequence
It uses the TAutoAnnotateDialog class to display a settings dialog, then runs through one or
two databases (depending on the settings), extracting DNA, and matching it to the current sequence.
Finally, it will add all not-identified open reading frames as "unknown" features.
It uses the TAutoAnnotateDialog class to display a settings dialog, then runs through one or
two databases (depending on the settings), extracting DNA, and matching it to the current sequence.
Finally, it will add all not-identified open reading frames as "unknown" features.
*/
class AutoAnnotate
{
public :
AutoAnnotate ( MyChild *_p = NULL ) ; ///< Constructor
~AutoAnnotate () {} ; ///< Destructor (empty)
{
public :
AutoAnnotate ( MyChild * const _p = NULL ) ; ///< Constructor
~AutoAnnotate () {} ; ///< Destructor (empty)

bool SettingsDialog () ; ///< Runs the dialog; returns wether to Run or not
void Run () ; ///< Runs the search
private :
bool ScanDatabase ( wxString database ) ; ///< Scans a database for matching features
bool addORFs ( TVector *v ) ; ///< Adds open reading frames as features (that could not be identified)
bool MatchItem ( TVector *tv , TVectorItem &item , TVector *v , wxString &oseq ) ; ///< Compares two items to prevent double entries
bool RawMatch ( TVectorItem &item , TVector *v , wxString &oseq , wxString &s ) ; ///< Tries to match the full item sequence against the current sequence
void machete ( TVector *v ) ; ///< Reduces the number of identified items, so that one can actually read something in the map again :-)
bool within ( TVectorItem &i1 , TVectorItem &i2 , TVector *v ) ; ///< Checks if TVectorItem i2 lies within i1 (no need to add it then)
bool SettingsDialog () ; ///< Runs the dialog; returns wether to Run or not
void Run () ; ///< Runs the search
private :
bool ScanDatabase ( const wxString& database ) ; ///< Scans a database for matching features
bool addORFs ( TVector *v ) ; ///< Adds open reading frames as features (that could not be identified)
bool MatchItem ( const TVector * const tv , TVectorItem &item , TVector *v , const wxString &oseq ) ; ///< Compares two items to prevent double entries
bool RawMatch ( const TVectorItem &item , TVector *v , const wxString &oseq , const wxString &s ) ; ///< Tries to match the full item sequence against the current sequence
void machete ( TVector * const v ) ; ///< Reduces the number of identified items, so that one can actually read something in the map again :-)
bool within ( const TVectorItem &i1 , const TVectorItem &i2 , const TVector * const v ) ; ///< Checks if TVectorItem i2 lies within i1 (no need to add it then)

friend class TAutoAnnotateDialog ;
MyChild *p ; ///< Pointer to the calling MyChild
wxArrayString alreadyin ; ///< Cache of items already added
wxString commonVectorsDatabase , additionalDatabase ;
bool useCommonDatabase , useAdditionalDatabase , useMachete , doAddORFs ;
friend class TAutoAnnotateDialog ;
MyChild *p ; ///< Pointer to the calling MyChild
wxArrayString alreadyin ; ///< Cache of items already added
wxString commonVectorsDatabase , additionalDatabase ;
bool useCommonDatabase , useAdditionalDatabase , useMachete , doAddORFs ;
wxArrayString dbname , dbfile ;
} ;
} ;

#endif
22 changes: 11 additions & 11 deletions MyChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ void MyChild::OnHelp(wxCommandEvent& event)
myapp()->frame->OnHelp ( event ) ;
}

void MyChild::updateSequenceCanvas ( bool remember )
void MyChild::updateSequenceCanvas ( const bool& remember )
{
myass ( cSequence , "MyChild::updateSequenceCanvas" ) ;
TMarkMem mm ( cSequence ) ;
Expand Down Expand Up @@ -868,7 +868,7 @@ void MyChild::OnAA_none(wxCommandEvent& event)
mm.remark () ;
}

void MyChild::OnAA_setit(int mode)
void MyChild::OnAA_setit(const int mode)
{
bool wasZero = aa_state == AA_NONE ;
int oldscrollpos , dummy , oldmarkfrom , oldmarkto , oldmarkwhat ;
Expand Down Expand Up @@ -995,7 +995,7 @@ void MyChild::OnPrintRestrictionList(wxCommandEvent& event)
vector <wxString> c_name , c_pos ;
for ( int a = 0 ; a < vec->rc.size() ; a++ )
{
int b;
int b;
for ( b = 0 ; b < c_name.size() && c_name[b] != vec->rc[a].e->getName() ; b++ ) ;
if ( b == c_name.size() )
{
Expand Down Expand Up @@ -1083,7 +1083,7 @@ void MyChild::OnMarkAll(wxCommandEvent& event)
Refresh () ;
}

wxString MyChild::doExtractAA ( bool coding )
wxString MyChild::doExtractAA ( const bool& coding )
{
if ( aa_state == AA_NONE || aa_state == AA_ALL )
{
Expand Down Expand Up @@ -1396,19 +1396,19 @@ void MyChild::OnPrintReport(wxCommandEvent& event)
{
y += ch ;
pdc->DrawText ( vec->items[a].name , x0 , y ) ;
// sprintf ( t , "%d" , vec->items[a].from ) ; pdc->DrawText ( t , x1 , y ) ;
// sprintf ( t , "%d" , vec->items[a].to ) ; pdc->DrawText ( t , x2 , y ) ;
// sprintf ( t , "%d" , vec->items[a].from ) ; pdc->DrawText ( t , x1 , y ) ;
// sprintf ( t , "%d" , vec->items[a].to ) ; pdc->DrawText ( t , x2 , y ) ;

pdc->DrawText ( wxString::Format ( _T("%d") , vec->items[a].from ) , x1 , y ) ;
pdc->DrawText ( wxString::Format ( _T("%d") , vec->items[a].to ) , x2 , y ) ;
pdc->DrawText ( wxString::Format ( _T("%d") , vec->items[a].from ) , x1 , y ) ;
pdc->DrawText ( wxString::Format ( _T("%d") , vec->items[a].to ) , x2 , y ) ;

int len = vec->items[a].to - vec->items[a].from + 1 ;
if ( vec->items[a].to < vec->items[a].from )
len += vec->getSequenceLength() ;
// sprintf ( t , "%d" , len ) ; pdc->DrawText ( t , x3 , y ) ;
// sprintf ( t , "%d" , len ) ; pdc->DrawText ( t , x3 , y ) ;
pdc->DrawText ( wxString::Format ( _T("%d") , len ) , x3 , y ) ;

// sprintf ( t , "itemtype%d" , vec->items[a].type ) ;
// sprintf ( t , "itemtype%d" , vec->items[a].type ) ;
pdc->DrawText ( txt(wxString::Format( _T("itemtype%d") , vec->items[a].type)) , x4 , y ) ;
if ( vec->items[a].direction > 0 ) pdc->DrawText ( txt("cw") , x5 , y ) ;
else pdc->DrawText ( txt("ccw") , x5 , y ) ;
Expand Down Expand Up @@ -1670,7 +1670,7 @@ void MyChild::add_siRNA ( const int item )
vec->updateDisplay () ;
}

int MyChild::add_siRNA_sub ( wxString s , int pos )
int MyChild::add_siRNA_sub ( const wxString& s , const int pos )
{
int score = 0 ;
if ( s.GetChar ( 2 ) != 'A' ) return 0 ;
Expand Down
8 changes: 4 additions & 4 deletions MyChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MyChild: public ChildBase
virtual void OnAA_three_M1(wxCommandEvent& event); ///< "Display amino acids, reading frame -1" event handler
virtual void OnAA_three_M2(wxCommandEvent& event); ///< "Display amino acids, reading frame -2" event handler
virtual void OnAA_three_M3(wxCommandEvent& event); ///< "Display amino acids, reading frame -3" event handler
virtual void OnAA_setit(int mode); ///< Sets the amino acid display mode (called by the OnAA_ event handlers)
virtual void OnAA_setit(const int mode); ///< Sets the amino acid display mode (called by the OnAA_ event handlers)

virtual void OnActivate(wxActivateEvent& event); ///< Activation event handler
virtual void Undo(wxCommandEvent& event); ///< Undo event handler
Expand Down Expand Up @@ -99,8 +99,8 @@ class MyChild: public ChildBase
virtual void initPanels () ; ///< Initializes the panels
virtual wxString getName () const ; ///< Returns the module name
virtual void EnforceRefesh () ; ///< Force display refresh
virtual void updateSequenceCanvas ( bool remember = false ) ; ///< Refresh the sequence display
virtual wxString doExtractAA ( bool coding = true ) ; ///< Extract amino acid sequence from DNA
virtual void updateSequenceCanvas ( const bool& remember = false ) ; ///< Refresh the sequence display
virtual wxString doExtractAA ( const bool& coding = true ) ; ///< Extract amino acid sequence from DNA
virtual bool runRestriction ( const wxString& s ) ; ///< Run the restriction
virtual void addFragmentsToGel ( const wxString& title , wxArrayInt &cuts , TVirtualGel * const gel , const TRestrictionEditor& ed , const bool partial ) const ; ///< Add restriction fragments to gel
virtual MyChild *doTransformSequence ( const bool inNewVector , const bool complement , const bool invers ) ; ///< Transform the sequence
Expand All @@ -121,7 +121,7 @@ class MyChild: public ChildBase
virtual void initMenus () ; ///< Initialize the menus

void add_siRNA ( const int item ) ;
int add_siRNA_sub ( wxString s , int pos ) ;
int add_siRNA_sub ( const wxString& s , const int pos ) ;

wxChoice *fontsize ;

Expand Down
6 changes: 3 additions & 3 deletions MyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2785,7 +2785,7 @@ bool MyFrameDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& f
for ( int a = 0 ; a < filenames.GetCount() ; a++ )
{
wxString path = filenames[a] ;
int b ;
int b ;
for ( b = path.length() - 1 ; path.GetChar(b) != '\\' && path.GetChar(b) != '/' ; b-- ) ;
wxString file = path.substr ( b+1 ) ;
myapp()->frame->importFile ( file , path , -1 ) ;
Expand All @@ -2802,6 +2802,6 @@ TProject::TProject ()
enzyme_rules = NULL ;
}

TEnzymeRules *TProject::getEnzymeRules () { return enzyme_rules ; }
void TProject::setEnzymeRules ( TEnzymeRules *er ) { enzyme_rules = er ; }
TEnzymeRules *TProject::getEnzymeRules () const { return enzyme_rules ; }
void TProject::setEnzymeRules ( TEnzymeRules * const er ) { enzyme_rules = er ; }

2 changes: 1 addition & 1 deletion MyFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TProject
TProject () ; ///< Constructor
virtual ~TProject () {} ; ///< Dummy destructor

virtual TEnzymeRules *getEnzymeRules () ; ///< Returns the restriction enzyme display rules for the project
virtual TEnzymeRules *getEnzymeRules () const ; ///< Returns the restriction enzyme display rules for the project
virtual void setEnzymeRules ( TEnzymeRules *er ) ; ///< Sets the restriction enzyme display rules for the project

wxString name ; ///< \brief The project name
Expand Down
10 changes: 5 additions & 5 deletions TPrimerDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ wxSpinCtrl *TPrimerDialog::addSpinCtrl ( const int id , const wxString& title ,
return n ;
}

void TPrimerDialog::initme ( TPrimer * const _p , TPrimerDesign * const _pd )
void TPrimerDialog::initme ( TPrimer * const _p , const TPrimerDesign * const _pd )
{
p = _p ;
pd = _pd ;
Expand Down Expand Up @@ -183,9 +183,9 @@ void TPrimerDialog::updateList ()
t = pd->vec->getSequence() ;
s = t ;
for ( int a = 0 ; a < p->sequence.length() ; a++ )
{
{
s.SetChar( a+p->from-1 , p->sequence.GetChar(a) ) ;
}
}
l1 = p->from - 1 - l5->GetValue() ;
l2 = p->from - 1 + r5->GetValue() ;
r1 = p->to - 1 - l3->GetValue() ;
Expand All @@ -196,9 +196,9 @@ void TPrimerDialog::updateList ()
t = pd->inverse_template_vector->getSequence() ;
s = t ;
for ( int a = 0 ; a < p->sequence.length() ; a++ )
{
{
s.SetChar ( a+p->from-1 , p->sequence.GetChar(a) ) ;
}
}
l1 = p->from - 1 - l3->GetValue() ;
l2 = p->from - 1 + r3->GetValue() ;
r1 = p->to - 1 - l5->GetValue() ;
Expand Down
4 changes: 2 additions & 2 deletions TPrimerDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TPrimerDialog : public wxDialog
public:
TPrimerDialog(wxWindow *parent , const wxString& title ) ; ///< Constructor
~TPrimerDialog() ; ///< Destructor
void initme ( TPrimer * const _p , TPrimerDesign * const _pd ) ; ///< Initialize
void initme ( TPrimer * const _p , const TPrimerDesign * const _pd ) ; ///< Initialize
wxSpinCtrl *addSpinCtrl ( const int id , const wxString& title , const int x , const int y , const int def ) ; ///< Create a new wxSpinCtrl (this dialog has so many of them...)

TPrimer *p , *cp ;
Expand All @@ -41,7 +41,7 @@ class TPrimerDialog : public wxDialog
void ShowLC () ; ///< Refreshes the potential primer list

private :
TPrimerDesign *pd ;
const TPrimerDesign *pd ;
vector <TPrimer> pl ; ///< The list of potential primers

wxSpinCtrl *l3 , *l5 , *r3 , *r5 , *lmin , *lmax , *tmin , *tmax ;
Expand Down

0 comments on commit bb89ad0

Please sign in to comment.