/* * pops the top state off the stack */ static JSON_EN pop_state(LINKLST_T* stack) { JSON_EN *allocated_state, state; if (!linklst_size(stack)) return JSON_ERROR; allocated_state = linklst_pop(stack); state = *allocated_state; free(allocated_state); return state; }
/************************************************************************** * Outputs txt for the spacings **************************************************************************/ void output_secondary_motif_txt(FILE *txt_output, MOTIF_DB_T *primary_db, MOTIF_T *primary_motif, SECONDARY_MOTIF_T *parent, SECONDARY_MOTIF_T *smotif, int n_secondary_motifs, LINKLST_T *rmotifs) { LINK_T *node; SIGSPACE_T sig; int i, quad; char* orient_names[NORIENTS]; // this maintains the previous definition of orientation but actual names would be better orient_names[LEFT | SAME] = "0"; orient_names[LEFT | OPPO] = "1"; orient_names[RIGHT | SAME] = "2"; orient_names[RIGHT | OPPO] = "3"; orient_names[UP_SEC_PAL] = "4"; orient_names[UP_PRI_PAL] = "5"; orient_names[DOWN_PRI_PAL] = "6"; orient_names[DOWN_SEC_PAL] = "7"; orient_names[BOTH_PAL] = "8"; for (i = 0; i < smotif->sig_count; ++i) { sig = smotif->sigs[i]; // Output txt line. fprintf(txt_output, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%d\t%s\t%s\t%s\t%.2e\t%d\t%s\t%d\t%d\t%.2e\t%.2e\n", primary_db->name, get_motif_id(primary_motif), strcmp(get_motif_id2(primary_motif), "") ? get_motif_id2(primary_motif) : ".", get_motif_consensus(primary_motif), smotif->db->name, get_motif_id(smotif->motif), strcmp(get_motif_id2(smotif->motif), "") ? get_motif_id2(smotif->motif) : ".", get_motif_consensus(smotif->motif), get_motif_trim_left(smotif->motif), get_motif_trim_right(smotif->motif), parent ? smotif->db->name : ".", parent ? get_motif_id(parent->motif) : ".", parent && strcmp(get_motif_id2(parent->motif), "") ? get_motif_id2(parent->motif) : ".", smotif->min_pvalue * n_secondary_motifs, // E-value sig.bin, // gap orient_names[sig.orient], // orientation smotif->spacings[sig.orient].count[sig.bin], // count smotif->total_spacings, // total occurrences of secondary in margins sig.pvalue < 1e-10 ? sig.pvalue/NORIENTS : 1-pow((1-sig.pvalue),1.0/NORIENTS), sig.pvalue ); } if (rmotifs != NULL && linklst_size(rmotifs) > 0) { for (node = linklst_first(rmotifs); node != NULL; node = linklst_next(node)) { SECONDARY_MOTIF_T *rmotif = linklst_get(node); output_secondary_motif_txt(txt_output, primary_db, primary_motif, smotif, rmotif, n_secondary_motifs, NULL); } } }
short dxml_has_error(void *data) { DXML_T *parser; parser = (DXML_T*)data; return linklst_size(parser->data->errors) > 0; }
short dxml_has_motif(void *data) { DXML_T *parser; parser = (DXML_T*)data; return linklst_size(parser->data->motif_queue) > 0; }
/***************************************************************************** * Check if the parser has found a problem with the file that has not already * been returned. ****************************************************************************/ short mxml_has_warning(void *data) { MXML_T *parser; parser = (MXML_T*)data; return linklst_size(parser->data->warnings) > 0; }