forked from alexdobin/STAR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
void funPrimaryAlignMark(Transcript **trMult, uint64 nTr, Parameters &P) | ||
{ | ||
if (nTr==1){//unique mappers | ||
trMult[0]->primaryFlag=true; | ||
} else {//multimappers | ||
int nbest=0; | ||
if (P.outMultimapperOrder.random || P.outSAMmultNmax != (uint) -1 ) {//bring the best alignment to the top of the list. TODO sort alignments by the score? | ||
for (uint itr=0; itr<nTr; itr++) {//move the best aligns to the top of the list | ||
if ( trMult[itr]->maxScore == maxScore ) { | ||
swap(trMult[itr],trMult[nbest]); | ||
++nbest; | ||
}; | ||
}; | ||
}; | ||
|
||
if (P.outMultimapperOrder.random) {//shuffle separately the best aligns, and the rest | ||
for (int itr=nbest-1; itr>=1; itr--) {//Fisher-Yates-Durstenfeld-Knuth shuffle | ||
int rand1=int (rngUniformReal0to1(rngMultOrder)*itr+0.5); | ||
swap(trMult[itr],trMult[rand1]); | ||
}; | ||
for (int itr=nTr-nbest-1; itr>=1; itr--) {//Fisher-Yates-Durstenfeld-Knuth shuffle | ||
int rand1=int (rngUniformReal0to1(rngMultOrder)*itr+0.5); | ||
swap(trMult[nbest+itr],trMult[nbest+rand1]); | ||
}; | ||
}; | ||
|
||
if ( P.outSAMprimaryFlag=="AllBestScore" ) { | ||
for (uint itr=0; itr<nTr; itr++) | ||
{//mark all best score aligns as primary | ||
if ( trMult[itr]->maxScore == maxScore ) trMult[itr]->primaryFlag=true; | ||
}; | ||
} else if (P.outMultimapperOrder.random || P.outSAMmultNmax != (uint) -1) { | ||
trMult[0]->primaryFlag=true;//mark as primary the first one in the random ordered list: best scoring aligns are already in front of the list | ||
} else {//old way | ||
trBest->primaryFlag=true; | ||
}; | ||
}; | ||
}; | ||
|