alignel* filter_aligns_by_num_gaps (alignel* alignList, s32 maxSeparateGapsCount) { alignel* a, *next; alignel* head, *prev; unspos height, width, i, j, run; u32 opIx; s32 numGaps; // process each alignment, collecting a list of those that are long enough head = prev = NULL; for (a=alignList ; a!=NULL ; a=next) { next = a->next; // if the alignment is too gappy, skip it numGaps = 0; height = a->end1 - a->beg1 + 1; width = a->end2 - a->beg2 + 1; opIx = 0; for (i=j=0 ; (i<height)||(j<width) ; ) { // handle the next run run = edit_script_run_of_subs (a->script, &opIx); i += run; j += run; // handle the next indel if ((i < height) || (j < width)) { edit_script_indel_len (a->script, &opIx, &i, &j); if (++numGaps > maxSeparateGapsCount) break; } } if (numGaps > maxSeparateGapsCount) { // (unwanted alignment, discard it) free_if_valid ("filter_aligns_by_continuity a->script", a->script); free_if_valid ("filter_aligns_by_continuity a", a); continue; } // this alignment is ok, add it to the end of the new list we're // building if (head == NULL) head = prev = a; else { prev->next = a; prev = a; } a->next = NULL; } return head; }
alignel* filter_aligns_by_continuity (alignel* alignList, float minContinuity, float maxContinuity) { alignel* a, *next; alignel* head, *prev; unspos numer, denom; float minCont, maxCont; // process each alignment, collecting a list of those that are long enough head = prev = NULL; for (a=alignList ; a!=NULL ; a=next) { next = a->next; // if the alignment is too gappy, skip it alignment_continuity (a, &numer, &denom); minCont = denom * minContinuity; maxCont = denom * maxContinuity; if ((numer < minCont) || (numer > maxCont)) { // (unwanted alignment, discard it) free_if_valid ("filter_aligns_by_continuity a->script", a->script); free_if_valid ("filter_aligns_by_continuity a", a); continue; } // this alignment is ok, add it to the end of the new list we're // building if (head == NULL) head = prev = a; else { prev->next = a; prev = a; } a->next = NULL; } return head; }
alignel* filter_aligns_by_num_gap_columns (alignel* alignList, s32 maxGapColumnsCount) { alignel* a, *next; alignel* head, *prev; unspos numer, denom; // process each alignment, collecting a list of those that are long enough head = prev = NULL; for (a=alignList ; a!=NULL ; a=next) { next = a->next; // if the alignment is too gappy, skip it alignment_continuity (a, &numer, &denom); if ((denom == 0) || (denom-numer > (u32) maxGapColumnsCount)) { // (unwanted alignment, discard it) free_if_valid ("filter_aligns_by_continuity a->script", a->script); free_if_valid ("filter_aligns_by_continuity a", a); continue; } // this alignment is ok, add it to the end of the new list we're // building if (head == NULL) head = prev = a; else { prev->next = a; prev = a; } a->next = NULL; } return head; }
void free_diag_hash (void) { free_if_valid ("free_diag_hash (diagEnd)", diagEnd); diagEnd = NULL; free_if_valid ("free_diag_hash (diagStart)", diagStart); diagStart = NULL; free_if_valid ("free_diag_hash (diagActual)", diagActual); diagActual = NULL; free_if_valid ("free_diag_hash (diagActive)", diagActive); diagActive = NULL; #ifndef noSeedHitQueue free_if_valid ("free_diag_hash (seedHitQueue)", seedHitQueue); seedHitQueue = NULL; free_if_valid ("free_diag_hash (lastSeedHit)", lastSeedHit); lastSeedHit = NULL; #endif // not noSeedHitQueue }
void free_segment_table (segtable* st) { free_if_valid ("free_segment_table", st); }