Skip to content

Commit

Permalink
Merge with enze, Makefile cleanup and correct PyInit
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Valls Guimera committed Mar 6, 2013
2 parents 8729291 + 3dba043 commit f5ec7ee
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 22 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ tests: python
valgrind: python
valgrind --tool=memcheck --suppressions=facs/utils/valgrind-python.supp nosetests -P -v -s

python:
rm -rf build/ ${PROG}.so && python setup.py build_ext && python setup.py install
python: clean
python setup.py build_ext && python setup.py install

clean:
rm -rf build dist $(PROG).egg-info
cd facs; make clean
14 changes: 8 additions & 6 deletions facs/big_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand All @@ -107,7 +106,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;
Expand Down Expand Up @@ -171,9 +170,12 @@ int query(char* query, char* bloom_filter, double tole_rate, double sampling_rat

} //end while
if (normal == 0)
free (position);
free (position);

evaluate (detail, File_head->filename, File_head);
//if(zip != NULL) gzclose(zip);

if (normal == 0)
gzclose(zip);
bloom_destroy (bl_2);
statistic_save (detail, query, target_path);

Expand Down
2 changes: 1 addition & 1 deletion facs/big_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions facs/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file removed facs/facs
Binary file not shown.
2 changes: 1 addition & 1 deletion facs/facs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PyMODINIT_FUNC init_facs(void)
{
PyObject *m = Py_InitModule3("_facs", module_methods, module_docstring);
if (m == NULL)
return -1;
return;
}


Expand Down
1 change: 0 additions & 1 deletion facs/file_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 8 additions & 5 deletions facs/simple_check_1_ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ 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-=1;
}

while (p != next)
{
//printf ("p->%0.50s\n",p);
temp = jump (p, 2, sampling_rate); //generate random number and judge if need to scan this read

if (p != temp)
{
p = temp;
continue;
}

#pragma omp atomic
File_head->reads_num++;

Expand All @@ -59,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;
Expand All @@ -84,7 +83,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 -= 1;
}

char *p = info->location;

Expand Down
4 changes: 2 additions & 2 deletions facs/simple_remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*-------------------------------------*/
Expand All @@ -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;
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[egg_info]
tag_build = dev
tag_svn_revision = true
tag_svn_revision = false

0 comments on commit f5ec7ee

Please sign in to comment.