void Sim4::remove_polyT_front(struct edit_script_list **Sptr, Exon *Exons, char *s1, char *s2, int *lastT) { Exon *t, *exons_head; /* start from Lblock */ char *b, *end; int numT, dummy, trim_p, reverse_script=0, pT; int startPos=0, cutAmount=0; *lastT = pT = 0; if (!Exons || !Exons->next_exon || !Exons->next_exon->toGEN) return; if ((*Sptr)->next_script && (*Sptr)->offset1>(*Sptr)->next_script->offset1) { script_flip_list(Sptr); reverse_script = 1; } exons_head = Exons->next_exon; trim_p = 1; if (exons_head) { startPos = exons_head->frEST; while ((t=exons_head)!=NULL && t->toGEN && trim_p) { /* compute the 'T' contents of the exon */ b = s2 + t->frEST-1; end = s2+t->toEST; numT = 0; while (b<end && (numT+t->toEST-(b-s2)>=globalParams->_polyTailPercent*t->length)) { numT += (*b++=='T'); } // Determine how much of the cut stuff was actually // poly-containing. The first method below returns the number of // bases cut from the end of the est, while the second return the // number of bases cut from the end of the alignment. // //cutAmount = l2 - *lastT + 1; if (numT>=globalParams->_polyTailPercent*t->length) { /* remove the entire exon */ trim_polyT_align(Sptr,&exons_head,t->toEST,lastT,s1,s2); cutAmount = *lastT - startPos + 1; } else { get_polyAT(s2+(*Sptr)->offset2-1,(*Sptr)->len2,&pT,&dummy,T_ONLY); if (pT) { int ct_pT; ct_pT = pT + (*Sptr)->offset2-1; ct_pT = (t->toEST-ct_pT>MIN_EXON) ? ct_pT : t->toEST; trim_polyT_align(Sptr,&exons_head,ct_pT,lastT,s1,s2); cutAmount = *lastT - startPos + 1; } if (t==exons_head) trim_p = 0; } } } Exons->next_exon = exons_head; *lastT = cutAmount; if (reverse_script) script_flip_list(Sptr); }
static void remove_polyA_back(struct edit_script_list **Sptr, Exon *Exons, uchar *s1, uchar *s2, int len2, int *lastA) { Exon *t, *exons_tail, *prev; /* start from Lblock */ uchar *b, *end; int numA, pA, dummy, trim_p, reverse_script=0; *lastA = len2+1; pA = 0; if (!Exons || ! Exons->next_exon || ! Exons->next_exon->to1) return; if ((*Sptr)->next_script && (*Sptr)->offset1<(*Sptr)->next_script->offset1) { reverse_script = 1; script_flip_list(Sptr); } exons_tail = Exons->next_exon; prev = Exons; for ( ; exons_tail->next_exon && exons_tail->next_exon->to1; prev=exons_tail, exons_tail=exons_tail->next_exon); trim_p = TRUE; while ((t=exons_tail)!=NULL && t->to1 && trim_p) { /* compute the 'A' contents of the exon */ b = s2 + t->to2-1; end = s2+t->from2-1; numA = 0; while (b>=end && numA+(b-s2)>=.60*t->length) { numA += (*b--=='A'); } if (numA>=.60*t->length) { /* remove the entire exon */ trim_polyA_align(Sptr,Exons,&exons_tail,t->from2,lastA,s1,s2); /* assert(*lastA==t->from2); t was removed */ } else { get_polyAT(s2+(*Sptr)->offset2-1,(*Sptr)->len2,&dummy,&pA,A_ONLY); if (pA) { int ct_pA; /* first position to be removed */ ct_pA = t->to2-pA+1; ct_pA = (ct_pA-t->from2>=MIN_EXON) ? ct_pA : t->from2; /* note: pA is the last (innermost) position in the tail */ trim_polyA_align(Sptr,Exons,&exons_tail,ct_pA,lastA,s1,s2); } if (t==exons_tail) trim_p = FALSE; } } if (reverse_script) script_flip_list(Sptr); }
static void remove_polyT_front(struct edit_script_list **Sptr, Exon *Exons, uchar *s1, uchar *s2, int *lastT) { Exon *t, *exons_head; /* start from Lblock */ uchar *b, *end; int numT, dummy, trim_p, reverse_script=0, pT; *lastT = pT = 0; if (!Exons || !Exons->next_exon || !Exons->next_exon->to1) return; if ((*Sptr)->next_script && (*Sptr)->offset1>(*Sptr)->next_script->offset1) { script_flip_list(Sptr); reverse_script = 1; } exons_head = Exons->next_exon; trim_p = TRUE; while ((t=exons_head)!=NULL && t->to1 && trim_p) { /* compute the 'T' contents of the exon */ b = s2 + t->from2-1; end = s2+t->to2; numT = 0; while (b<end && (numT+t->to2-(b-s2-t->from2+1)>=.60*t->length)) { numT += (*b++=='T'); } if (numT>=.60*t->length) { /* remove the entire exon */ trim_polyT_align(Sptr,&exons_head,t->to2,lastT,s1,s2); /* assert(*lastT==t->to2); t was removed */ } else { get_polyAT(s2+(*Sptr)->offset2-1,(*Sptr)->len2,&pT,&dummy,T_ONLY); if (pT) { int ct_pT; ct_pT = pT + (*Sptr)->offset2-1; ct_pT = (t->to2-ct_pT>=MIN_EXON) ? ct_pT : t->to2; trim_polyT_align(Sptr,&exons_head,ct_pT,lastT,s1,s2); } if (t==exons_head) trim_p = FALSE; } } Exons->next_exon = exons_head; if (reverse_script) script_flip_list(Sptr); }
void Sim4::remove_polyA_back(struct edit_script_list **Sptr, Exon *Exons, char *s1, char *s2, int l2, int *lastA) { Exon *t; Exon *exons_tail; char *b, *end; int numA, pA, dummy, trim_p, reverse_script=0; int startPos=0, cutAmount=0; *lastA = l2+1; pA = 0; if (!Exons || ! Exons->next_exon || ! Exons->next_exon->toGEN) return; if ((*Sptr)->next_script && (*Sptr)->offset1<(*Sptr)->next_script->offset1) { reverse_script = 1; script_flip_list(Sptr); } exons_tail = Exons->next_exon; while (exons_tail->next_exon && exons_tail->next_exon->toGEN) exons_tail=exons_tail->next_exon; trim_p = 1; if (exons_tail) { startPos = exons_tail->toEST; while ((t=exons_tail)!=NULL && t->toGEN && trim_p) { /* compute the 'A' contents of the exon */ b = s2 + t->toEST-1; end = s2+t->frEST-1; numA = 0; while (b>=end && numA+(b-end)>=globalParams->_polyTailPercent*t->length) { numA += (*b--=='A'); } // Determine how much of the cut stuff was actually // poly-containing. The first method below returns the number of // bases cut from the end of the est, while the second return the // number of bases cut from the end of the alignment. // //cutAmount = l2 - *lastA + 1; if (numA>=globalParams->_polyTailPercent*t->length) { /* remove the entire exon */ trim_polyA_align(Sptr,Exons,&exons_tail,t->frEST,lastA,s1,s2); cutAmount = startPos - *lastA + 1; } else { get_polyAT(s2+(*Sptr)->offset2-1,(*Sptr)->len2,&dummy,&pA,A_ONLY); if (pA) { int ct_pA; /* first position to be removed */ ct_pA = t->toEST-pA+1; ct_pA = (ct_pA-t->frEST>MIN_EXON) ? ct_pA : t->frEST; /* note: pA is the last (innermost) position in the tail */ trim_polyA_align(Sptr,Exons,&exons_tail,ct_pA,lastA,s1,s2); cutAmount = startPos - *lastA + 1; } if (t==exons_tail) trim_p = 0; } } } *lastA = cutAmount; if (reverse_script) script_flip_list(Sptr); }