ruby-minigraph 0.0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/ext/Rakefile +56 -0
- data/ext/cmappy/cmappy.c +7 -0
- data/ext/cmappy/cmappy.h +8 -0
- data/ext/minigraph/LICENSE.txt +23 -0
- data/ext/minigraph/Makefile +66 -0
- data/ext/minigraph/NEWS.md +317 -0
- data/ext/minigraph/README.md +207 -0
- data/ext/minigraph/algo.c +194 -0
- data/ext/minigraph/algo.h +33 -0
- data/ext/minigraph/asm-call.c +147 -0
- data/ext/minigraph/bseq.c +133 -0
- data/ext/minigraph/bseq.h +76 -0
- data/ext/minigraph/cal_cov.c +139 -0
- data/ext/minigraph/doc/example1.png +0 -0
- data/ext/minigraph/doc/example2.png +0 -0
- data/ext/minigraph/doc/examples.graffle +0 -0
- data/ext/minigraph/format.c +241 -0
- data/ext/minigraph/galign.c +140 -0
- data/ext/minigraph/gchain1.c +532 -0
- data/ext/minigraph/gcmisc.c +223 -0
- data/ext/minigraph/gfa-aug.c +260 -0
- data/ext/minigraph/gfa-base.c +526 -0
- data/ext/minigraph/gfa-bbl.c +372 -0
- data/ext/minigraph/gfa-ed.c +617 -0
- data/ext/minigraph/gfa-io.c +395 -0
- data/ext/minigraph/gfa-priv.h +154 -0
- data/ext/minigraph/gfa.h +166 -0
- data/ext/minigraph/ggen.c +182 -0
- data/ext/minigraph/ggen.h +21 -0
- data/ext/minigraph/ggsimple.c +570 -0
- data/ext/minigraph/gmap.c +211 -0
- data/ext/minigraph/index.c +230 -0
- data/ext/minigraph/kalloc.c +224 -0
- data/ext/minigraph/kalloc.h +82 -0
- data/ext/minigraph/kavl.h +414 -0
- data/ext/minigraph/kdq.h +134 -0
- data/ext/minigraph/ketopt.h +116 -0
- data/ext/minigraph/khashl.h +348 -0
- data/ext/minigraph/krmq.h +474 -0
- data/ext/minigraph/kseq.h +256 -0
- data/ext/minigraph/ksort.h +164 -0
- data/ext/minigraph/kstring.h +165 -0
- data/ext/minigraph/kthread.c +159 -0
- data/ext/minigraph/kthread.h +15 -0
- data/ext/minigraph/kvec-km.h +105 -0
- data/ext/minigraph/kvec.h +110 -0
- data/ext/minigraph/lchain.c +441 -0
- data/ext/minigraph/main.c +301 -0
- data/ext/minigraph/map-algo.c +500 -0
- data/ext/minigraph/mgpriv.h +128 -0
- data/ext/minigraph/minigraph.1 +359 -0
- data/ext/minigraph/minigraph.h +176 -0
- data/ext/minigraph/miniwfa.c +834 -0
- data/ext/minigraph/miniwfa.h +95 -0
- data/ext/minigraph/misc/mgutils.js +1451 -0
- data/ext/minigraph/misc.c +12 -0
- data/ext/minigraph/options.c +134 -0
- data/ext/minigraph/shortk.c +251 -0
- data/ext/minigraph/sketch.c +109 -0
- data/ext/minigraph/sys.c +147 -0
- data/ext/minigraph/sys.h +20 -0
- data/ext/minigraph/test/MT-chimp.fa +277 -0
- data/ext/minigraph/test/MT-human.fa +239 -0
- data/ext/minigraph/test/MT-orangA.fa +276 -0
- data/ext/minigraph/test/MT.gfa +19 -0
- data/ext/minigraph/tex/Makefile +13 -0
- data/ext/minigraph/tex/minigraph.bib +676 -0
- data/ext/minigraph/tex/minigraph.tex +986 -0
- data/ext/minigraph/tex/plots/CHM13-f1-90.bb.anno.gp +42 -0
- data/ext/minigraph/tex/plots/CHM13-f1-90.bb.anno.tbl +13 -0
- data/ext/minigraph/tex/plots/CHM13-f1-90.bb.mini-inter-none.win.gp +269 -0
- data/ext/minigraph/tex/plots/CHM13-f1-90.bb.mini-inter-none.win.sh +7 -0
- data/ext/minigraph/tex/plots/CHM13v1.cen.bed +23 -0
- data/ext/minigraph/tex/plots/CHM13v1.size +23 -0
- data/ext/minigraph/tex/plots/anno2tbl.js +40 -0
- data/ext/minigraph/tex/plots/bedutils.js +367 -0
- data/ext/minigraph/tex/plots/chr-plot.js +130 -0
- data/ext/minigraph/tex/plots/gen-anno.mak +24 -0
- data/ext/minigraph.patch +21 -0
- data/lib/minigraph/ffi/constants.rb +230 -0
- data/lib/minigraph/ffi/functions.rb +70 -0
- data/lib/minigraph/ffi/mappy.rb +8 -0
- data/lib/minigraph/ffi.rb +27 -0
- data/lib/minigraph/version.rb +5 -0
- data/lib/minigraph.rb +72 -0
- metadata +159 -0
@@ -0,0 +1,301 @@
|
|
1
|
+
#include <stdlib.h>
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <string.h>
|
4
|
+
#include "mgpriv.h"
|
5
|
+
#include "gfa-priv.h"
|
6
|
+
#include "sys.h"
|
7
|
+
#include "ketopt.h"
|
8
|
+
|
9
|
+
#ifdef __linux__
|
10
|
+
#include <sys/resource.h>
|
11
|
+
#include <sys/time.h>
|
12
|
+
void liftrlimit()
|
13
|
+
{
|
14
|
+
struct rlimit r;
|
15
|
+
getrlimit(RLIMIT_AS, &r);
|
16
|
+
r.rlim_cur = r.rlim_max;
|
17
|
+
setrlimit(RLIMIT_AS, &r);
|
18
|
+
}
|
19
|
+
#else
|
20
|
+
void liftrlimit() {}
|
21
|
+
#endif
|
22
|
+
|
23
|
+
static ko_longopt_t long_options[] = {
|
24
|
+
{ "version", ko_no_argument, 300 },
|
25
|
+
{ "vc", ko_no_argument, 301 },
|
26
|
+
{ "secondary", ko_required_argument, 302 },
|
27
|
+
{ "ins-qovlp", ko_required_argument, 303 },
|
28
|
+
{ "heap-sort", ko_required_argument, 304 },
|
29
|
+
{ "show-unmap", ko_required_argument, 305 },
|
30
|
+
{ "ggen", ko_optional_argument, 306 },
|
31
|
+
{ "rmq", ko_optional_argument, 307 },
|
32
|
+
{ "gg-min-end-cnt", ko_required_argument, 309 },
|
33
|
+
{ "gg-min-end-frac", ko_required_argument, 310 },
|
34
|
+
{ "no-comp-path", ko_no_argument, 312 },
|
35
|
+
{ "gg-match-pen", ko_required_argument, 313 },
|
36
|
+
{ "frag", ko_no_argument, 314 },
|
37
|
+
{ "cov", ko_no_argument, 315 },
|
38
|
+
{ "min-cov-blen", ko_required_argument, 316 },
|
39
|
+
{ "min-cov-mapq", ko_required_argument, 317 },
|
40
|
+
{ "gap-pen", ko_required_argument, 318 },
|
41
|
+
{ "ref-bonus", ko_required_argument, 319 },
|
42
|
+
{ "max-gap-pre", ko_required_argument, 320 },
|
43
|
+
{ "max-lc-skip", ko_required_argument, 321 },
|
44
|
+
{ "max-gc-skip", ko_required_argument, 322 },
|
45
|
+
{ "max-lc-iter", ko_required_argument, 323 },
|
46
|
+
{ "max-rmq-size", ko_required_argument, 324 },
|
47
|
+
{ "inv", ko_required_argument, 325 },
|
48
|
+
{ "write-mz", ko_no_argument, 326 },
|
49
|
+
{ "call", ko_no_argument, 327 },
|
50
|
+
{ "cap-calloc", ko_required_argument, 328 },
|
51
|
+
{ "gdp-max-ed", ko_required_argument, 329 },
|
52
|
+
{ "no-kalloc", ko_no_argument, 401 },
|
53
|
+
{ "dbg-qname", ko_no_argument, 402 },
|
54
|
+
{ "dbg-lchain", ko_no_argument, 403 },
|
55
|
+
{ "dbg-insert", ko_no_argument, 404 },
|
56
|
+
{ "dbg-shortk", ko_no_argument, 405 },
|
57
|
+
{ "dbg-gc1", ko_no_argument, 406 },
|
58
|
+
{ "dbg-lc-prof", ko_no_argument, 407 },
|
59
|
+
{ "dbg-mwf-long", ko_no_argument, 408 },
|
60
|
+
{ "dbg-mwf-seq", ko_no_argument, 409 },
|
61
|
+
{ 0, 0, 0 }
|
62
|
+
};
|
63
|
+
|
64
|
+
static inline int64_t mm_parse_num2(const char *str, char **q)
|
65
|
+
{
|
66
|
+
double x;
|
67
|
+
char *p;
|
68
|
+
x = strtod(str, &p);
|
69
|
+
if (*p == 'G' || *p == 'g') x *= 1e9, ++p;
|
70
|
+
else if (*p == 'M' || *p == 'm') x *= 1e6, ++p;
|
71
|
+
else if (*p == 'K' || *p == 'k') x *= 1e3, ++p;
|
72
|
+
if (q) *q = p;
|
73
|
+
return (int64_t)(x + .499);
|
74
|
+
}
|
75
|
+
|
76
|
+
static inline int64_t mm_parse_num(const char *str)
|
77
|
+
{
|
78
|
+
return mm_parse_num2(str, 0);
|
79
|
+
}
|
80
|
+
|
81
|
+
static inline void yes_or_no(uint64_t *flag_, uint64_t f, int long_idx, const char *arg, int yes_to_set)
|
82
|
+
{
|
83
|
+
uint64_t flag = *flag_;
|
84
|
+
if (yes_to_set) {
|
85
|
+
if (strcmp(arg, "yes") == 0 || strcmp(arg, "y") == 0) flag |= f;
|
86
|
+
else if (strcmp(arg, "no") == 0 || strcmp(arg, "n") == 0) flag &= ~f;
|
87
|
+
else fprintf(stderr, "[WARNING]\033[1;31m option '--%s' only accepts 'yes' or 'no'.\033[0m\n", long_options[long_idx].name);
|
88
|
+
} else {
|
89
|
+
if (strcmp(arg, "yes") == 0 || strcmp(arg, "y") == 0) flag &= ~f;
|
90
|
+
else if (strcmp(arg, "no") == 0 || strcmp(arg, "n") == 0) flag |= f;
|
91
|
+
else fprintf(stderr, "[WARNING]\033[1;31m option '--%s' only accepts 'yes' or 'no'.\033[0m\n", long_options[long_idx].name);
|
92
|
+
}
|
93
|
+
*flag_ = flag;
|
94
|
+
}
|
95
|
+
|
96
|
+
int main(int argc, char *argv[])
|
97
|
+
{
|
98
|
+
const char *opt_str = "x:k:w:t:r:m:n:g:K:o:p:N:Pq:d:l:f:U:M:F:j:L:DSc";
|
99
|
+
ketopt_t o = KETOPT_INIT;
|
100
|
+
mg_mapopt_t opt;
|
101
|
+
mg_idxopt_t ipt;
|
102
|
+
mg_ggopt_t gpt;
|
103
|
+
int i, c, ret, n_threads = 4;
|
104
|
+
char *s;
|
105
|
+
FILE *fp_help = stderr;
|
106
|
+
gfa_t *g;
|
107
|
+
|
108
|
+
mg_verbose = 3;
|
109
|
+
liftrlimit();
|
110
|
+
mg_realtime0 = realtime();
|
111
|
+
mg_opt_set(0, &ipt, &opt, &gpt);
|
112
|
+
|
113
|
+
while ((c = ketopt(&o, argc, argv, 1, opt_str, long_options)) >= 0) { // test command line options and apply option -x/preset first
|
114
|
+
if (c == 'x') {
|
115
|
+
if (mg_opt_set(o.arg, &ipt, &opt, &gpt) < 0) {
|
116
|
+
fprintf(stderr, "[ERROR] unknown preset '%s'\n", o.arg);
|
117
|
+
return 1;
|
118
|
+
}
|
119
|
+
} else if (c == ':') {
|
120
|
+
fprintf(stderr, "[ERROR] missing option argument\n");
|
121
|
+
return 1;
|
122
|
+
} else if (c == '?') {
|
123
|
+
fprintf(stderr, "[ERROR] unknown option in \"%s\"\n", argv[o.i - 1]);
|
124
|
+
return 1;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
o = KETOPT_INIT;
|
128
|
+
|
129
|
+
while ((c = ketopt(&o, argc, argv, 1, opt_str, long_options)) >= 0) {
|
130
|
+
if (c == 'w') ipt.w = atoi(o.arg);
|
131
|
+
else if (c == 'k') ipt.k = atoi(o.arg);
|
132
|
+
else if (c == 't') n_threads = atoi(o.arg);
|
133
|
+
else if (c == 'f') opt.occ_max1_frac = atof(o.arg);
|
134
|
+
else if (c == 'g') opt.max_gap = mm_parse_num(o.arg);
|
135
|
+
else if (c == 'F') opt.max_frag_len = mm_parse_num(o.arg);
|
136
|
+
else if (c == 'K') opt.mini_batch_size = mm_parse_num(o.arg);
|
137
|
+
else if (c == 'p') opt.pri_ratio = atof(o.arg);
|
138
|
+
else if (c == 'N') opt.best_n = mm_parse_num(o.arg);
|
139
|
+
else if (c == 'P') opt.flag |= MG_M_ALL_CHAINS;
|
140
|
+
else if (c == 'D') opt.flag |= MG_M_NO_DIAG;
|
141
|
+
else if (c == 'M') opt.mask_level = atof(o.arg);
|
142
|
+
else if (c == 'j') opt.div = atof(o.arg);
|
143
|
+
else if (c == 'l') gpt.min_map_len = mm_parse_num(o.arg);
|
144
|
+
else if (c == 'd') gpt.min_depth_len = mm_parse_num(o.arg);
|
145
|
+
else if (c == 'q') gpt.min_mapq = atoi(o.arg);
|
146
|
+
else if (c == 'L') gpt.min_var_len = atoi(o.arg);
|
147
|
+
else if (c == 'S') opt.flag |= MG_M_WRITE_LCHAIN;
|
148
|
+
else if (c == 'c') opt.flag |= MG_M_CIGAR;
|
149
|
+
else if (c == 301) opt.flag |= MG_M_VERTEX_COOR; // --vc
|
150
|
+
else if (c == 309) gpt.ggs_min_end_cnt = atoi(o.arg); // --gg-min-end-cnt
|
151
|
+
else if (c == 310) gpt.ggs_min_end_frac = atof(o.arg); // --gg-min-end-frac
|
152
|
+
else if (c == 312) opt.flag |= MG_M_NO_COMP_PATH; // --no-comp-path
|
153
|
+
else if (c == 313) gpt.match_pen = atoi(o.arg); // --gg-match-pen
|
154
|
+
else if (c == 314) opt.flag |= MG_M_FRAG_MODE | MG_M_FRAG_MERGE; // --frag
|
155
|
+
else if (c == 315) opt.flag |= MG_M_CAL_COV | MG_M_SKIP_GCHECK, gpt.flag |= MG_G_CAL_COV; // --cov
|
156
|
+
else if (c == 316) opt.min_cov_blen = mm_parse_num(o.arg); // --min-cov-blen
|
157
|
+
else if (c == 317) opt.min_cov_mapq = atoi(o.arg); // --min-cov-mapq
|
158
|
+
else if (c == 318) opt.chn_pen_gap = atof(o.arg); // --gap-pen
|
159
|
+
else if (c == 319) opt.ref_bonus = atoi(o.arg); // --ref-bonus
|
160
|
+
else if (c == 320) opt.max_gap_pre = mm_parse_num(o.arg); // --max-gap-pre
|
161
|
+
else if (c == 321) opt.max_lc_skip = atoi(o.arg); // --max-lc-skip
|
162
|
+
else if (c == 322) opt.max_gc_skip = atoi(o.arg); // --max-gc-skip
|
163
|
+
else if (c == 323) opt.max_lc_iter = mm_parse_num(o.arg); // --max-lc-iter
|
164
|
+
else if (c == 324) opt.rmq_size_cap = mm_parse_num(o.arg); // --max-rmq-size
|
165
|
+
else if (c == 326) opt.flag |= MG_M_WRITE_MZ | MG_M_WRITE_LCHAIN; // --write-mz
|
166
|
+
else if (c == 327) gpt.flag |= MG_G_CALL, opt.flag |= MG_M_SKIP_GCHECK; // --call
|
167
|
+
else if (c == 328) opt.cap_kalloc = mm_parse_num(o.arg); // --cap-kalloc
|
168
|
+
else if (c == 329) opt.gdp_max_ed = mm_parse_num(o.arg); // --gdp-max-ed
|
169
|
+
else if (c == 401) mg_dbg_flag |= MG_DBG_NO_KALLOC; // --no-kalloc
|
170
|
+
else if (c == 402) mg_dbg_flag |= MG_DBG_QNAME; // --dbg-qname
|
171
|
+
else if (c == 403) mg_dbg_flag |= MG_DBG_LCHAIN; // --dbg-lchain
|
172
|
+
else if (c == 404) mg_dbg_flag |= MG_DBG_INSERT; // --dbg-insert
|
173
|
+
else if (c == 405) mg_dbg_flag |= MG_DBG_SHORTK; // --dbg-shortk
|
174
|
+
else if (c == 406) mg_dbg_flag |= MG_DBG_GC1; // --dbg-gc1
|
175
|
+
else if (c == 407) mg_dbg_flag |= MG_DBG_LC_PROF; // --dbg-lc-prof
|
176
|
+
else if (c == 408) mg_dbg_flag |= MG_DBG_MINIWFA; // --dbg-mwf-long
|
177
|
+
else if (c == 409) mg_dbg_flag |= MG_DBG_MWF_SEQ; // --dbg-mwf-seq
|
178
|
+
else if (c == 'U') {
|
179
|
+
opt.occ_max1 = (int)mm_parse_num2(o.arg, &s);
|
180
|
+
if (*s == ',') opt.occ_max1_cap = (int)mm_parse_num2(s + 1, &s);
|
181
|
+
} else if (c == 'r') {
|
182
|
+
opt.bw = (int)mm_parse_num2(o.arg, &s);
|
183
|
+
if (*s == ',') opt.bw_long = (int)mm_parse_num2(s + 1, &s);
|
184
|
+
} else if (c == 'n') {
|
185
|
+
opt.min_gc_cnt = (int)mm_parse_num2(o.arg, &s);
|
186
|
+
if (*s == ',') opt.min_lc_cnt = (int)mm_parse_num2(s + 1, &s);
|
187
|
+
} else if (c == 'm') {
|
188
|
+
opt.min_gc_score = (int)mm_parse_num2(o.arg, &s);
|
189
|
+
if (*s == ',') opt.min_lc_score = (int)mm_parse_num2(s + 1, &s);
|
190
|
+
} else if (c == 'o') {
|
191
|
+
if (strcmp(o.arg, "-") != 0) {
|
192
|
+
if (freopen(o.arg, "wb", stdout) == NULL) {
|
193
|
+
fprintf(stderr, "[ERROR]\033[1;31m failed to write the output to file '%s'\033[0m\n", o.arg);
|
194
|
+
exit(1);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
} else if (c == 306) { // --ggen
|
198
|
+
if (o.arg) {
|
199
|
+
if (strcmp(o.arg, "none") == 0) gpt.algo = MG_G_NONE;
|
200
|
+
else if (strcmp(o.arg, "simple") == 0) gpt.algo = MG_G_GGSIMPLE;
|
201
|
+
else {
|
202
|
+
fprintf(stderr, "ERROR: unknown graph generation algorithm \"%s\"\n", o.arg);
|
203
|
+
return 1;
|
204
|
+
}
|
205
|
+
} else gpt.algo = MG_G_GGSIMPLE;
|
206
|
+
} else if (c == 302) { // --secondary
|
207
|
+
yes_or_no(&opt.flag, MG_M_PRINT_2ND, o.longidx, o.arg, 1);
|
208
|
+
} else if (c == 303) { // --ins-qovlp
|
209
|
+
yes_or_no(&gpt.flag, MG_G_NO_QOVLP, o.longidx, o.arg, 1);
|
210
|
+
} else if (c == 304) { // --heap-sort
|
211
|
+
yes_or_no(&opt.flag, MG_M_HEAP_SORT, o.longidx, o.arg, 1);
|
212
|
+
} else if (c == 305) { // --show-unmap
|
213
|
+
yes_or_no(&opt.flag, MG_M_SHOW_UNMAP, o.longidx, o.arg, 1);
|
214
|
+
} else if (c == 307) { // --rmq
|
215
|
+
yes_or_no(&opt.flag, MG_M_RMQ, o.longidx, o.arg, 1);
|
216
|
+
} else if (c == 325) { // --inv
|
217
|
+
yes_or_no(&gpt.flag, MG_G_NO_INV, o.longidx, o.arg, 0);
|
218
|
+
} else if (c == 300) { // --version
|
219
|
+
puts(MG_VERSION);
|
220
|
+
return 0;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
if (mg_opt_check(&ipt, &opt, &gpt) < 0)
|
224
|
+
return 1;
|
225
|
+
if (gpt.algo == MG_G_GGSIMPLE && !(opt.flag&MG_M_CIGAR))
|
226
|
+
fprintf(stderr, "[WARNING]\033[1;31m it is recommended to add -c for graph generation\033[0m\n");
|
227
|
+
|
228
|
+
if (argc == o.ind || fp_help == stdout) {
|
229
|
+
fprintf(fp_help, "Usage: minigraph [options] <target.gfa> <query.fa> [...]\n");
|
230
|
+
fprintf(fp_help, "Options:\n");
|
231
|
+
fprintf(fp_help, " Indexing:\n");
|
232
|
+
fprintf(fp_help, " -k INT k-mer size (no larger than 28) [%d]\n", ipt.k);
|
233
|
+
fprintf(fp_help, " -w INT minizer window size [%d]\n", ipt.w);
|
234
|
+
fprintf(fp_help, " Mapping:\n");
|
235
|
+
fprintf(fp_help, " -c perform base alignment; RECOMMENDED\n");
|
236
|
+
fprintf(fp_help, " -f FLOAT ignore top FLOAT fraction of repetitive minimizers [%g]\n", opt.occ_max1_frac);
|
237
|
+
fprintf(fp_help, " -U INT[,INT] choose the minimizer occurrence threshold within this interval [%d,%d]\n", opt.occ_max1, opt.occ_max1_cap);
|
238
|
+
fprintf(fp_help, " -j FLOAT expected sequence divergence [%g]\n", opt.div);
|
239
|
+
fprintf(fp_help, " -g NUM stop chain enlongation if there are no minimizers in INT-bp [%d]\n", opt.max_gap);
|
240
|
+
fprintf(fp_help, " -F NUM max fragment length (effective with -xsr or in the fragment mode) [%d]\n", opt.max_frag_len);
|
241
|
+
fprintf(fp_help, " -r NUM[,NUM] bandwidth for the two rounds of chaining [%d,%d]\n", opt.bw, opt.bw_long);
|
242
|
+
fprintf(fp_help, " -n INT[,INT] minimal number of minimizers on a graph/linear chain [%d,%d]\n", opt.min_gc_cnt, opt.min_lc_cnt);
|
243
|
+
fprintf(fp_help, " -m INT[,INT] minimal graph/linear chaining score [%d,%d]\n", opt.min_gc_score, opt.min_lc_score);
|
244
|
+
fprintf(fp_help, " -p FLOAT min secondary-to-primary score ratio [%g]\n", opt.pri_ratio);
|
245
|
+
fprintf(fp_help, " -N INT retain at most INT secondary mappings [%d]\n", opt.best_n);
|
246
|
+
fprintf(fp_help, " -D skip self diagonal matches\n");
|
247
|
+
fprintf(fp_help, " Graph generation:\n");
|
248
|
+
fprintf(fp_help, " --ggen perform incremental graph generation\n");
|
249
|
+
fprintf(fp_help, " -q INT min mapping quality [%d]\n", gpt.min_mapq);
|
250
|
+
fprintf(fp_help, " -l NUM min alignment length [%d]\n", gpt.min_map_len);
|
251
|
+
fprintf(fp_help, " -d NUM min alignment length for depth calculation [%d]\n", gpt.min_depth_len);
|
252
|
+
fprintf(fp_help, " -L INT min variant length [%d]\n", gpt.min_var_len);
|
253
|
+
fprintf(fp_help, " --call call the graph path in each bubble and output BED\n");
|
254
|
+
fprintf(fp_help, " Input/output:\n");
|
255
|
+
fprintf(fp_help, " -t INT number of threads [%d]\n", n_threads);
|
256
|
+
fprintf(fp_help, " -o FILE output mappings to FILE [stdout]\n");
|
257
|
+
fprintf(fp_help, " -K NUM minibatch size for mapping [500M]\n");
|
258
|
+
fprintf(fp_help, " -S output linear chains in * sName sLen nMz div sStart sEnd qStart qEnd\n");
|
259
|
+
fprintf(fp_help, " --vc output in the vertex coordinate\n");
|
260
|
+
fprintf(fp_help, " Preset:\n");
|
261
|
+
fprintf(fp_help, " -x STR preset []\n");
|
262
|
+
fprintf(fp_help, " - lr: noisy long read mapping (the default)\n");
|
263
|
+
fprintf(fp_help, " - asm: asm-to-ref mapping\n");
|
264
|
+
fprintf(fp_help, " - sr: short reads\n");
|
265
|
+
fprintf(fp_help, " - ggs: incremental graph generation\n");
|
266
|
+
return fp_help == stdout? 0 : 1;
|
267
|
+
}
|
268
|
+
|
269
|
+
g = gfa_read(argv[o.ind]);
|
270
|
+
if (g == 0) {
|
271
|
+
fprintf(stderr, "[ERROR] failed to load the graph from file '%s'\n", argv[o.ind]);
|
272
|
+
return 1;
|
273
|
+
} else if (mg_verbose >= 3) {
|
274
|
+
fprintf(stderr, "[M::%s::%.3f*%.2f] loaded the graph from \"%s\"\n", __func__, realtime() - mg_realtime0, cputime() / (realtime() - mg_realtime0), argv[o.ind]);
|
275
|
+
}
|
276
|
+
|
277
|
+
if (gpt.algo == MG_G_NONE && !(gpt.flag & MG_G_CALL)) {
|
278
|
+
ret = mg_map_files(g, argc - (o.ind + 1), (const char**)&argv[o.ind + 1], &ipt, &opt, n_threads);
|
279
|
+
} else {
|
280
|
+
if (gpt.flag & MG_G_CALL) gfa_sort_ref_arc(g);
|
281
|
+
ret = mg_ggen(g, argc - (o.ind + 1), (const char**)&argv[o.ind + 1], &ipt, &opt, &gpt, n_threads);
|
282
|
+
}
|
283
|
+
|
284
|
+
if ((gpt.algo != MG_G_NONE || (opt.flag & MG_M_CAL_COV)) && !(gpt.flag & MG_G_CALL))
|
285
|
+
gfa_print(g, stdout, 0);
|
286
|
+
gfa_destroy(g);
|
287
|
+
|
288
|
+
if (fflush(stdout) == EOF) {
|
289
|
+
fprintf(stderr, "[ERROR] failed to write the results\n");
|
290
|
+
exit(EXIT_FAILURE);
|
291
|
+
}
|
292
|
+
|
293
|
+
if (mg_verbose >= 3) {
|
294
|
+
fprintf(stderr, "[M::%s] Version: %s\n", __func__, MG_VERSION);
|
295
|
+
fprintf(stderr, "[M::%s] CMD:", __func__);
|
296
|
+
for (i = 0; i < argc; ++i)
|
297
|
+
fprintf(stderr, " %s", argv[i]);
|
298
|
+
fprintf(stderr, "\n[M::%s] Real time: %.3f sec; CPU: %.3f sec; Peak RSS: %.3f GB\n", __func__, realtime() - mg_realtime0, cputime(), peakrss() / 1024.0 / 1024.0 / 1024.0);
|
299
|
+
}
|
300
|
+
return !!ret;
|
301
|
+
}
|