-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.c
64 lines (55 loc) · 2.67 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int create_main(int argc, char **argv);
int view_main(int argc, char **argv);
int denoise_main(int argc, char **argv);
int histo_main(int argc, char **argv);
int htest_main(int argc, char **argv);
int dmodel_main(int argc, char **argv);
int est_dmodel_main(int argc, char **argv);
int lrdmodel_main(int argc, char **argv);
static int usage(char **argv)
{
printf("\nUsage: %s <command> [options]\n\n", argv[0]);
printf("Main commands:\n");
printf(" create - Create bindump from bam file that subsequent\n");
printf(" analysis will take as input.\n");
printf(" view - Inspect contents of bindump and apply filters\n");
printf(" to it.\n");
printf(" histo - Show ASCII histogram of frequencies in bindump.\n");
printf(" \n");
printf(" lrdmodel - Use the GMM to combine the fixed and free models\n");
printf(" and assess the delta-log-likelihood.\n");
printf(" denoise - Use the GMMU model to detect and remove a uniform\n");
printf(" baseline from the histogram.\n\n");
printf("other:\n");
printf(" modeltest - Use the GMM based test against the three fixed\n");
printf(" models.\n");
printf(" estmodel - Use the GMM to estimate the free model.\n");
printf(" \n");
printf(" histotest - Use a simple, linear regression based test against\n");
printf(" the three fixed models.\n\n");
printf("Please run any of these commands without arguments for usage instructions.\n\n");
printf("For further documentation please also refer to the online manual\n");
printf("at https://github.com/clwgg/nQuire or the README.org file.\n\n");
return 1;
}
int main(int argc, char **argv)
{
if (argc < 2) return usage(argv);
int ret = 0;
if (strcmp(argv[1], "create") == 0) ret = create_main(argc-1, argv+1);
else if (strcmp(argv[1], "view") == 0) ret = view_main(argc-1, argv+1);
else if (strcmp(argv[1], "denoise") == 0) ret = denoise_main(argc-1, argv+1);
else if (strcmp(argv[1], "histo") == 0) ret = histo_main(argc-1, argv+1);
else if (strcmp(argv[1], "histotest") == 0) ret = htest_main(argc-1, argv+1);
else if (strcmp(argv[1], "modeltest") == 0) ret = dmodel_main(argc-1, argv+1);
else if (strcmp(argv[1], "estmodel") == 0) ret = est_dmodel_main(argc-1, argv+1);
else if (strcmp(argv[1], "lrdmodel") == 0) ret = lrdmodel_main(argc-1, argv+1);
else {
fprintf(stderr, "Unknown command %s\n", argv[1]);
usage(argv);
}
return ret;
}