From 9aafbe618e8ba48c8afbed30497b2ad7e3378b8a Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 11 Jun 2013 10:24:46 -0400 Subject: use longs instead of ints, fix a mistake in the --help --- src/c/multifasta_to_otu.c | 22 +++++++++++----------- src/c/quikr.c | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/c') diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c index 2f4bf87..e0fb128 100644 --- a/src/c/multifasta_to_otu.c +++ b/src/c/multifasta_to_otu.c @@ -26,14 +26,14 @@ int main(int argc, char **argv) { double *sensing_matrix; - long int width = 0; - long int sequences = 0; + long width = 0; + long sequences = 0; int kmer = 6; int lambda = 10000; - int x = 0; - int y = 0; + long x = 0; + long y = 0; int jobs = 1; #ifdef Linux @@ -150,7 +150,7 @@ int main(int argc, char **argv) { } // do a directory count - int dir_count = -2; // -2 for ../ and ./ + long dir_count = -2; // -2 for ../ and ./ while(entry = readdir(input_directory_dh)) dir_count++; rewinddir(input_directory_dh); @@ -167,7 +167,7 @@ int main(int argc, char **argv) { } if(verbose) { - printf("directory count: %d\n", dir_count); + printf("directory count: %ld\n", dir_count); printf("width: %ld\nsequences %ld\n", width, sequences); } @@ -197,7 +197,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - int *file_sequence_count = malloc(dir_count * sizeof(int)); + long *file_sequence_count = malloc(dir_count * sizeof(long)); if(file_sequence_count == NULL) { fprintf(stderr, "Could not allocate enough memory\n"); exit(EXIT_FAILURE); @@ -206,12 +206,12 @@ int main(int argc, char **argv) { struct dirent result; omp_set_num_threads(jobs); - int done = 0; + long done = 0; printf("Beginning to process samples\n"); #pragma omp parallel for shared(solutions, sequences, width, result, done) - for(int i = 0; i < dir_count; i++ ) { + for(long i = 0; i < dir_count; i++ ) { - int z = 0; + long z = 0; struct dirent *directory_entry; char *filename = malloc(256 * sizeof(char)); char *base_filename = malloc(256 * sizeof(char)); @@ -269,7 +269,7 @@ int main(int argc, char **argv) { } done++; - printf("%d/%d samples processed\n", done, dir_count); + printf("%ld/%ld samples processed\n", done, dir_count); free(solution); free(count_matrix); free(filename); diff --git a/src/c/quikr.c b/src/c/quikr.c index 17d6480..f588c5f 100644 --- a/src/c/quikr.c +++ b/src/c/quikr.c @@ -12,7 +12,7 @@ #include "quikr_functions.h" #define sensing_matrix(i,j) (sensing_matrix[width*i + j]) -#define USAGE "Usage:\n\tmultifasta_to_otu [OPTION...] - Calculate estimated frequencies of bacteria in a sample.\n\nOptions:\n\n-i, --input\n\tthe sample's fasta file of NGS READS (fasta format)\n\n-f, --sensing-fasta\n\tlocation of the fasta file database used to create the sensing matrix (fasta format)\n\n-s, --sensing-matrix\n\t location of the sensing matrix. (trained from quikr_train)\n\n-k, --kmer\n\tspecify what size of kmer to use. (default value is 6)\n\n-l, --lambda\n\tlambda value to use. (default value is 10000)\n\n-o, --output\n\tOTU_FRACTION_PRESENT a vector representing the percentage of database sequence's presence in sample. (csv output)\n\n-v, --verbose\n\tverbose mode.\n\n-d, --debug\n\tdebug mode, read manpage for more details" +#define USAGE "Usage:\n\tquikr [OPTION...] - Calculate estimated frequencies of bacteria in a sample.\n\nOptions:\n\n-i, --input\n\tthe sample's fasta file of NGS READS (fasta format)\n\n-f, --sensing-fasta\n\tlocation of the fasta file database used to create the sensing matrix (fasta format)\n\n-s, --sensing-matrix\n\t location of the sensing matrix. (trained from quikr_train)\n\n-k, --kmer\n\tspecify what size of kmer to use. (default value is 6)\n\n-l, --lambda\n\tlambda value to use. (default value is 10000)\n\n-o, --output\n\tOTU_FRACTION_PRESENT a vector representing the percentage of database sequence's presence in sample. (csv output)\n\n-v, --verbose\n\tverbose mode.\n\n-d, --debug\n\tdebug mode, read manpage for more details" int main(int argc, char **argv) { @@ -24,8 +24,8 @@ int main(int argc, char **argv) { char *sensing_fasta_filename = NULL; char *output_filename = NULL; - int x = 0; - int y = 0; + long x = 0; + long y = 0; int verbose = 0; int debug = 0; @@ -33,8 +33,8 @@ int main(int argc, char **argv) { int lambda = 10000; int kmer = 6; - int width = 0; - int sequences = 0; + long width = 0; + long sequences = 0; while (1) { static struct option long_options[] = { @@ -144,7 +144,7 @@ int main(int argc, char **argv) { } if(verbose) { - printf("width: %d\nsequences %d\n", width, sequences); + printf("width: %ld\nsequences %ld\n", width, sequences); } double *sensing_matrix = load_sensing_matrix(sensing_matrix_filename, sequences, width); @@ -157,7 +157,7 @@ int main(int argc, char **argv) { } } - for(x= 0; x < sequences; x++) { + for(x = 0; x < sequences; x++) { sensing_matrix(x, 0) = 1.0; } // normalize our count_matrix -- cgit v1.2.3