From dec2ecb2e34c5e84d31286bac1e52d3eef523027 Mon Sep 17 00:00:00 2001 From: tzcoolman Date: Tue, 5 Mar 2013 20:50:53 +0100 Subject: [PATCH 1/4] extra line at the end tolerant --- facs/simple_check_1_ge.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/facs/simple_check_1_ge.c b/facs/simple_check_1_ge.c index 74c4b90..9863a49 100644 --- a/facs/simple_check_1_ge.c +++ b/facs/simple_check_1_ge.c @@ -38,6 +38,8 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, next = info->next->location; } else { next = strchr (p, '\0'); + if ((next-1)=='\n' && (next-2)=='\n') + next-=1; } while (p != next) @@ -84,7 +86,11 @@ fasta_process (bloom * bl, Queue * info, Queue * tail, F_set * File_head, else if (info->next != tail) next = info->next->location; else - next = strchr (info->location, '\0'); + { + next = strchr (info->location, '\0'); + if ((next-1)=='\n' && (next-2)=='\n') + next -= 1; + } char *p = info->location; From 1c33d4fc27b6e11ed0d36ad6daaef723e9c52638 Mon Sep 17 00:00:00 2001 From: tzcoolman Date: Tue, 5 Mar 2013 22:34:18 +0100 Subject: [PATCH 2/4] check --- facs/simple_check_1_ge.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/facs/simple_check_1_ge.c b/facs/simple_check_1_ge.c index 9863a49..f33b26c 100644 --- a/facs/simple_check_1_ge.c +++ b/facs/simple_check_1_ge.c @@ -38,13 +38,18 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, next = info->next->location; } else { next = strchr (p, '\0'); - if ((next-1)=='\n' && (next-2)=='\n') + if ((next-1)=='\n') next-=1; } + + printf ("p->%0.30s\n",p); + printf ("next->%0.30\n",next); + while (p != next) { - //printf ("p->%0.50s\n",p); + //printf ("p->%0.30s\n",p); + // printf ("next->%0.30\n",next); temp = jump (p, 2, sampling_rate); //generate random number and judge if need to scan this read if (p != temp) @@ -88,7 +93,7 @@ fasta_process (bloom * bl, Queue * info, Queue * tail, F_set * File_head, else { next = strchr (info->location, '\0'); - if ((next-1)=='\n' && (next-2)=='\n') + if ((next-1)=='\n') next -= 1; } From 92d9bc8b587487a2121f2973d0cbd62ebde1b916 Mon Sep 17 00:00:00 2001 From: tzcoolman Date: Tue, 5 Mar 2013 22:47:22 +0100 Subject: [PATCH 3/4] ??? --- facs/big_query.c | 2 +- facs/simple_check_1_ge.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/facs/big_query.c b/facs/big_query.c index feb6a5e..8f8af24 100644 --- a/facs/big_query.c +++ b/facs/big_query.c @@ -107,7 +107,7 @@ int query(char* query, char* bloom_filter, double tole_rate, double sampling_rat normal = 0; } - if (strstr(query, ".fastq") || strstr(query, ".fq")) + if (strstr(query, ".fastq")!=NULL || strstr(query, ".fq")!=NULL) type = 2; else type = 1; diff --git a/facs/simple_check_1_ge.c b/facs/simple_check_1_ge.c index f33b26c..cbc1b1b 100644 --- a/facs/simple_check_1_ge.c +++ b/facs/simple_check_1_ge.c @@ -43,7 +43,7 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, } printf ("p->%0.30s\n",p); - printf ("next->%0.30\n",next); + printf ("next->%0.30s\n",next); while (p != next) From 3dba0439c8b722005f69c13f162caffd180dd51b Mon Sep 17 00:00:00 2001 From: tzcoolman Date: Wed, 6 Mar 2013 08:51:01 +0100 Subject: [PATCH 4/4] wierd missing functions discription in check.h --- facs/big_query.c | 6 +++--- facs/big_query.h | 2 +- facs/check.h | 4 ++-- facs/file_dir.c | 1 - facs/simple_check_1_ge.c | 8 -------- facs/simple_remove.c | 4 ++-- 6 files changed, 8 insertions(+), 17 deletions(-) diff --git a/facs/big_query.c b/facs/big_query.c index 8f8af24..4bfb719 100644 --- a/facs/big_query.c +++ b/facs/big_query.c @@ -75,9 +75,8 @@ int bq_main(int argc, char** argv) return query(source, ref, tole_rate, sampling_rate, list, target_path); } -int query(char* query, char* bloom_filter, double tole_rate, double sampling_rate, char* list, char* target_path) +int query(char* query, char* bloom_filter, float tole_rate, float sampling_rate, char* list, char* target_path) { - gzFile zip; int type = 0, normal = 0; BIGCAST offset = 0; @@ -95,7 +94,7 @@ int query(char* query, char* bloom_filter, double tole_rate, double sampling_rat if (tole_rate==0) tole_rate = mco_suggestion (bl_2->k_mer); - if ((get_size (query)<2*ONEG) && !strstr(query,".gz") & !strstr(query, ".tar")) + if ((get_size (query)<2*ONEG) && !strstr(query,".gz") && !strstr(query, ".tar")) normal = 1; else { @@ -173,6 +172,7 @@ int query(char* query, char* bloom_filter, double tole_rate, double sampling_rat if (normal == 0) free (position); evaluate (detail, File_head->filename, File_head); + if (normal == 0) gzclose(zip); bloom_destroy (bl_2); statistic_save (detail, query, target_path); diff --git a/facs/big_query.h b/facs/big_query.h index 7a2ab44..d764e17 100644 --- a/facs/big_query.h +++ b/facs/big_query.h @@ -11,5 +11,5 @@ extern void clean_list (Queue* head, Queue *tail); extern BIGCAST CHUNKer(gzFile zip,BIGCAST offset,int chunk,char *data,int type); extern BIGCAST CHUNKgz(gzFile zip, BIGCAST offset,int chunk,char *position,char *extra,int type); extern int bq_main (int argc, char **argv); -extern int query (char* query, char* bloom_filter, double tole_rate, double sampling_rate, char* list, char* target_path); +extern int query (char* query, char* bloom_filter, float tole_rate, float sampling_rate, char* list, char* target_path); #endif diff --git a/facs/check.h b/facs/check.h index 2555828..49c21c0 100644 --- a/facs/check.h +++ b/facs/check.h @@ -4,6 +4,6 @@ #include "bloom.h" extern void evaluate (char *detail, char *filename, F_set *File_head); extern void statistic_save (char *detail, char *filename, char* prefix); -void fasta_process (bloom * bl, Queue * info, Queue * tail, F_set *File_head, float sampling_rate, float tole_rate); - +extern void fasta_process (bloom * bl, Queue * info, Queue * tail, F_set *File_head, float sampling_rate, float tole_rate); +extern void fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, float sampling_rate, float tole_rate); #endif diff --git a/facs/file_dir.c b/facs/file_dir.c index f38c201..6459a46 100644 --- a/facs/file_dir.c +++ b/facs/file_dir.c @@ -120,7 +120,6 @@ make_list (char *file_user, char *list_user) if (!strstr (dir_info->d_name, ".bloom")) continue; - printf ("file_path->%s\n", file_path); F_set *fset = NEW (F_set); fset->filename = file_path; fset->number = &number; diff --git a/facs/simple_check_1_ge.c b/facs/simple_check_1_ge.c index cbc1b1b..68d6fd2 100644 --- a/facs/simple_check_1_ge.c +++ b/facs/simple_check_1_ge.c @@ -42,14 +42,8 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, next-=1; } - printf ("p->%0.30s\n",p); - printf ("next->%0.30s\n",next); - - while (p != next) { - //printf ("p->%0.30s\n",p); - // printf ("next->%0.30\n",next); temp = jump (p, 2, sampling_rate); //generate random number and judge if need to scan this read if (p != temp) @@ -57,7 +51,6 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, p = temp; continue; } - #pragma omp atomic File_head->reads_num++; @@ -66,7 +59,6 @@ fastq_process (bloom * bl, Queue * info, Queue *tail, F_set * File_head, #pragma omp atomic File_head->reads_contam++; } - p = strchr (p, '\n') + 1; p = strchr (p, '\n') + 1; p = strchr (p, '\n') + 1; diff --git a/facs/simple_remove.c b/facs/simple_remove.c index 9092eed..424be78 100644 --- a/facs/simple_remove.c +++ b/facs/simple_remove.c @@ -67,8 +67,6 @@ int remove_reads(char *source, char *ref, char *list, char *prefix, float tole_r /*-------------------------------------*/ int type = 1; char *position; - //char *clean; - //char *contam; char *clean2; char *contam2; /*-------------------------------------*/ @@ -83,6 +81,7 @@ int remove_reads(char *source, char *ref, char *list, char *prefix, float tole_r /*-------------------------------------*/ position = mmaping (source); type = get_parainfo (position, head); + //printf ("position->%0.10s\n",head->next->location); clean = (char *) malloc (strlen (position) * sizeof (char)); contam = (char *) malloc (strlen (position) * sizeof (char)); clean2 = clean; @@ -96,6 +95,7 @@ int remove_reads(char *source, char *ref, char *list, char *prefix, float tole_r if (tole_rate==0) tole_rate = mco_suggestion (bl_2->k_mer); + //head = head->next; #pragma omp parallel { #pragma omp single nowait