From: Andreas Tille Date: Fri, 8 Jan 2021 09:47:39 +0000 (+0100) Subject: Avoid name space conflict with bwa X-Git-Tag: archive/raspbian/0.1+git20221215.85f159e-1+rpi1~1^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=937a8da1c299b5f11a2d279f4f5e4b9bece4ab89;p=fermi-lite.git Avoid name space conflict with bwa Bug-Upstream: https://github.com/lh3/fermi-lite/issues/5 Last-Update: Thu, 02 Feb 2017 10:57:56 +0100 Gbp-Pq: Name rename_bseq1_t.patch --- diff --git a/README.md b/README.md index 6dc7ff9..e9b0acd 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,11 @@ sketch of the example: int main(int argc, char *argv[]) { int i, n_seqs, n_utgs; - bseq1_t *seqs; // array of input sequences + fml_seq1_t *seqs; // array of input sequences fml_utg_t *utgs; // array of output unitigs fml_opt_t opt; if (argc == 1) return 1; // do nothing if there is no input file - seqs = bseq_read(argv[1], &n_seqs); // or fill the array with callers' functions + seqs = fml_seq_read(argv[1], &n_seqs); // or fill the array with callers' functions fml_opt_init(&opt); // initialize parameters utgs = fml_assemble(&opt, n_seqs, seqs, &n_utgs); // assemble! for (i = 0; i < n_utgs; ++i) // output in fasta diff --git a/bfc.c b/bfc.c index 27ccfde..ea74523 100644 --- a/bfc.c +++ b/bfc.c @@ -60,7 +60,7 @@ typedef struct { // cache to reduce locking typedef struct { int k, q; int n_seqs; - const bseq1_t *seqs; + const fml_seq1_t *seqs; bfc_ch_t *ch; int *n_buf; insbuf_t **buf; @@ -97,7 +97,7 @@ static void bfc_kmer_insert(cnt_step_t *cs, const bfc_kmer_t *x, int is_high, in static void worker_count(void *_data, long k, int tid) { cnt_step_t *cs = (cnt_step_t*)_data; - const bseq1_t *s = &cs->seqs[k]; + const fml_seq1_t *s = &cs->seqs[k]; int i, l; bfc_kmer_t x = bfc_kmer_null; uint64_t qmer = 0, mask = (1ULL<k) - 1; @@ -111,7 +111,7 @@ static void worker_count(void *_data, long k, int tid) } } -struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads) +struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads) { int i; cnt_step_t cs; @@ -577,10 +577,10 @@ typedef struct { bfc_ec1buf_t **e; int64_t n_processed; int n_seqs, flt_uniq; - bseq1_t *seqs; + fml_seq1_t *seqs; } ec_step_t; -static uint64_t max_streak(int k, const bfc_ch_t *ch, const bseq1_t *s) +static uint64_t max_streak(int k, const bfc_ch_t *ch, const fml_seq1_t *s) { int i, l; uint64_t max = 0, t = 0; @@ -602,7 +602,7 @@ static uint64_t max_streak(int k, const bfc_ch_t *ch, const bseq1_t *s) static void worker_ec(void *_data, long k, int tid) { ec_step_t *es = (ec_step_t*)_data; - bseq1_t *s = &es->seqs[k]; + fml_seq1_t *s = &es->seqs[k]; if (es->flt_uniq) { uint64_t max; max = max_streak(es->opt->k, es->ch, s); @@ -624,7 +624,7 @@ static void worker_ec(void *_data, long k, int tid) } else bfc_ec1(es->e[tid], s->seq, s->qual); } -float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, bseq1_t *seq) +float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, fml_seq1_t *seq) { bfc_ch_t *ch; int i, mode; @@ -663,12 +663,12 @@ float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, bseq1_t *seq) return kcov; } -float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq) +float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq) { return fml_correct_core(opt, 0, n, seq); } -float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq) +float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq) { return fml_correct_core(opt, 1, n, seq); } diff --git a/bseq.c b/bseq.c index 719bafb..b763fa1 100644 --- a/bseq.c +++ b/bseq.c @@ -6,10 +6,10 @@ #include "kseq.h" KSEQ_INIT(gzFile, gzread) -bseq1_t *bseq_read(const char *fn, int *n_) +fml_seq1_t *fml_seq_read(const char *fn, int *n_) { gzFile fp; - bseq1_t *seqs; + fml_seq1_t *seqs; kseq_t *ks; int m, n; uint64_t size = 0; @@ -21,10 +21,10 @@ bseq1_t *bseq_read(const char *fn, int *n_) m = n = 0; seqs = 0; while (kseq_read(ks) >= 0) { - bseq1_t *s; + fml_seq1_t *s; if (n >= m) { m = m? m<<1 : 256; - seqs = realloc(seqs, m * sizeof(bseq1_t)); + seqs = realloc(seqs, m * sizeof(fml_seq1_t)); } s = &seqs[n]; s->seq = strdup(ks->seq.s); diff --git a/example.c b/example.c index 5cf65dd..2ddb353 100644 --- a/example.c +++ b/example.c @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { fml_opt_t opt; int c, n_seqs, n_utg, gfa_out = 0; - bseq1_t *seqs; + fml_seq1_t *seqs; fml_utg_t *utg; fml_opt_init(&opt); @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) fprintf(stderr, " -g output the assembly graph in the GFA format\n"); return 1; } - seqs = bseq_read(argv[optind], &n_seqs); + seqs = fml_seq_read(argv[optind], &n_seqs); utg = fml_assemble(&opt, n_seqs, seqs, &n_utg); if (!gfa_out) fml_utg_print(n_utg, utg); else fml_utg_print_gfa(n_utg, utg); diff --git a/fml.h b/fml.h index fd7d466..f2e55bc 100644 --- a/fml.h +++ b/fml.h @@ -8,7 +8,7 @@ typedef struct { int32_t l_seq; char *seq, *qual; // NULL-terminated strings; length expected to match $l_seq -} bseq1_t; +} fml_seq1_t; #define MAG_F_AGGRESSIVE 0x20 // pop variant bubbles (not default) #define MAG_F_POPOPEN 0x40 // aggressive tip trimming (default) @@ -63,7 +63,7 @@ extern "C" { * * @return array of sequences */ -bseq1_t *bseq_read(const char *fn, int *n); +fml_seq1_t *fml_seq_read(const char *fn, int *n); /** * Initialize default parameters @@ -82,7 +82,7 @@ void fml_opt_init(fml_opt_t *opt); * * @return array of unitigs */ -fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, bseq1_t *seqs, int *n_utg); +fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, fml_seq1_t *seqs, int *n_utg); /** * Free unitigs @@ -103,7 +103,7 @@ void fml_utg_destroy(int n_utg, fml_utg_t *utg); * @param n_seqs number of sequences * @param seqs array of sequences */ -void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs); +void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs); /** * Error correction @@ -114,8 +114,8 @@ void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs); * * @return k-mer coverage */ -float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq); -float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq); +float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq); +float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq); /** * Construct FMD-index @@ -126,7 +126,7 @@ float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq); * * @return FMD-index on success; NULL if all input sequences are zero in length */ -struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq); +struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq); /** * Generate initial overlap graph diff --git a/internal.h b/internal.h index 37e4d96..5492971 100644 --- a/internal.h +++ b/internal.h @@ -12,7 +12,7 @@ extern "C" { void kt_for(int n_threads, void (*func)(void*,long,int), void *data, long n); void seq_reverse(int l, unsigned char *s); void seq_revcomp6(int l, unsigned char *s); -struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads); +struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads); #ifdef __cplusplus } diff --git a/misc.c b/misc.c index 6362000..9844ac9 100644 --- a/misc.c +++ b/misc.c @@ -40,7 +40,7 @@ void fml_opt_init(fml_opt_t *opt) opt->mag_opt.flag = MAG_F_NO_SIMPL | MAG_F_POPOPEN; } -void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs) +void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs) { int i, log_len; uint64_t tot_len = 0; @@ -62,7 +62,7 @@ static inline int is_rev_same(int l, const char *s) return (i == l>>1); } -struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt) +struct rld_t *fml_fmi_gen(int n, fml_seq1_t *seq, int is_mt) { mrope_t *mr; kstring_t str = {0,0,0}; @@ -80,7 +80,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt) mr = mr_init(ROPE_DEF_MAX_NODES, ROPE_DEF_BLOCK_LEN, MR_SO_RCLO); for (k = 0; k < n; ++k) { int i; - bseq1_t *s = &seq[k]; + fml_seq1_t *s = &seq[k]; if (s->l_seq == 0) continue; free(s->qual); for (i = 0; i < s->l_seq; ++i) @@ -121,7 +121,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt) return e; } -struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq) +struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq) { return fml_fmi_gen(n, seq, opt->n_threads > 1? 1 : 0); } @@ -277,7 +277,7 @@ void fml_utg_destroy(int n, fml_utg_t *utg) #define MAG_MIN_NSR_COEF .1 -fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, bseq1_t *seqs, int *n_utg) +fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, fml_seq1_t *seqs, int *n_utg) { rld_t *e; mag_t *g;