1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include "ParametersClip.h"
#include "Parameters.h"
#include "SequenceFuns.h"
uint32 ClipMate::clip(uint &Lread, char *seqNum)
{
clippedN=0;
if (type<0)
return 0; //no clip for this mate
uint LreadOld=Lread;
if (N>0) {//clip N bases
if (Lread>N) {
Lread -= N; // for 3p this is all
clippedN += N;
if (type==0) {//5p
memmove(seqNum, seqNum+N, Lread);
};
} else {
Lread=0;
clippedN=LreadOld;
}
};
if (adSeq.length()>0) {//clip adapter
switch (type) {
/* not implemented yet
case 0: {//5p - not tested yet
vector<uint32> vecMM({20, 22, 24, 30, 40, 50, 60, 70, 80, 90});
clippedAdN = localSearchGeneral(seqNum, Lread, adSeqNum, -(int32)adSeqNum.size()+1, (int32)Lread-(int32)adSeqNum.size(), adMMp, vecMM, clippedAdMM);
memmove(seqNum, seqNum+clippedAdN, Lread-clippedAdN);
break;
};
*/
case 1: {//3p
clippedAdN = Lread-localSearch(seqNum, Lread, adSeqNum.data(), adSeqNum.size(), adMMp);
break;
/* new way, not tested properly
uint64 clippedAdN1 = Lread-localSearch(seqNum, Lread, adSeqNum.data(), adSeqNum.size(), adMMp);
//clippedAdN = localSearchGeneral(seqNum, Lread, adSeqNum, 0, Lread, adMMp, clippedAdMM);
vector<uint32> vecMM({20, 23, 26, 30, 40, 50, 60, 70, 80, 90});
clippedAdN = localSearchGeneral(seqNum, Lread, adSeqNum, Lread-1, -1, adMMp, vecMM, clippedAdMM);
Lread=Lread;
*/
};
case 10: {//5p: CR4
clippedAdN = clippedInfo;
memmove(seqNum, seqNum+clippedAdN, Lread-clippedAdN);
break;
};
case 11: {//3p: CR4, polyA
clippedAdN = cr4->polyTail3p(seqNum, Lread);
};
};
Lread -= clippedAdN;
clippedN += clippedAdN;
};
if (NafterAd>0) {
if (Lread > NafterAd) {
Lread -= NafterAd;
clippedN += NafterAd;
if (type==0) {//5p. For 3p, no need to move sequence
memmove(seqNum, seqNum+NafterAd, Lread);
};
} else {//0-length after clipping
Lread=0;
clippedN=LreadOld;
};
};
return clippedN;
};
|