From c0838b7286f3da6ba1d0962b78df24b80c4a8d1d Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Tue, 9 Sep 2014 17:49:37 -0400 Subject: allow for kmer inference and fix memory leak in get_fasta_files_from_file --- src/c/quikr.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/c/quikr.c') diff --git a/src/c/quikr.c b/src/c/quikr.c index de1f39a..5ed72b0 100644 --- a/src/c/quikr.c +++ b/src/c/quikr.c @@ -131,25 +131,23 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } + // load sensing matrix + struct matrix *sensing_matrix = load_sensing_matrix(sensing_matrix_filename, kmer); + if(kmer == 0) { - fprintf(stderr, "Error: zero is not a valid kmer\n"); - exit(EXIT_FAILURE); + fprintf(stdout, "Warning: zero is not a valid kmer, inferring kmer from sensing matrix\n"); + kmer = sensing_matrix->kmer; } - // 4 "ACGT" ^ Kmer gives us the size of output rows width = pow_four(kmer); - // load sensing matrix - struct matrix *sensing_matrix = load_sensing_matrix(sensing_matrix_filename, kmer); - if(verbose) { printf("width: %llu\n", width); printf("sequences: %llu\n", sensing_matrix->sequences); } - // load counts matrix double *count_matrix = malloc(width * sizeof(double)); check_malloc(count_matrix, NULL); -- cgit v1.2.3