From 970794681e1c20b4622f278b683026ac3a9acff4 Mon Sep 17 00:00:00 2001 From: Calvin Date: Wed, 15 May 2013 11:45:08 -0400 Subject: added file checking for multifasta_to_otu --- src/c/multifasta_to_otu.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c index 268dec6..f61c76f 100644 --- a/src/c/multifasta_to_otu.c +++ b/src/c/multifasta_to_otu.c @@ -122,9 +122,6 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - // set defaults - - if(verbose) { printf("kmer: %d\n", kmer); printf("lambda: %d\n", lambda); @@ -136,6 +133,16 @@ int main(int argc, char **argv) { } + if(access (sensing_matrix_filename, F_OK) == -1) { + fprintf(stderr, "Error: could not find %s\n", sensing_matrix_filename); + exit(EXIT_FAILURE); + } + + if(access (sensing_fasta_filename, F_OK) == -1) { + fprintf(stderr, "Error: could not find %s\n", sensing_fasta_filename); + exit(EXIT_FAILURE); + } + input_directory_dh = opendir(input_fasta_directory); if(input_fasta_directory == NULL) { fprintf(stderr, "could not open %s\n", input_fasta_directory); @@ -155,6 +162,9 @@ int main(int argc, char **argv) { // 4 "ACGT" ^ Kmer gives us the size of output rows width = pow(4, kmer) + 1; sequences = count_sequences(sensing_fasta_filename); + if(sequences == 0) { + fprintf(stderr, "Error: %s contains 0 fasta sequences\n", sensing_fasta_filename); + } if(verbose) { printf("directory count: %d\n", dir_count); -- cgit v1.2.3