Skip to content

Commit

Permalink
get sequences tagged with user supplied splicing sites
Browse files Browse the repository at this point in the history
  • Loading branch information
Piezoid committed Jul 6, 2018
1 parent 841ff5b commit 21c7756
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions index.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,27 @@ int mm_idx_getseq(const mm_idx_t *mi, uint32_t rid, uint32_t st, uint32_t en, ui
return en - st;
}

int mm_idx_getseq_splicetags(const mm_idx_t *mi, uint32_t rid, uint32_t st, uint32_t en, uint8_t *seq)
{
int res = mm_idx_getseq(mi, rid, st, en, seq);
if (mi->splices) {
const splice_v splices = ((const splice_v*) mi->splices)[rid];
// Bissects splices array for the left of the interval
int low = 0, high = kv_size(splices) - 1;
while(low <= high) {
size_t mid = (low + high) / 2;
if (SPLICE_POS(kv_A(splices, mid)) >= st)
high = mid - 1;
else
low = mid + 1;
}
const splice_t* splices_end = &kv_A(splices, kv_size(splices));
for(const splice_t *p = &kv_A(splices, low) ; p < splices_end && SPLICE_POS(*p) < en; p++)
seq[SPLICE_POS(*p) - st] |= 1 << (4 + SPLICE_IS_DONOR(*p));
}
return res;
}

int32_t mm_idx_cal_max_occ(const mm_idx_t *mi, float f)
{
int i;
Expand Down
1 change: 1 addition & 0 deletions minimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ int mm_map_file_frag(const mm_idx_t *idx, int n_segs, const char **fn, const mm_
int mm_idx_index_name(mm_idx_t *mi);
int mm_idx_name2id(const mm_idx_t *mi, const char *name);
int mm_idx_getseq(const mm_idx_t *mi, uint32_t rid, uint32_t st, uint32_t en, uint8_t *seq);
int mm_idx_getseq_splicetags(const mm_idx_t *mi, uint32_t rid, uint32_t st, uint32_t en, uint8_t *seq);

// deprecated APIs for backward compatibility
void mm_mapopt_init(mm_mapopt_t *opt);
Expand Down

0 comments on commit 21c7756

Please sign in to comment.