r476: multi-file fragment mode working

This commit is contained in:
Heng Li 2017-10-05 15:39:26 -04:00
parent b839758335
commit ae2adf04d4
4 changed files with 12 additions and 6 deletions

13
main.c
View File

@ -6,7 +6,7 @@
#include "mmpriv.h"
#include "getopt.h"
#define MM_VERSION "2.2-r475-dirty"
#define MM_VERSION "2.2-r476-dirty"
#ifdef __linux__
#include <sys/resource.h>
@ -37,7 +37,7 @@ static struct option long_options[] = {
{ "cost-non-gt-ag", required_argument, 0, 0 },
{ "no-long-join", no_argument, 0, 0 },
{ "sr", no_argument, 0, 0 },
{ "multi", optional_argument, 0, 0 },
{ "frag", optional_argument, 0, 0 },
{ "print-2nd", optional_argument, 0, 0 },
{ "cs", optional_argument, 0, 0 },
{ "help", no_argument, 0, 'h' },
@ -129,7 +129,7 @@ int main(int argc, char *argv[])
else if (c == 0 && long_idx ==11) opt.noncan = atoi(optarg); // --cost-non-gt-ag
else if (c == 0 && long_idx ==12) opt.flag |= MM_F_NO_LJOIN; // --no-long-join
else if (c == 0 && long_idx ==13) opt.flag |= MM_F_SR; // --sr
else if (c == 0 && long_idx == 14) { // --multi
else if (c == 0 && long_idx == 14) { // --frag
if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0)
opt.flag |= MM_F_MULTI_SEG;
else opt.flag &= ~MM_F_MULTI_SEG;
@ -267,8 +267,11 @@ int main(int argc, char *argv[])
__func__, realtime() - mm_realtime0, cputime() / (realtime() - mm_realtime0), mi->n_seq);
if (argc != optind + 1) mm_mapopt_update(&opt, mi);
if (mm_verbose >= 3) mm_idx_stat(mi);
for (i = optind + 1; i < argc; ++i)
mm_map_file(mi, argv[i], &opt, n_threads);
if (opt.flag & MM_F_MULTI_SEG)
mm_map_file_multi_seg(mi, argc - (optind + 1), (const char**)&argv[optind + 1], &opt, n_threads);
else
for (i = optind + 1; i < argc; ++i)
mm_map_file(mi, argv[i], &opt, n_threads);
mm_idx_destroy(mi);
}
mm_idx_reader_close(idx_rdr);

1
map.c
View File

@ -490,6 +490,7 @@ int mm_map_file_multi_seg(const mm_idx_t *idx, int n_segs, const char **fn, cons
pipeline_t pl;
if (n_segs < 1) return -1;
memset(&pl, 0, sizeof(pipeline_t));
pl.n_fp = n_segs;
pl.fp = (mm_bseq_file_t**)calloc(n_segs, sizeof(mm_bseq_file_t*));
for (i = 0; i < n_segs; ++i) {
pl.fp[i] = mm_bseq_open(fn[i]);

View File

@ -258,6 +258,8 @@ mm_reg1_t *mm_map(const mm_idx_t *mi, int l_seq, const char *seq, int *n_regs, m
*/
int mm_map_file(const mm_idx_t *idx, const char *fn, const mm_mapopt_t *opt, int n_threads);
int mm_map_file_multi_seg(const mm_idx_t *idx, int n_segs, const char **fn, const mm_mapopt_t *opt, int n_threads);
// deprecated APIs for backward compatibility
void mm_mapopt_init(mm_mapopt_t *opt);
mm_idx_t *mm_idx_build(const char *fn, int w, int k, int is_hpc, int n_threads);

View File

@ -348,7 +348,7 @@ tag ignores introns to demote hits to pseudogenes.
Short single-end reads without splicing
.RB ( -k21
.B -w11 -A2 -B8 -O12,32 -E2,1 -r50 -p.5 -N20 -f1000,5000 -n2 -m20 -s40 -g200
.B -K50m --multi
.B -K50m --frag
.BR --sr ).
.RE
.SS Miscellaneous options