3a729cfecfb1a7fe3d219501174d5e419cd4177f kent Wed Sep 28 12:15:57 2011 -0700 Making a utility to compare two lists of IDs. diff --git src/utils/vennIds/vennIds.c src/utils/vennIds/vennIds.c new file mode 100644 index 0000000..045142a --- /dev/null +++ src/utils/vennIds/vennIds.c @@ -0,0 +1,124 @@ +/* vennIds - From two lists of unique IDs, calculate number shared between each list and number + * only in each list.. */ +#include "common.h" +#include "linefile.h" +#include "hash.h" +#include "options.h" +#include "obscure.h" + +static char const rcsid[] = "$Id: newProg.c,v 1.30 2010/03/24 21:18:33 hiram Exp $"; + +void usage() +/* Explain usage and exit. */ +{ +errAbort( + "vennIds - From two lists of unique IDs, calculate number shared between each list and number\n" + "only in each list.\n" + "usage:\n" + " vennIds a.lst b.lst\n" + "where a.lst and b.lst are whitespace delimited files of IDs\n" + "options:\n" + " -both=both.out\n - if set put ids that are in both here, one per line" + " -aOnly=aOnly.out - if set put ids that are in a.lst only here, one per line\n" + " -bOnly=bOnly.out - if set put ids that are in b.lst only here, one per line\n" + ); +} + +static struct optionSpec options[] = { + {"aOnly", OPTION_STRING}, + {"bOnly", OPTION_STRING}, + {NULL, 0}, +}; + +struct hash *hashUniqueWords(char *fileName, char **words, int wordCount) +/* Create a new hash filled with words, checking that they are unique. */ +{ +struct hash *hash = hashNew(0); +int i; +for (i=0; i