Example #1
0
main(int argc, char* argv[])
{
   SeqStructPtr seqP;
   int count;

   if (argc != 2)
     {
        fprintf(stderr,"Usage: %s <fasta format sequence file name>\n", argv[0]);
        exit(1);
     }

   openFile(argv[1]);

   initBuffer();

   count = 0;
   while (! endOfFile) 
     if (seqP = getSeq(argv[1]))
       {
#ifdef DEBUG_SPUTNIK
          fprintf(stdout,"processing sequence %d\n", count++);
#endif
          /* dumpSeq(seqP); */
          findRepeats(seqP);
          free((void *)seqP);
       }
}
Example #2
0
static
bool requiresDedupe(const NGHolder &h, const flat_set<ReportID> &reports,
                    const Grey &grey) {
    /* TODO: tighten */
    NFAVertex seen_vert = NGHolder::null_vertex();

    for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
        if (has_intersection(h[v].reports, reports)) {
            if (seen_vert != NGHolder::null_vertex()) {
                return true;
            }
            seen_vert = v;
        }
    }

    for (auto v : inv_adjacent_vertices_range(h.acceptEod, h)) {
        if (has_intersection(h[v].reports, reports)) {
            if (seen_vert != NGHolder::null_vertex()) {
                return true;
            }
            seen_vert = v;
        }
    }

    if (seen_vert) {
        /* if the reporting vertex is part of of a terminal repeat, the
         * construction process may reform the graph splitting it into two
         * vertices (pos, cyclic) and hence require dedupe */
        vector<GraphRepeatInfo> repeats;
        findRepeats(h, grey.minExtBoundedRepeatSize, &repeats);
        for (const auto &repeat : repeats) {
            if (find(repeat.vertices.begin(), repeat.vertices.end(),
                     seen_vert) != repeat.vertices.end()) {
                return true;
            }
        }
    }

    return false;
}