Path: blob/main/biology/emboss/files/emboss.c
16461 views
/***************************************************************************1* Description:2* Wrapper to turn emboss commands into subcommands. The emboss suite3* contains executables that conflict with multiple other software4* packages and therefore cannot be safely installed directly under a5* standard prefix. This wrapper can be installed under the standard6* PATH and used to to execute emboss commands installed under a7* private prefix, without altering PATH, activating a special8* environment, opening a container, etc. This sub-command paradigm9* is already familiar to bioinformaticians thanks to other suites10* like samtools, bedtools, etc.11*12* Example:13*14* emboss seqret args15*16* instead of one of the following:17*18* prefix/bin/seqret args19*20* env PATH=prefix/bin:$PATH seqret args21*22* conda activate emboss23* seqret args24*25* Arguments:26* The full emboss command you would use if it were in PATH.27*28* Compile with EMBOSS_PREFIX set to the parent of the bin directory29* containing the emboss binaries.30*31* History:32* Date Name Modification33* 2021-09-13 Jason Bacon Begin34***************************************************************************/3536#include <stdio.h>37#include <sysexits.h>38#include <limits.h>39#include <unistd.h>4041#ifndef EMBOSS_PREFIX42#define EMBOSS_PREFIX "/usr/local/emboss"43#endif4445int main(int argc,char *argv[])4647{48char cmd[PATH_MAX + 1];4950if ( argc < 2 )51{52fprintf(stderr, "Usage: %s emboss-command [args]\n", argv[0]);53return EX_USAGE;54}5556snprintf(cmd, PATH_MAX, "%s/bin/%s", EMBOSS_PREFIX, argv[1]);57execv(cmd, argv + 1);58}596061