void print_lav_match (FILE* f, seq* seq1, unspos pos1, seq* seq2, unspos pos2, unspos length, score s) { seqpartition* sp1 = &seq1->partition; seqpartition* sp2 = &seq2->partition; unspos end1 = pos1 + length; unspos end2 = pos2 + length; int pctId; if ((sp1->p != NULL) || (sp2->p != NULL)) suicide ("lav format can't handle multi-sequences"); // compute percent identity pctId = percent_identical (seq1, pos1, seq2, pos2, length); // print it fprintf (f, "a {\n"); fprintf (f, " s " scoreFmtSimple "\n", s); fprintf (f, " b " unsposFmt " " unsposFmt "\n", pos1+1, pos2+1); fprintf (f, " e " unsposFmt " " unsposFmt "\n", end1, end2); fprintf (f, " l " unsposFmt " " unsposFmt " " unsposFmt " " unsposFmt " %d\n", pos1+1, pos2+1, end1, end2, pctId); fprintf (f, "}\n"); }
static void print_match_composition (FILE* f, seq* seq1, unspos pos1, seq* seq2, unspos pos2, unspos length, score s, seed* hitSeed, u32 step) { int pctId; unspos count[4][4]; float p; char pstr[6]; int ix, iy; // compute percent identity, match compostion, and discovery probability pctId = percent_identical (seq1, pos1, seq2, pos2, length); match_composition (seq1, pos1, seq2, pos2, length, count); p = discovery_probability (seq1, pos1+length, seq2, pos2+length, length, hitSeed, step); // convert discovery probability to a string if (p < 0.0) p = 0.0; else if (p > 1.0) p = 1.0; snprintf (pstr, sizeof(pstr), "%.3f", p); if (pstr[0] == '1') // (1.000 -> 1.00) pstr[4] = 0; else // (0.XXX -> .XXX) { pstr[0] = pstr[1]; pstr[1] = pstr[2]; pstr[2] = pstr[3]; pstr[3] = pstr[4]; pstr[4] = 0; } // print it fprintf (f, "%d " scoreFmtSimple " " unsposSlashSFmt " " unsposFmt " %s", pctId, s, pos1+1, ((seq1->revCompFlags & rcf_rev) != 0)? "-" : "+", pos2+1, ((seq2->revCompFlags & rcf_rev) != 0)? "-" : "+", length, pstr); for (ix=0 ; ix<4 ; ix++) for (iy=0 ; iy<4 ; iy++) fprintf (f, " " unsposFmt, count[ix][iy]); fprintf (f, "\n"); }