Skip to content

Commit

Permalink
Fix a bug if using fasta file
Browse files Browse the repository at this point in the history
  • Loading branch information
mourisl committed Jul 28, 2015
1 parent ae36a3a commit 0281af9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ErrorCorrection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int CreateAnchor( char *read, char *qual, int *fix, bool *storedKmer, KmerCode &
int kmerLength = kmerCode.GetKmerLength() ;
int i, j, k ;
//if ( readLength < 2 * kmerLength )
// return -1 ;
// return -1 ;
int maxLen = 0 ;
int maxLenStats[2] = {0, 0}; // 0-position, 1-which nucleutide changed to

Expand Down Expand Up @@ -146,7 +146,7 @@ int CreateAnchor( char *read, char *qual, int *fix, bool *storedKmer, KmerCode &
//read[i] = c ;
//break ;
}
else if ( max > 0 && max == maxLen && qual[i] < qual[ maxLenStats[0] ] )
else if ( max > 0 && max == maxLen && qual[0] != '\0' && qual[i] < qual[ maxLenStats[0] ] )
{
maxLenStats[0] = i ;
maxLenStats[1] = j ;
Expand Down Expand Up @@ -921,14 +921,14 @@ int ErrorCorrection( char *read, char *qual, KmerCode& kmerCode, int maxCorrecti
{
if ( i >= kmerLength && ( fix[i - kmerLength] >= 0 && read[i - kmerLength] != 'N' ) )
{
if ( qual[i - kmerLength] <= badQuality )
if ( qual[0] != '\0' && qual[i - kmerLength] <= badQuality )
correctCnt -= 0.5 ;
else
--correctCnt ;
}
if ( fix[i] >= 0 && read[i] != 'N' )
{
if ( qual[i] <= badQuality )
if ( qual[0] != '\0' && qual[i] <= badQuality )
correctCnt += 0.5 ;
else
++correctCnt ;
Expand Down

0 comments on commit 0281af9

Please sign in to comment.