Mercurial > repos > siyuan > prada
comparison pyPRADA_1.2/tools/samtools-0.1.16/bamtk.c @ 0:acc2ca1a3ba4
Uploaded
author | siyuan |
---|---|
date | Thu, 20 Feb 2014 00:44:58 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:acc2ca1a3ba4 |
---|---|
1 #include <stdio.h> | |
2 #include <unistd.h> | |
3 #include <assert.h> | |
4 #include <fcntl.h> | |
5 #include "bam.h" | |
6 | |
7 #ifdef _USE_KNETFILE | |
8 #include "knetfile.h" | |
9 #endif | |
10 | |
11 int bam_taf2baf(int argc, char *argv[]); | |
12 int bam_pileup(int argc, char *argv[]); | |
13 int bam_mpileup(int argc, char *argv[]); | |
14 int bam_merge(int argc, char *argv[]); | |
15 int bam_index(int argc, char *argv[]); | |
16 int bam_sort(int argc, char *argv[]); | |
17 int bam_tview_main(int argc, char *argv[]); | |
18 int bam_mating(int argc, char *argv[]); | |
19 int bam_rmdup(int argc, char *argv[]); | |
20 int bam_flagstat(int argc, char *argv[]); | |
21 int bam_fillmd(int argc, char *argv[]); | |
22 int bam_idxstats(int argc, char *argv[]); | |
23 int main_samview(int argc, char *argv[]); | |
24 int main_import(int argc, char *argv[]); | |
25 int main_reheader(int argc, char *argv[]); | |
26 int main_cut_target(int argc, char *argv[]); | |
27 int main_phase(int argc, char *argv[]); | |
28 int main_cat(int argc, char *argv[]); | |
29 int main_depth(int argc, char *argv[]); | |
30 | |
31 int faidx_main(int argc, char *argv[]); | |
32 int glf3_view_main(int argc, char *argv[]); | |
33 | |
34 static int usage() | |
35 { | |
36 fprintf(stderr, "\n"); | |
37 fprintf(stderr, "Program: samtools (Tools for alignments in the SAM format)\n"); | |
38 fprintf(stderr, "Version: %s\n\n", BAM_VERSION); | |
39 fprintf(stderr, "Usage: samtools <command> [options]\n\n"); | |
40 fprintf(stderr, "Command: view SAM<->BAM conversion\n"); | |
41 fprintf(stderr, " sort sort alignment file\n"); | |
42 fprintf(stderr, " pileup generate pileup output\n"); | |
43 fprintf(stderr, " mpileup multi-way pileup\n"); | |
44 fprintf(stderr, " depth compute the depth\n"); | |
45 fprintf(stderr, " faidx index/extract FASTA\n"); | |
46 #if _CURSES_LIB != 0 | |
47 fprintf(stderr, " tview text alignment viewer\n"); | |
48 #endif | |
49 fprintf(stderr, " index index alignment\n"); | |
50 fprintf(stderr, " idxstats BAM index stats (r595 or later)\n"); | |
51 fprintf(stderr, " fixmate fix mate information\n"); | |
52 fprintf(stderr, " glfview print GLFv3 file\n"); | |
53 fprintf(stderr, " flagstat simple stats\n"); | |
54 fprintf(stderr, " calmd recalculate MD/NM tags and '=' bases\n"); | |
55 fprintf(stderr, " merge merge sorted alignments\n"); | |
56 fprintf(stderr, " rmdup remove PCR duplicates\n"); | |
57 fprintf(stderr, " reheader replace BAM header\n"); | |
58 fprintf(stderr, " cat concatenate BAMs\n"); | |
59 fprintf(stderr, " targetcut cut fosmid regions (for fosmid pool only)\n"); | |
60 fprintf(stderr, " phase phase heterozygotes\n"); | |
61 fprintf(stderr, "\n"); | |
62 #ifdef _WIN32 | |
63 fprintf(stderr, "\ | |
64 Note: The Windows version of SAMtools is mainly designed for read-only\n\ | |
65 operations, such as viewing the alignments and generating the pileup.\n\ | |
66 Binary files generated by the Windows version may be buggy.\n\n"); | |
67 #endif | |
68 return 1; | |
69 } | |
70 | |
71 int main(int argc, char *argv[]) | |
72 { | |
73 #ifdef _WIN32 | |
74 setmode(fileno(stdout), O_BINARY); | |
75 setmode(fileno(stdin), O_BINARY); | |
76 #ifdef _USE_KNETFILE | |
77 knet_win32_init(); | |
78 #endif | |
79 #endif | |
80 if (argc < 2) return usage(); | |
81 if (strcmp(argv[1], "view") == 0) return main_samview(argc-1, argv+1); | |
82 else if (strcmp(argv[1], "import") == 0) return main_import(argc-1, argv+1); | |
83 else if (strcmp(argv[1], "pileup") == 0) return bam_pileup(argc-1, argv+1); | |
84 else if (strcmp(argv[1], "mpileup") == 0) return bam_mpileup(argc-1, argv+1); | |
85 else if (strcmp(argv[1], "merge") == 0) return bam_merge(argc-1, argv+1); | |
86 else if (strcmp(argv[1], "sort") == 0) return bam_sort(argc-1, argv+1); | |
87 else if (strcmp(argv[1], "index") == 0) return bam_index(argc-1, argv+1); | |
88 else if (strcmp(argv[1], "idxstats") == 0) return bam_idxstats(argc-1, argv+1); | |
89 else if (strcmp(argv[1], "faidx") == 0) return faidx_main(argc-1, argv+1); | |
90 else if (strcmp(argv[1], "fixmate") == 0) return bam_mating(argc-1, argv+1); | |
91 else if (strcmp(argv[1], "rmdup") == 0) return bam_rmdup(argc-1, argv+1); | |
92 else if (strcmp(argv[1], "glfview") == 0) return glf3_view_main(argc-1, argv+1); | |
93 else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1); | |
94 else if (strcmp(argv[1], "calmd") == 0) return bam_fillmd(argc-1, argv+1); | |
95 else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1); | |
96 else if (strcmp(argv[1], "reheader") == 0) return main_reheader(argc-1, argv+1); | |
97 else if (strcmp(argv[1], "cat") == 0) return main_cat(argc-1, argv+1); | |
98 else if (strcmp(argv[1], "targetcut") == 0) return main_cut_target(argc-1, argv+1); | |
99 else if (strcmp(argv[1], "phase") == 0) return main_phase(argc-1, argv+1); | |
100 else if (strcmp(argv[1], "depth") == 0) return main_depth(argc-1, argv+1); | |
101 #if _CURSES_LIB != 0 | |
102 else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1); | |
103 #endif | |
104 else { | |
105 fprintf(stderr, "[main] unrecognized command '%s'\n", argv[1]); | |
106 return 1; | |
107 } | |
108 return 0; | |
109 } |