From 161d3a1b45867a3681cf35d9f88cedf5c8a7ed74 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Tue, 16 Oct 2012 21:25:40 +0330 Subject: [PATCH] meval: count the complexes containing a motif --- Makefile | 4 +++- meval.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 meval.c diff --git a/Makefile b/Makefile index 5be4c43..4c10d3d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = cc CFLAGS = -O2 -Wall LDFLAGS = -lpthread -all: rangi conv genrq +all: rangi conv genrq meval %.o: %.c rangi.h $(CC) -c $(CFLAGS) $< rangi: rangi.o mat.o proc.o @@ -11,5 +11,7 @@ conv: conv.o tab.o $(CC) -o $@ $^ $(LDFLAGS) genrq: genrq.o $(CC) -o $@ $^ $(LDFLAGS) +meval: meval.o + $(CC) -o $@ $^ $(LDFLAGS) clean: rm -f *.o rangi conv genrq diff --git a/meval.c b/meval.c new file mode 100644 index 0000000..206a636 --- /dev/null +++ b/meval.c @@ -0,0 +1,57 @@ +/* + * meval, count the complexes containing a motif + * + * Copyright (C) 2012 Ali Gholami Rudi + * + * This program is released under the modified BSD license. + */ +#include +#include +#include + +#define NPROTS (1024) +#define NLEN (128) + +static int readcmplx(char cmplx[][NLEN], char *s) +{ + int n = 0; + while (*s && *s != '\t') + s++; + while (*s) { + char *d = cmplx[n++]; + while (*s && !isspace(*s)) + *d++ = *s++; + *d = '\0'; + while (*s && isspace(*s)) + s++; + } + return n; +} + +int main(int argc, char *argv[]) +{ + char cmplx[NPROTS][NLEN]; + char **query = argv + 1; + int qlen = argc - 1; + char line[4096]; + int i, j; + int matches = 0; + if (!qlen) { + printf("usage: %s PROT1 PROT2 ...