package icecream; import aligner.AlignmentResult; public final class IceCreamAlignerJava extends IceCreamAligner { IceCreamAlignerJava(){} /** * @param query * @param ref * @param rstart * @param rstop * @param minScore Quit early if score drops below this * @param minRatio Don't return results if max score is less than this fraction of max possible score * @return */ @Override public AlignmentResult alignForward(final byte[] query, final byte[] ref, final int rstart, final int rstop, final int minScore, final float minRatio) { final int arrayLength=rstop-rstart+1; //Stack allocated; faster. final int[] array1=new int[arrayLength+1], array2=new int[arrayLength+1]; final int minPassingScore=(int)(query.length*minRatio*pointsMatch); final int minPassingScore3=minPassingScore-query.length*pointsMatch; int[] prev=array1, next=array2; int maxScore=-999999; int maxQpos=-1; int maxRpos=-1; for(int i=0; i<=arrayLength-query.length; i++){prev[i]=0;} for(int i=arrayLength-query.length, score=0; i<=arrayLength; i++, score+=pointsDel) { prev[i]=score; } int currentRstart=rstart; for(int qpos=0; qpos=maxScoreThisPass){ // maxScoreThisPass=score; // if(score>=maxScore){ // maxScore=score; // maxQpos=qpos; // maxRpos=rpos; // } // } //Should be branchless conditional moves int score=(dScore>=vScore ? dScore : vScore); score=(hScore>score ? hScore : score); next[apos]=score; maxScoreThisPass=(score>maxScoreThisPass ? score : maxScoreThisPass); // minViableRstart=((scoreminViableRstart) ? minViableRstart : rpos); } iters+=arrayLength; if(maxScoreThisPass=maxScore){ maxScore=score; maxQpos=query.length; maxRpos=rpos; } } maxScore=(maxScore-pointsSub*query.length)/(pointsMatch-pointsSub);//Rescale 0 to length final float ratio=maxScore/(float)query.length; if(ratio=vScore ? dScore : vScore); score=(hScore>score ? hScore : score); next[apos]=score; } // //Inner DV loop // for(int qpos=0, apos=1; qpos=vScore ? dScore : vScore); // // next[apos]=score; // } // // //Inner I loop // for(int qpos=0, apos=1; qposscore ? hScore : score); // // next[apos]=score; // } itersShort+=arrayLength; if(score>=maxScore){ maxScore=score; maxQpos=arrayLength-1; maxRpos=rpos; } int[] temp=prev; prev=next; next=temp; } maxScore=(maxScore-pointsSub*query.length)/(pointsMatch-pointsSub);//Rescale 0 to length final float ratio=maxScore/(float)query.length; if(ratio