Permalink
Browse files

move mem_fill_scmat() to bwa.{h,c}

  • Loading branch information...
lh3 committed Mar 5, 2013
1 parent efd9769 commit 07921659cf28db08961545351ba188287c40c2b4
Showing with 14 additions and 13 deletions.
  1. +11 −0 bwa.c
  2. +1 −0 bwa.h
  3. +1 −12 bwamem.c
  4. +1 −1 fastmap.c
View
11 bwa.c
@@ -69,6 +69,17 @@ bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_)
* CIGAR related *
*****************/
+void bwa_fill_scmat(int a, int b, int8_t mat[25])
+{
+ int i, j, k;
+ for (i = k = 0; i < 4; ++i) {
+ for (j = 0; j < 4; ++j)
+ mat[k++] = i == j? a : -b;
+ mat[k++] = 0; // ambiguous base
+ }
+ for (j = 0; j < 5; ++j) mat[k++] = 0;
+}
+
// Generate CIGAR when the alignment end points are known
uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM)
{
View
1 bwa.h
@@ -30,6 +30,7 @@ extern "C" {
bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_);
+ void bwa_fill_scmat(int a, int b, int8_t mat[25]);
uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM);
int bwa_fix_xref(const int8_t mat[25], int q, int r, int w, const bntseq_t *bns, const uint8_t *pac, uint8_t *query, int *qb, int *qe, int64_t *rb, int64_t *re);
View
@@ -58,21 +58,10 @@ mem_opt_t *mem_opt_init()
o->chunk_size = 10000000;
o->n_threads = 1;
o->max_matesw = 100;
- mem_fill_scmat(o->a, o->b, o->mat);
+ bwa_fill_scmat(o->a, o->b, o->mat);
return o;
}
-void mem_fill_scmat(int a, int b, int8_t mat[25])
-{
- int i, j, k;
- for (i = k = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- mat[k++] = i == j? a : -b;
- mat[k++] = 0; // ambiguous base
- }
- for (j = 0; j < 5; ++j) mat[k++] = 0;
-}
-
/***************************
* SMEM iterator interface *
***************************/
View
@@ -84,7 +84,7 @@ int main_mem(int argc, char *argv[])
return 1;
}
- mem_fill_scmat(opt->a, opt->b, opt->mat);
+ bwa_fill_scmat(opt->a, opt->b, opt->mat);
if ((idx = bwa_idx_load(argv[optind], BWA_IDX_ALL)) == 0) return 1; // FIXME: memory leak
bwa_print_sam_hdr(idx->bns, rg_line);

0 comments on commit 0792165

Please sign in to comment.