r477: renamed multi_seg to frag_mode
This commit is contained in:
parent
ae2adf04d4
commit
9c5767f9ed
6
bseq.c
6
bseq.c
|
|
@ -61,7 +61,7 @@ static inline void kseq2bseq(kseq_t *ks, mm_bseq1_t *s, int with_qual)
|
||||||
s->l_seq = ks->seq.l;
|
s->l_seq = ks->seq.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_bseq1_t *mm_bseq_read2(mm_bseq_file_t *fp, int chunk_size, int with_qual, int check_name, int *n_)
|
mm_bseq1_t *mm_bseq_read2(mm_bseq_file_t *fp, int chunk_size, int with_qual, int frag_mode, int *n_)
|
||||||
{
|
{
|
||||||
int64_t size = 0;
|
int64_t size = 0;
|
||||||
kvec_t(mm_bseq1_t) a = {0,0,0};
|
kvec_t(mm_bseq1_t) a = {0,0,0};
|
||||||
|
|
@ -81,7 +81,7 @@ mm_bseq1_t *mm_bseq_read2(mm_bseq_file_t *fp, int chunk_size, int with_qual, int
|
||||||
kseq2bseq(ks, s, with_qual);
|
kseq2bseq(ks, s, with_qual);
|
||||||
size += s->l_seq;
|
size += s->l_seq;
|
||||||
if (size >= chunk_size) {
|
if (size >= chunk_size) {
|
||||||
if (check_name && a.a[a.n-1].l_seq < CHECK_PAIR_THRES) {
|
if (frag_mode && a.a[a.n-1].l_seq < CHECK_PAIR_THRES) {
|
||||||
while (kseq_read(ks) >= 0) {
|
while (kseq_read(ks) >= 0) {
|
||||||
kseq2bseq(ks, &fp->s, with_qual);
|
kseq2bseq(ks, &fp->s, with_qual);
|
||||||
if (mm_qname_same(fp->s.name, a.a[a.n-1].name)) {
|
if (mm_qname_same(fp->s.name, a.a[a.n-1].name)) {
|
||||||
|
|
@ -102,7 +102,7 @@ mm_bseq1_t *mm_bseq_read(mm_bseq_file_t *fp, int chunk_size, int with_qual, int
|
||||||
return mm_bseq_read2(fp, chunk_size, with_qual, 0, n_);
|
return mm_bseq_read2(fp, chunk_size, with_qual, 0, n_);
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_bseq1_t *mm_bseq_read_multi(int n_fp, mm_bseq_file_t **fp, int chunk_size, int with_qual, int *n_)
|
mm_bseq1_t *mm_bseq_read_frag(int n_fp, mm_bseq_file_t **fp, int chunk_size, int with_qual, int *n_)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t size = 0;
|
int64_t size = 0;
|
||||||
|
|
|
||||||
4
bseq.h
4
bseq.h
|
|
@ -18,9 +18,9 @@ typedef struct {
|
||||||
|
|
||||||
mm_bseq_file_t *mm_bseq_open(const char *fn);
|
mm_bseq_file_t *mm_bseq_open(const char *fn);
|
||||||
void mm_bseq_close(mm_bseq_file_t *fp);
|
void mm_bseq_close(mm_bseq_file_t *fp);
|
||||||
mm_bseq1_t *mm_bseq_read2(mm_bseq_file_t *fp, int chunk_size, int with_qual, int check_name, int *n_);
|
mm_bseq1_t *mm_bseq_read2(mm_bseq_file_t *fp, int chunk_size, int with_qual, int frag_mode, int *n_);
|
||||||
mm_bseq1_t *mm_bseq_read(mm_bseq_file_t *fp, int chunk_size, int with_qual, int *n_);
|
mm_bseq1_t *mm_bseq_read(mm_bseq_file_t *fp, int chunk_size, int with_qual, int *n_);
|
||||||
mm_bseq1_t *mm_bseq_read_multi(int n_fp, mm_bseq_file_t **fp, int chunk_size, int with_qual, int *n_);
|
mm_bseq1_t *mm_bseq_read_frag(int n_fp, mm_bseq_file_t **fp, int chunk_size, int with_qual, int *n_);
|
||||||
int mm_bseq_eof(mm_bseq_file_t *fp);
|
int mm_bseq_eof(mm_bseq_file_t *fp);
|
||||||
|
|
||||||
extern unsigned char seq_nt4_table[256];
|
extern unsigned char seq_nt4_table[256];
|
||||||
|
|
|
||||||
15
main.c
15
main.c
|
|
@ -6,7 +6,7 @@
|
||||||
#include "mmpriv.h"
|
#include "mmpriv.h"
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
#define MM_VERSION "2.2-r476-dirty"
|
#define MM_VERSION "2.2-r477-dirty"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
@ -131,8 +131,8 @@ int main(int argc, char *argv[])
|
||||||
else if (c == 0 && long_idx ==13) opt.flag |= MM_F_SR; // --sr
|
else if (c == 0 && long_idx ==13) opt.flag |= MM_F_SR; // --sr
|
||||||
else if (c == 0 && long_idx == 14) { // --frag
|
else if (c == 0 && long_idx == 14) { // --frag
|
||||||
if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0)
|
if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0)
|
||||||
opt.flag |= MM_F_MULTI_SEG;
|
opt.flag |= MM_F_FRAG_MODE;
|
||||||
else opt.flag &= ~MM_F_MULTI_SEG;
|
else opt.flag &= ~MM_F_FRAG_MODE;
|
||||||
} else if (c == 0 && long_idx == 15) { // --print-2nd
|
} else if (c == 0 && long_idx == 15) { // --print-2nd
|
||||||
if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0)
|
if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0)
|
||||||
opt.flag &= ~MM_F_NO_PRINT_2ND;
|
opt.flag &= ~MM_F_NO_PRINT_2ND;
|
||||||
|
|
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (max_gap_ref > 0) {
|
if (max_gap_ref > 0) {
|
||||||
if (opt.flag & MM_F_MULTI_SEG)
|
if (opt.flag & MM_F_FRAG_MODE)
|
||||||
opt.max_gap_ref = max_gap_ref;
|
opt.max_gap_ref = max_gap_ref;
|
||||||
if (opt.flag & MM_F_SPLICE)
|
if (opt.flag & MM_F_SPLICE)
|
||||||
opt.max_gap_ref = opt.bw = max_gap_ref;
|
opt.max_gap_ref = opt.bw = max_gap_ref;
|
||||||
|
|
@ -267,11 +267,12 @@ int main(int argc, char *argv[])
|
||||||
__func__, realtime() - mm_realtime0, cputime() / (realtime() - mm_realtime0), mi->n_seq);
|
__func__, realtime() - mm_realtime0, cputime() / (realtime() - mm_realtime0), mi->n_seq);
|
||||||
if (argc != optind + 1) mm_mapopt_update(&opt, mi);
|
if (argc != optind + 1) mm_mapopt_update(&opt, mi);
|
||||||
if (mm_verbose >= 3) mm_idx_stat(mi);
|
if (mm_verbose >= 3) mm_idx_stat(mi);
|
||||||
if (opt.flag & MM_F_MULTI_SEG)
|
if (!(opt.flag & MM_F_FRAG_MODE)) {
|
||||||
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)
|
for (i = optind + 1; i < argc; ++i)
|
||||||
mm_map_file(mi, argv[i], &opt, n_threads);
|
mm_map_file(mi, argv[i], &opt, n_threads);
|
||||||
|
} else {
|
||||||
|
mm_map_file_frag(mi, argc - (optind + 1), (const char**)&argv[optind + 1], &opt, n_threads);
|
||||||
|
}
|
||||||
mm_idx_destroy(mi);
|
mm_idx_destroy(mi);
|
||||||
}
|
}
|
||||||
mm_idx_reader_close(idx_rdr);
|
mm_idx_reader_close(idx_rdr);
|
||||||
|
|
|
||||||
20
map.c
20
map.c
|
|
@ -80,7 +80,7 @@ int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo)
|
||||||
mo->min_dp_max = 200;
|
mo->min_dp_max = 200;
|
||||||
} else if (strcmp(preset, "short") == 0 || strcmp(preset, "sr") == 0) {
|
} else if (strcmp(preset, "short") == 0 || strcmp(preset, "sr") == 0) {
|
||||||
io->is_hpc = 0, io->k = 21, io->w = 11;
|
io->is_hpc = 0, io->k = 21, io->w = 11;
|
||||||
mo->flag |= MM_F_SR | MM_F_MULTI_SEG | MM_F_NO_PRINT_2ND;
|
mo->flag |= MM_F_SR | MM_F_FRAG_MODE | MM_F_NO_PRINT_2ND;
|
||||||
mo->pe_ori = 0<<1|1; // FR
|
mo->pe_ori = 0<<1|1; // FR
|
||||||
mo->a = 2, mo->b = 8, mo->q = 12, mo->e = 2, mo->q2 = 32, mo->e2 = 1;
|
mo->a = 2, mo->b = 8, mo->q = 12, mo->e = 2, mo->q2 = 32, mo->e2 = 1;
|
||||||
mo->max_gap = 200;
|
mo->max_gap = 200;
|
||||||
|
|
@ -261,7 +261,7 @@ static mm_reg1_t *align_regs(const mm_mapopt_t *opt, const mm_idx_t *mi, void *k
|
||||||
return regs;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mm_map_multi(const mm_idx_t *mi, int n_segs, const int *qlens, const char **seqs, int *n_regs, mm_reg1_t **regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname)
|
void mm_map_frag(const mm_idx_t *mi, int n_segs, const int *qlens, const char **seqs, int *n_regs, mm_reg1_t **regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname)
|
||||||
{
|
{
|
||||||
int i, j, max_gap_ref, rep_len, qlen_sum, n_regs0, rechain = 0;
|
int i, j, max_gap_ref, rep_len, qlen_sum, n_regs0, rechain = 0;
|
||||||
uint32_t hash;
|
uint32_t hash;
|
||||||
|
|
@ -350,7 +350,7 @@ void mm_map_multi(const mm_idx_t *mi, int n_segs, const int *qlens, const char *
|
||||||
mm_reg1_t *mm_map(const mm_idx_t *mi, int qlen, const char *seq, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname)
|
mm_reg1_t *mm_map(const mm_idx_t *mi, int qlen, const char *seq, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname)
|
||||||
{
|
{
|
||||||
mm_reg1_t *regs;
|
mm_reg1_t *regs;
|
||||||
mm_map_multi(mi, 1, &qlen, &seq, n_regs, ®s, b, opt, qname);
|
mm_map_frag(mi, 1, &qlen, &seq, n_regs, ®s, b, opt, qname);
|
||||||
return regs;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,7 +391,7 @@ static void worker_for(void *_data, long i, int tid) // kt_for() callback
|
||||||
qlens[j] = s->seq[off + j].l_seq;
|
qlens[j] = s->seq[off + j].l_seq;
|
||||||
qseqs[j] = s->seq[off + j].seq;
|
qseqs[j] = s->seq[off + j].seq;
|
||||||
}
|
}
|
||||||
mm_map_multi(s->p->mi, s->n_seg[i], qlens, qseqs, &s->n_reg[off], &s->reg[off], b, s->p->opt, s->seq[off].name);
|
mm_map_frag(s->p->mi, s->n_seg[i], qlens, qseqs, &s->n_reg[off], &s->reg[off], b, s->p->opt, s->seq[off].name);
|
||||||
for (j = 0; j < s->n_seg[i]; ++j) // flip the query strand and coordinate to the original read strand
|
for (j = 0; j < s->n_seg[i]; ++j) // flip the query strand and coordinate to the original read strand
|
||||||
if (s->n_seg[i] == 2 && ((j == 0 && (pe_ori>>1&1)) || (j == 1 && (pe_ori&1)))) {
|
if (s->n_seg[i] == 2 && ((j == 0 && (pe_ori>>1&1)) || (j == 1 && (pe_ori&1)))) {
|
||||||
int k, t;
|
int k, t;
|
||||||
|
|
@ -414,11 +414,11 @@ static void *worker_pipeline(void *shared, int step, void *in)
|
||||||
pipeline_t *p = (pipeline_t*)shared;
|
pipeline_t *p = (pipeline_t*)shared;
|
||||||
if (step == 0) { // step 0: read sequences
|
if (step == 0) { // step 0: read sequences
|
||||||
int with_qual = (!!(p->opt->flag & MM_F_OUT_SAM) && !(p->opt->flag & MM_F_NO_QUAL));
|
int with_qual = (!!(p->opt->flag & MM_F_OUT_SAM) && !(p->opt->flag & MM_F_NO_QUAL));
|
||||||
int multi_seg = (p->n_fp > 1 || !!(p->opt->flag & MM_F_MULTI_SEG));
|
int frag_mode = (p->n_fp > 1 || !!(p->opt->flag & MM_F_FRAG_MODE));
|
||||||
step_t *s;
|
step_t *s;
|
||||||
s = (step_t*)calloc(1, sizeof(step_t));
|
s = (step_t*)calloc(1, sizeof(step_t));
|
||||||
if (p->n_fp > 1) s->seq = mm_bseq_read_multi(p->n_fp, p->fp, p->mini_batch_size, with_qual, &s->n_seq);
|
if (p->n_fp > 1) s->seq = mm_bseq_read_frag(p->n_fp, p->fp, p->mini_batch_size, with_qual, &s->n_seq);
|
||||||
else s->seq = mm_bseq_read2(p->fp[0], p->mini_batch_size, with_qual, multi_seg, &s->n_seq);
|
else s->seq = mm_bseq_read2(p->fp[0], p->mini_batch_size, with_qual, frag_mode, &s->n_seq);
|
||||||
if (s->seq) {
|
if (s->seq) {
|
||||||
s->p = p;
|
s->p = p;
|
||||||
for (i = 0; i < s->n_seq; ++i)
|
for (i = 0; i < s->n_seq; ++i)
|
||||||
|
|
@ -431,7 +431,7 @@ static void *worker_pipeline(void *shared, int step, void *in)
|
||||||
s->n_seg = s->seg_off + s->n_seq;
|
s->n_seg = s->seg_off + s->n_seq;
|
||||||
s->reg = (mm_reg1_t**)calloc(s->n_seq, sizeof(mm_reg1_t*));
|
s->reg = (mm_reg1_t**)calloc(s->n_seq, sizeof(mm_reg1_t*));
|
||||||
for (i = 1, j = 0; i <= s->n_seq; ++i)
|
for (i = 1, j = 0; i <= s->n_seq; ++i)
|
||||||
if (i == s->n_seq || !multi_seg || !mm_qname_same(s->seq[i-1].name, s->seq[i].name)) {
|
if (i == s->n_seq || !frag_mode || !mm_qname_same(s->seq[i-1].name, s->seq[i].name)) {
|
||||||
s->n_seg[s->n_frag] = i - j;
|
s->n_seg[s->n_frag] = i - j;
|
||||||
s->seg_off[s->n_frag++] = j;
|
s->seg_off[s->n_frag++] = j;
|
||||||
j = i;
|
j = i;
|
||||||
|
|
@ -484,7 +484,7 @@ static void *worker_pipeline(void *shared, int step, void *in)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
int mm_map_file_frag(const mm_idx_t *idx, int n_segs, const char **fn, const mm_mapopt_t *opt, int n_threads)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
pipeline_t pl;
|
pipeline_t pl;
|
||||||
|
|
@ -516,5 +516,5 @@ int mm_map_file_multi_seg(const mm_idx_t *idx, int n_segs, const char **fn, cons
|
||||||
|
|
||||||
int mm_map_file(const mm_idx_t *idx, const char *fn, const mm_mapopt_t *opt, int n_threads)
|
int mm_map_file(const mm_idx_t *idx, const char *fn, const mm_mapopt_t *opt, int n_threads)
|
||||||
{
|
{
|
||||||
return mm_map_file_multi_seg(idx, 1, &fn, opt, n_threads);
|
return mm_map_file_frag(idx, 1, &fn, opt, n_threads);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#define MM_F_NO_LJOIN 0x400
|
#define MM_F_NO_LJOIN 0x400
|
||||||
#define MM_F_OUT_CS_LONG 0x800
|
#define MM_F_OUT_CS_LONG 0x800
|
||||||
#define MM_F_SR 0x1000
|
#define MM_F_SR 0x1000
|
||||||
#define MM_F_MULTI_SEG 0x2000
|
#define MM_F_FRAG_MODE 0x2000
|
||||||
#define MM_F_NO_PRINT_2ND 0x4000
|
#define MM_F_NO_PRINT_2ND 0x4000
|
||||||
|
|
||||||
#define MM_IDX_MAGIC "MMI\2"
|
#define MM_IDX_MAGIC "MMI\2"
|
||||||
|
|
@ -258,7 +258,7 @@ 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(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);
|
int mm_map_file_frag(const mm_idx_t *idx, int n_segs, const char **fn, const mm_mapopt_t *opt, int n_threads);
|
||||||
|
|
||||||
// deprecated APIs for backward compatibility
|
// deprecated APIs for backward compatibility
|
||||||
void mm_mapopt_init(mm_mapopt_t *opt);
|
void mm_mapopt_init(mm_mapopt_t *opt);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue