Skip to content

Commit

Permalink
Merge pull request #100 from smoe/optics
Browse files Browse the repository at this point in the history
Optics: Mostly on indentation
  • Loading branch information
magnusmanske authored Apr 30, 2024
2 parents d15d404 + b6d132c commit 979348b
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 41 deletions.
5 changes: 5 additions & 0 deletions src/PlasmidCanvasLinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ void PlasmidCanvas::drawLinearItem ( wxDC& dc , const int _r1 , const int _r2 ,
// Drawing polygon
wxPoint *wp ;
wp = (wxPoint*) malloc ( sizeof ( wxPoint ) * (pt.size()+1) ) ;
if (!wp)
{
wxPrintf("E: Out of memory.\n") ;
abort() ;
}
for ( unsigned int b = 0 ; b < pt.size() ; b++ ) wp[b] = pt[b] ;
if ( !this->p->vec->getGenomeMode() ) dc.SetPen(*wxBLACK_PEN);
else dc.SetPen ( *MYPEN((wxColour)i->getBrush()->GetColour()) ) ;
Expand Down
10 changes: 5 additions & 5 deletions src/TIMGreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ TIMGreader::~TIMGreader ()
if ( buffer )
{
delete buffer ;
buffer = NULL ;
buffer = NULL ;
}
if ( output )
{
free( output ) ;
output = NULL ;
free( output ) ;
output = NULL ;
}
}

Expand Down Expand Up @@ -134,12 +134,12 @@ void TIMGitem::draw ( wxDC &dc , int x1 , int y1 , int x2 , int y2 )
}
}

int TIMGitem::xx ( int x )
int TIMGitem::xx ( const int x ) const
{
return off.x + x * 19 / 24 ;
}

int TIMGitem::yy ( int y )
int TIMGitem::yy ( const int y ) const
{
return off.y + y * 9 / 12 ;
}
Expand Down
4 changes: 2 additions & 2 deletions src/TIMGreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class TIMGitem
{
public :
void draw ( wxDC &dc , int x1 , int y1 , int x2 , int y2 ) ; ///< Draws the annotation
int xx ( int x ) ; ///< X-coordinate conversion
int yy ( int y ) ; ///< Y-coordinate conversion
int xx ( const int x ) const ; ///< X-coordinate conversion
int yy ( const int y ) const ; ///< Y-coordinate conversion

int type ; ///< Annotation type
wxPoint p1 , p2 ;
Expand Down
45 changes: 22 additions & 23 deletions src/TLigationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void TLigationDialog::init ()
{
bool state = true ;
if ( !vv[a]->hasStickyEnds() )
state = false ; // blunt ends are not ligated by default...
state = false ; // blunt ends are not ligated by default...
l_sources->Append ( vv[a]->getName() ) ;
l_sources->Check ( a , state ) ;
}
Expand All @@ -98,11 +98,10 @@ void TLigationDialog::init ()

void TLigationDialog::generateTargets ()
{
int a ;
int cnt = l_sources->GetCount() ;
vector <bool> vc , used ;
wxArrayInt vi ;
for ( a = 0 ; a < cnt ; a++ )
for ( int a = 0 ; a < cnt ; a++ )
{
vc.push_back ( l_sources->IsChecked ( a ) ) ;
used.push_back ( !l_sources->IsChecked ( a ) ) ;
Expand All @@ -113,7 +112,7 @@ void TLigationDialog::generateTargets ()
l_targets->Clear () ;

// Using each selected item as a starter
for ( a = 0 ; a < cnt ; a++ )
for ( int a = 0 ; a < cnt ; a++ )
{
if ( vc[a] )
{
Expand All @@ -129,7 +128,7 @@ void TLigationDialog::generateTargets ()
}
}

for ( a = 0 ; a < vt.GetCount() ; a++ )
for ( int a = 0 ; a < vt.GetCount() ; a++ )
{
l_targets->Append ( vt[a] ) ;
l_targets->Check ( a , true ) ;
Expand Down Expand Up @@ -191,15 +190,15 @@ void TLigationDialog::curseTargets ( vector <bool> &vc , vector <bool> &used , w
myass ( a >= 0 && a < vc.size() , "TLigationDialog::curseTargets:4b" ) ;
myass ( a >= 0 && a < used.size() , "TLigationDialog::curseTargets:4c" ) ;
if ( vc[a] && !used[a] && doMatch ( vi[cnt-1] , a , true ) ) // Turned around
{
used[a] = true ;
vi.Add ( a ) ;
orientation.push_back ( true ) ;
curseTargets ( vc , used , vi ) ;
orientation.pop_back () ;
vi.RemoveAt ( vi.GetCount() - 1 ) ;
used[a] = false ;
}
{
used[a] = true ;
vi.Add ( a ) ;
orientation.push_back ( true ) ;
curseTargets ( vc , used , vi ) ;
orientation.pop_back () ;
vi.RemoveAt ( vi.GetCount() - 1 ) ;
used[a] = false ;
}
}
}

Expand All @@ -210,7 +209,7 @@ wxString TLigationDialog::invert ( const wxString& s ) const
return t ;
}

bool TLigationDialog::doMatch ( int l , int r , bool invertSecond )
bool TLigationDialog::doMatch ( const int& l , const int& r , const bool& invertSecond ) const
{
wxString s1 , s2 ;

Expand All @@ -219,15 +218,15 @@ bool TLigationDialog::doMatch ( int l , int r , bool invertSecond )
myass ( r >= 0 && r < vv.GetCount() , "TLigationDialog::doMatch:3" ) ;
myass ( vv[r] , "TLigationDialog::doMatch:4" ) ;
if ( invertSecond )
{
s1 = vv[l]->getStickyEnd(false,true) + invert ( vv[r]->getStickyEnd(false,false) ) ;
s2 = vv[l]->getStickyEnd(false,false) + invert ( vv[r]->getStickyEnd(false,true) ) ;
}
{
s1 = vv[l]->getStickyEnd(false,true) + invert ( vv[r]->getStickyEnd(false,false) ) ;
s2 = vv[l]->getStickyEnd(false,false) + invert ( vv[r]->getStickyEnd(false,true) ) ;
}
else
{
s1 = vv[l]->getStickyEnd(false,true) + vv[r]->getStickyEnd(true,true) ;
s2 = vv[l]->getStickyEnd(false,false) + vv[r]->getStickyEnd(true,false) ;
}
{
s1 = vv[l]->getStickyEnd(false,true) + vv[r]->getStickyEnd(true,true) ;
s2 = vv[l]->getStickyEnd(false,false) + vv[r]->getStickyEnd(true,false) ;
}

TVector v ;
v.setSequence ( s1 ) ;
Expand Down
2 changes: 1 addition & 1 deletion src/TLigationDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TLigationDialog : public wxDialog
virtual void init () ; ///< Initialize
virtual void generateTargets () ; ///< Generate the target list
virtual void curseTargets ( vector <bool> &vc , vector <bool> &used , wxArrayInt &vi ) ; ///< Recurse through targets
virtual bool doMatch ( int l , int r , bool invertSecond = false ) ; ///< Do these match?
virtual bool doMatch ( const int& l , const int& r , const bool& invertSecond = false ) const ; ///< Do these match?
virtual wxString getVIName ( const wxArrayInt &vi ) const ; ///< Generate a name
virtual void addVTname ( const wxString& name , wxArrayInt &vi , const bool circular ) ; ///< Add this one

Expand Down
5 changes: 2 additions & 3 deletions src/TPrimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,8 @@ void TPrimer::OligoCount () /* not const */

for ( int i = 1 ; i < seq.length() ; i++ ) //first base can not be IUpacbase
{
wxString base , base0 ;
base0 += seq.GetChar(i-1) ;
base += seq.GetChar(i) ;
wxString base0 = seq.GetChar(i-1) ;
wxString base = seq.GetChar(i) ;
double *temp ;

temp=CalcIUpair(base0, base, i, false );
Expand Down
4 changes: 2 additions & 2 deletions src/TSilmutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ void TSilmutDialog::OnCancel ( wxCommandEvent &ev )

void TSilmutDialog::OnSpin ( wxSpinEvent &event )
{
wxCommandEvent event2 ;
OnSpin2 ( event2 ) ;
wxCommandEvent event2 ;
OnSpin2 ( event2 ) ;
}

void TSilmutDialog::OnSpin2 ( wxCommandEvent &event )
Expand Down
9 changes: 6 additions & 3 deletions src/ureadseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ char *readSeq(


char *listSeqs(
const char *filename_, /* file name */
const char * const filename_, /* file name */
const size_t skiplines_,
const short format_, /* sequence file format */
size_t *nseq_, /* number of seqs in file, for listSeqs() */
Expand Down Expand Up @@ -1345,17 +1345,18 @@ short seqFileFormatFp(
if (format == kPhylip) {
/* check for interleaved or sequential -- really messy */
int tname, tseq;
size_t i, j, nspp= 0, nlen= 0, ilen, leaf= 0, seq= 0;
size_t j, nspp= 0, nlen= 0, ilen, leaf= 0, seq= 0;
char *ps;

rewind(fseq);
for (i=0; i < *skiplines; i++) ReadOneLine(sp);
for (size_t i=0; i < *skiplines; i++) ReadOneLine(sp);
nlines= 0;
ReadOneLine(sp);
sscanf( sp, "%ld%ld", &nspp, &nlen);
ReadOneLine(sp); /* 1st seq line */
for (ps= sp+10, ilen=0; *ps!=0; ps++) if (isprint(*ps)) ilen++;

size_t i;
for (i= 1; i<nspp; i++) {
ReadOneLine(sp);

Expand All @@ -1379,6 +1380,8 @@ short seqFileFormatFp(
ilen= 0;
}
}

// value of i reused here, which should be nspp
for ( nspp *= 2 ; i<nspp; i++) { /* this should be only bases if interleaf */
ReadOneLine(sp);

Expand Down
3 changes: 1 addition & 2 deletions src/ureadseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ extern "C" {
extern short seqFileFormat(const char *filename, size_t *skiplines, short *error );
extern short seqFileFormatFp(FILE *fseq, size_t *skiplines, short *error );

extern char *listSeqs(const char *filename, const size_t skiplines,
const short format, size_t *nseq, short *error );
extern char *listSeqs(const char * const filename, const size_t skiplines, const short format, size_t *nseq, short *error );

extern char *readSeq(const size_t whichEntry, const char *filename,
const size_t skiplines, const short format,
Expand Down

0 comments on commit 979348b

Please sign in to comment.