From 3d2eda6ff3d76a4a2c2a00aa5666ec49f31a19fc Mon Sep 17 00:00:00 2001 From: pb-jchin Date: Sat, 22 Aug 2015 00:14:39 -0700 Subject: [PATCH] scan up to 50k hit and prioritize the hits by (overlap length - overhang length) --- LA4Falcon.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/LA4Falcon.c b/LA4Falcon.c index 7385732..9d1b01d 100644 --- a/LA4Falcon.c +++ b/LA4Falcon.c @@ -68,6 +68,7 @@ typedef struct { int r_id; + int score; int t_o; int t_s; int t_e; @@ -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; } @@ -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; } } @@ -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