-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
78 lines (71 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Philip T.L.C. Clausen Jan 2017 [email protected] */
/*
* Copyright (c) 2017, Philip Clausen, Technical University of Denmark
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _XOPEN_SOURCE 600
#include <string.h>
#include "db.h"
#include "dist.h"
#include "kma.h"
#include "index.h"
#include "shm.h"
#include "seq2fasta.h"
#include "trim.h"
#include "update.h"
static int helpmessage(FILE *out) {
fprintf(out, "# KMA enables alignment towards databases, using two k-mer mapping steps and one alignment step.\n");
fprintf(out, "# %16s\t%-32s\n", "Options are:", "Desc:");
fprintf(out, "# %16s\t%-32s\n", "", "Alignment and mapping");
fprintf(out, "# %16s\t%-32s\n", "index", "Indexing of databases");
fprintf(out, "# %16s\t%-32s\n", "shm", "Shared memory");
fprintf(out, "# %16s\t%-32s\n", "seq2fasta", "Conversion of database to fasta");
fprintf(out, "# %16s\t%-32s\n", "dist", "Calculate distance measures between templates");
fprintf(out, "# %16s\t%-32s\n", "db", "Make statistics on KMA db");
fprintf(out, "# %16s\t%-32s\n", "update", "Update database to current version");
fprintf(out, "# %16s\t%-32s\n", "trim", "trim sequences");
fprintf(out, "# %16s\t%-32s\n", "-c", "Citation");
fprintf(out, "# %16s\t%-32s\n", "-v", "Version");
fprintf(out, "# %16s\t%-32s\n", "-h", "Help on alignment and mapping");
return 1;
}
int main(int argc, char *argv[]) {
int status;
if(argc != 1) {
if(**++argv == '-') {
status = kma_main(argc, --argv);
} else if(--argc && strcmp(*argv, "index") == 0) {
status = index_main(argc, argv);
} else if(strcmp(*argv, "shm") == 0) {
status = shm_main(argc, argv);
} else if(strcmp(*argv, "seq2fasta") == 0) {
status = seq2fasta_main(argc, argv);
} else if(strcmp(*argv, "dist") == 0) {
status = dist_main(argc, argv);
} else if(strcmp(*argv, "update") == 0) {
status = update_main(argc, argv);
} else if(strcmp(*argv, "db") == 0) {
status = db_main(argc, argv);
} else if(strcmp(*argv, "trim") == 0) {
status = trim_main(argc, argv);
} else {
fprintf(stderr, "Invalid option:\t%s\n", *argv);
status = helpmessage(stderr);
}
} else {
status = helpmessage(stdout);
}
return status;
}