Line 0
Link Here
|
|
|
1 |
/*************************************************************************** |
2 |
* Description: |
3 |
* Wrapper to turn emboss commands into subcommands. The emboss suite |
4 |
* contains executables that conflict with multiple other software |
5 |
* packages and therefore cannot be safely installed directly under a |
6 |
* standard prefix. This wrapper can be installed under the standard |
7 |
* PATH and used to to execute emboss commands installed under a |
8 |
* private prefix, without altering PATH, activating a special |
9 |
* environment, opening a container, etc. This sub-command paradigm |
10 |
* is already familiar to bioinformaticians thanks to other suites |
11 |
* like samtools, bedtools, etc. |
12 |
* |
13 |
* Example: |
14 |
* |
15 |
* emboss seqret args |
16 |
* |
17 |
* instead of one of the following: |
18 |
* |
19 |
* prefix/bin/seqret args |
20 |
* |
21 |
* env PATH=prefix/bin:$PATH seqret args |
22 |
* |
23 |
* conda activate emboss |
24 |
* seqret args |
25 |
* |
26 |
* Arguments: |
27 |
* The full emboss command you would use if it were in PATH. |
28 |
* |
29 |
* Compile with EMBOSS_PREFIX set to the parent of the bin directory |
30 |
* containing the emboss binaries. |
31 |
* |
32 |
* History: |
33 |
* Date Name Modification |
34 |
* 2021-09-13 Jason Bacon Begin |
35 |
***************************************************************************/ |
36 |
|
37 |
#include <stdio.h> |
38 |
#include <sysexits.h> |
39 |
#include <limits.h> |
40 |
#include <unistd.h> |
41 |
|
42 |
#ifndef EMBOSS_PREFIX |
43 |
#define EMBOSS_PREFIX "/usr/local/emboss" |
44 |
#endif |
45 |
|
46 |
int main(int argc,char *argv[]) |
47 |
|
48 |
{ |
49 |
char cmd[PATH_MAX + 1]; |
50 |
|
51 |
if ( argc < 2 ) |
52 |
{ |
53 |
fprintf(stderr, "Usage: %s emboss-command [args]\n", argv[0]); |
54 |
return EX_USAGE; |
55 |
} |
56 |
|
57 |
snprintf(cmd, PATH_MAX, "%s/bin/%s", EMBOSS_PREFIX, argv[1]); |
58 |
execv(cmd, argv + 1); |
59 |
} |