Trying for a better match with CR3. This works worse than the previous.
@@ -12,11 +12,11 @@ inline int funCompareSolo1 (const void *a, const void *b) {
uint32 *va= (uint32*) a;
uint32 *vb= (uint32*) b;
- if (va[1]>vb[1]) {
+ if (va[1]>vb[1]) {//ascending for 1st (counts)
return 1;
} else if (va[1]<vb[1]) {
return -1;
- } else if (va[0]>vb[0]){
+ } else if (va[0]>vb[0]){//ascending for 0th (sequence)
return 1;
} else if (va[0]<vb[0]){
return -1;
@@ -86,7 +86,7 @@ void SoloFeature::collapseUMI_CR(uint32 iCB, uint32 *umiArray)
uint32 nU0=(iR1+umiArrayStride)/umiArrayStride;
uint32 nU1=nU0;//2 types of 1MM collapsing
- qsort(umiArray, nU0, umiArrayStride*sizeof(uint32), funCompareSolo1);
+ qsort(umiArray, nU0, umiArrayStride*sizeof(uint32), funCompareSolo1);//ascending by counts, ascending by UMI
for (uint64 iu=0; iu<(nU0-1)*umiArrayStride; iu+=umiArrayStride) {
uint64 iuu;
for (iuu=(nU0-1)*umiArrayStride; iuu>iu; iuu-=umiArrayStride) {
@@ -94,7 +94,11 @@ void SoloFeature::collapseUMI_CR(uint32 iCB, uint32 *umiArray)
uint32 uuXor=umiArray[iu+0] ^ umiArray[iuu+0];
if ( (uuXor >> (__builtin_ctz(uuXor)/2)*2) <= 3 ) {//1MM
+ if (umiArray[iu+1]>umiArray[iuu+1]) {//only if the previous counts are higher
umiArray[iu+0]=umiArray[iuu+0];//replace this one with the previous one
+ } else {
+ umiArray[iu+0]=0;
+ };
break; //1MM
};
};
@@ -102,6 +106,7 @@ void SoloFeature::collapseUMI_CR(uint32 iCB, uint32 *umiArray)
if (pSolo.umiFiltering.MultiGeneUMI) {
for (uint64 iu=0; iu<nU0*umiArrayStride; iu+=umiArrayStride) {
+ if ( umiArray[iu+0]!=0 )
umiGeneHash[umiArray[iu+0]][gID[iG]]+=umiArray[iu+1];//this sums read counts over UMIs that were collapsed
};
} else {
