Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
scan up to 50k hit and prioritize the hits by (overlap length - overh…
Browse files Browse the repository at this point in the history
…ang length)
  • Loading branch information
pb-jchin committed Aug 22, 2015
1 parent 005d701 commit 3d2eda6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions LA4Falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

typedef struct {
int r_id;
int score;
int t_o;
int t_s;
int t_e;
Expand All @@ -76,12 +77,10 @@ typedef struct {

hit_record * hits;

#define MIN(X,Y) ((X) < (Y)) ? (X) : (Y)

static int compare_hits(const void * h1, const void *h2) {
int ovl_len1;
int ovl_len2;
ovl_len1 = ((hit_record *) h1)->t_e - ((hit_record *) h1)->t_s;
ovl_len2 = ((hit_record *) h2)->t_e - ((hit_record *) h2)->t_s;
return ovl_len2 - ovl_len1;
return ((hit_record *) h2)->score - ((hit_record *) h1)->score;
}


Expand Down Expand Up @@ -414,7 +413,7 @@ int main(int argc, char *argv[])
abuffer = New_Read_Buffer(db1);
bbuffer = New_Read_Buffer(db2);
if (FALCON) {
hits = calloc(sizeof(hit_record), 4096);
hits = calloc(sizeof(hit_record), 50001);
hit_count = 0;
}
}
Expand Down Expand Up @@ -639,13 +638,19 @@ int main(int argc, char *argv[])
}

if (skip_rest == 0) {
int ovl_len, overhang_len, score;
ovl_len = ovl->path.bepos - ovl->path.bbpos;
overhang_len = MIN( ovl->path.abpos, ovl->path.bbpos );
overhang_len += MIN( aln->alen - ovl->path.aepos, aln->blen - ovl->path.bepos);
score = ovl_len - overhang_len;
hits[hit_count].r_id = ovl->bread;
hits[hit_count].t_o = COMP(aln->flags);
hits[hit_count].t_s = ovl->path.bbpos;
hits[hit_count].t_e = ovl->path.bepos;
hits[hit_count].t_l = aln->blen;
hits[hit_count].score = score;
hit_count ++;
if (hit_count > MAX_HIT_COUNT * 2) skip_rest = 1;
if (hit_count > 50000) skip_rest = 1;

#undef TEST_ALN_OUT
#ifdef TEST_ALN_OUT
Expand Down

0 comments on commit 3d2eda6

Please sign in to comment.