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_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); }