02336754147822f5aa61ba13277123b2cc629001 markd Thu May 20 08:38:55 2021 -0700 Moved pslMap, pslMapPostChain, pslRc, pslSwap to src/utils, as they do not have hg/lib dependencies. diff --git src/utils/pslRc/pslRc.c src/utils/pslRc/pslRc.c new file mode 100644 index 0000000..bfd8ca7 --- /dev/null +++ src/utils/pslRc/pslRc.c @@ -0,0 +1,55 @@ +/* pslRc - reverse-complement psl */ + +#include "common.h" +#include "linefile.h" +#include "dnautil.h" +#include "options.h" +#include "psl.h" + +/* command line options */ +static struct optionSpec optionSpecs[] = { + {NULL, 0} +}; +boolean gNoRc = FALSE; + +void usage() +/* usage message and abort */ +{ +errAbort("pslRc - reverse-complement psl\n" + "usage:\n" + " pslRc [options] inPsl outPsl\n" + "\n" + "reverse-complement psl\n" + "\n" + "Options:\n"); +} + +void pslRcFile(char *inPslFile, char *outPslFile) +/* reverse target and query in a psl file */ +{ +struct lineFile *inLf = pslFileOpen(inPslFile); +FILE *outFh = mustOpen(outPslFile, "w"); +struct psl *psl; + +while ((psl = pslNext(inLf)) != NULL) + { + pslRc(psl); + pslTabOut(psl, outFh); + pslFree(&psl); + } + +carefulClose(&outFh); +lineFileClose(&inLf); +} + +int main(int argc, char** argv) +/* entry */ +{ +optionInit(&argc, argv, optionSpecs); +if (argc != 3) + usage("wrong # args"); +gNoRc = optionExists("noRc"); +dnaUtilOpen(); +pslRcFile(argv[1], argv[2]); +return 0; +}