00001
00002
00003
00004
00005 #include "common.h"
00006 #include "nt4.h"
00007 #include "xenalign.h"
00008
00009 static char const rcsid[] = "$Id: xenshow.c,v 1.5 2003/05/06 07:33:44 kate Exp $";
00010
00011 static void printMatchers(char *a, char *b, int lineSize, FILE *f)
00012
00013 {
00014 int i;
00015 for (i=0; i<lineSize; ++i)
00016 {
00017 char c = ((a[i] == b[i]) ? '|' : ' ');
00018 fputc(c, f);
00019 }
00020 }
00021
00022 static int nonDashCount(char *s, int size)
00023
00024
00025 {
00026 int count = 0;
00027 int i;
00028 for (i=0; i<size; ++i)
00029 if (s[i] != '-')
00030 ++count;
00031 return count;
00032 }
00033
00034 void xenShowAli(char *qSym, char *tSym, char *hSym, int symCount, FILE *f,
00035 int qOffset, int tOffset, char qStrand, char tStrand, int maxLineSize)
00036
00037 {
00038 int i;
00039 int lineSize;
00040 int count;
00041
00042 for (i=0; i<symCount; i += lineSize)
00043 {
00044 lineSize = symCount - i;
00045 if (lineSize > maxLineSize) lineSize = maxLineSize;
00046 mustWrite(f, qSym+i, lineSize);
00047 count = nonDashCount(qSym+i, lineSize);
00048 if (qStrand == '-')
00049 count = -count;
00050 qOffset += count;
00051 fprintf(f, " %9d\n", qOffset);
00052 printMatchers(qSym+i, tSym+i, lineSize, f);
00053 fputc('\n', f);
00054 mustWrite(f, tSym+i, lineSize);
00055 count = nonDashCount(tSym+i, lineSize);
00056 if (tStrand == '-')
00057 count = -count;
00058 tOffset += count;
00059 fprintf(f, " %9d\n", tOffset);
00060 mustWrite(f, hSym+i, lineSize);
00061 fputc('\n', f);
00062 fputc('\n', f);
00063 }
00064 }
00065