-
Notifications
You must be signed in to change notification settings - Fork 44
/
main.c
62 lines (58 loc) · 2.04 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
#include <string.h>
#include <stdio.h>
#include <pthread.h>
#include "htslib/hts.h"
#include "version.h" //This has the VERSION define
pthread_mutex_t positionMutex;
pthread_mutex_t bwMutex;
pthread_mutex_t outputMutex;
uint32_t globalTid = 0;
uint32_t globalPos = 0;
uint32_t globalEnd = 0;
uint32_t bin = 0;
uint32_t outputBin = 0;
uint64_t globalnVariantPositions = 0;
int mbias_main(int argc, char *argv[]);
int extract_main(int argc, char *argv[]);
int mergeContext_main(int argc, char *argv[]);
int perRead_main(int argc, char *argv[]);
void print_version(void);
void usage_main() {
fprintf(stderr, "MethylDackel: A tool for processing bisulfite sequencing alignments.\n"
"Version: %s (using HTSlib version %s)\n", VERSION, hts_version());
fprintf(stderr,
"Usage: MethylDackel <command> [options]\n\n"
"Commands:\n"
" mbias Determine the position-dependent methylation bias in a dataset,\n"
" producing diagnostic SVG images.\n"
" extract Extract methylation metrics from an alignment file in BAM/CRAM\n"
" format.\n"
" mergeContext Combine single Cytosine metrics from 'MethylDackel extract' into\n"
" per-CpG/CHG metrics.\n"
" perRead Generate a per-read methylation summary.\n"
);
}
int main(int argc, char *argv[]) {
if(argc == 1) {
usage_main();
return 0;
} else if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
usage_main();
return 0;
} else if(strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0) {
print_version();
return 0;
} else if(strcmp(argv[1], "extract") == 0) {
return extract_main(argc-1, argv+1);
} else if(strcmp(argv[1], "mbias") == 0) {
return mbias_main(argc-1, argv+1);
} else if(strcmp(argv[1], "mergeContext") == 0) {
return mergeContext_main(argc-1, argv+1);
} else if(strcmp(argv[1], "perRead") == 0) {
return perRead_main(argc-1, argv+1);
} else {
fprintf(stderr, "Unknown command!\n");
usage_main();
return -1;
}
}