code backup

This commit is contained in:
Heng Li 2014-09-08 08:52:02 -04:00
parent 1934f0cf24
commit ca61fe3ad5
2 changed files with 16 additions and 8 deletions

View File

@ -377,7 +377,7 @@ KSORT_INIT(mem_ars2, mem_alnreg_t, alnreg_slt2)
#define alnreg_slt(a, b) ((a).score > (b).score || ((a).score == (b).score && ((a).rb < (b).rb || ((a).rb == (b).rb && (a).qb < (b).qb)))) #define alnreg_slt(a, b) ((a).score > (b).score || ((a).score == (b).score && ((a).rb < (b).rb || ((a).rb == (b).rb && (a).qb < (b).qb))))
KSORT_INIT(mem_ars, mem_alnreg_t, alnreg_slt) KSORT_INIT(mem_ars, mem_alnreg_t, alnreg_slt)
#define alnreg_hlt(a, b) ((a).score > (b).score || ((a).score == (b).score && (a).hash < (b).hash)) #define alnreg_hlt(a, b) ((a).is_alt < (b).is_alt || ((a).is_alt == (b).is_alt && ((a).score > (b).score || ((a).score == (b).score && (a).hash < (b).hash))))
KSORT_INIT(mem_ars_hash, mem_alnreg_t, alnreg_hlt) KSORT_INIT(mem_ars_hash, mem_alnreg_t, alnreg_hlt)
#define PATCH_MAX_R_BW 0.05f #define PATCH_MAX_R_BW 0.05f
@ -475,14 +475,17 @@ int mem_test_and_remove_exact(const mem_opt_t *opt, int n, mem_alnreg_t *a, int
return n - 1; return n - 1;
} }
void mem_mark_primary_se(const mem_opt_t *opt, int n, mem_alnreg_t *a, int64_t id) void mem_mark_primary_se(const mem_opt_t *opt, int _n, mem_alnreg_t *a, int64_t id)
{ // similar to the loop in mem_chain_flt() { // similar to the loop in mem_chain_flt()
int i, k, tmp; int i, k, tmp, n;
kvec_t(int) z; kvec_t(int) z;
if (n == 0) return; if (n_ == 0) return;
kv_init(z); kv_init(z);
for (i = 0; i < n; ++i) a[i].sub = 0, a[i].secondary = -1, a[i].hash = hash_64(id+i); for (i = 0; i < n_; ++i) a[i].sub = 0, a[i].secondary = -1, a[i].hash = hash_64(id+i);
ks_introsort(mem_ars_hash, n, a); ks_introsort(mem_ars_hash, n_, a);
for (i = 0; i < n_; ++i)
if (a[i].is_alt) break;
if ((n = i) == 0) return;
tmp = opt->a + opt->b; tmp = opt->a + opt->b;
tmp = opt->o_del + opt->e_del > tmp? opt->o_del + opt->e_del : tmp; tmp = opt->o_del + opt->e_del > tmp? opt->o_del + opt->e_del : tmp;
tmp = opt->o_ins + opt->e_ins > tmp? opt->o_ins + opt->e_ins : tmp; tmp = opt->o_ins + opt->e_ins > tmp? opt->o_ins + opt->e_ins : tmp;
@ -995,6 +998,11 @@ mem_alnreg_v mem_align1_core(const mem_opt_t *opt, const bwt_t *bwt, const bntse
printf("** %d, [%d,%d) <=> [%ld,%ld)\n", p->score, p->qb, p->qe, (long)p->rb, (long)p->re); printf("** %d, [%d,%d) <=> [%ld,%ld)\n", p->score, p->qb, p->qe, (long)p->rb, (long)p->re);
} }
} }
for (i = 0; i < regs.n; ++i) {
mem_alnreg_t *p = &regs.a[i];
if (p->rid >= 0 && bns->anns[p->rid].is_alt)
p->is_alt = 1;
}
return regs; return regs;
} }
@ -1077,7 +1085,7 @@ typedef struct {
const mem_pestat_t *pes; const mem_pestat_t *pes;
smem_aux_t **aux; smem_aux_t **aux;
bseq1_t *seqs; bseq1_t *seqs;
mem_alnreg_v *regs, *regs_alt; mem_alnreg_v *regs;
int64_t n_processed; int64_t n_processed;
} worker_t; } worker_t;

View File

@ -68,7 +68,7 @@ typedef struct {
int seedcov; // length of regions coverged by seeds int seedcov; // length of regions coverged by seeds
int secondary; // index of the parent hit shadowing the current hit; <0 if primary int secondary; // index of the parent hit shadowing the current hit; <0 if primary
int seedlen0; // length of the starting seed int seedlen0; // length of the starting seed
int n_comp; // number of sub-alignments chained together int n_comp:30, is_alt:2; // number of sub-alignments chained together
float frac_rep; float frac_rep;
uint64_t hash; uint64_t hash;
} mem_alnreg_t; } mem_alnreg_t;