Skip to content

Commit

Permalink
fix the regression issue of clustering reversed UMI
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Apr 22, 2019
1 parent 86af0cf commit dbf065b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 46 deletions.
46 changes: 1 addition & 45 deletions src/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,51 +48,7 @@ int Cluster::umiDiff(const string& umi1, const string& umi2) {
diff++;
}

if( diff == 0)
return 0;

int underline1 = -1;
int underline2 = -1;

for(int i=0; i<len1; i++) {
if(umi1[i] == '_') {
underline1 = i;
break;
}
}

if(underline1 <= 0)
return diff;

for(int i=0; i<len2; i++) {
if(umi2[i] == '_') {
underline2 = i;
break;
}
}

if(underline2 <= 0)
return diff;

int len11 = underline1;
int len12 = len1 - underline1 - 1;
int len21 = underline2;
int len22 = len2 - underline2 - 1;

// reversed
int d1 = abs(len11 - len22);
for(int i=0; i<min(len11, len22); i++) {
if(umi1[i] != umi2[underline2 + i + 1])
d1++;
}
int d2 = abs(len12 - len21);
for(int i=0; i<min(len12, len21); i++) {
if(umi1[underline1 + i + 1] != umi2[i])
d2++;
}
int revDiff = d1 + d2;

return min(diff, revDiff);
return diff;
}

vector<Pair*> Cluster::clusterByUMI(int umiDiffThreshold, Stats* preStats, Stats* postStats) {
Expand Down
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COMMON_H
#define COMMON_H

#define VERSION_NUMBER "0.10.0"
#define VERSION_NUMBER "0.11.0"

#define _DEBUG false

Expand Down

0 comments on commit dbf065b

Please sign in to comment.