int main (int argc, char **argv) { int nrow = DEFAULT_NROW, which_seq = 0, do_order = 0, misses_allowed = 0, output_mode = -1; float cutoff = DEFAULT_CUTOFF; char *strand = NULL, *id = NULL; struct mafFile *file = NULL; struct mafAli *ali = NULL; struct mafComp *comp = NULL; struct MOTIF *motif = NULL; struct MATCH *matches = NULL; id = ckalloc (STRSIZE); get_args (argc, argv, &output_mode, &file, &id, &motif, &do_order, &nrow, &cutoff, &misses_allowed); strand = ckalloc (sizeof (char) * (nrow + 1)); while (NULL != (ali = mafNext (file))) { for (comp = ali->components, which_seq = 0; comp; comp = comp->next, which_seq++) strand[which_seq] = comp->strand; strand[which_seq] = '\0'; /* skip blocks that don't have all seqs in them */ if (which_seq != nrow) { mafAliFree (&ali); continue; } /* forward strand */ get_matches (&matches, FORWARD, ali, nrow, motif, do_order, misses_allowed); /* reverse strand */ for (comp = ali->components; comp; comp = comp->next) do_revcomp((uchar *)comp->text, ali->textSize ); get_matches (&matches, REVERSE, ali, nrow, motif, do_order, misses_allowed); /* output matches */ if (matches) output_matches (matches, strand, id, nrow, motif); free_match_list (&matches); mafAliFree (&ali); } mafFileFree (&file); free (strand); free_motif_list (&motif); free (id); return 0; }
SEQ *seq_revcomp_inplace(SEQ *seq) { do_revcomp(SEQ_CHARS(seq), SEQ_LEN(seq)); seq->flags ^= SEQ_IS_REVCOMP; return seq; }