aboutsummaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-05-15 11:45:08 -0400
committerCalvin <calvin@EESI>2013-05-15 11:45:08 -0400
commit970794681e1c20b4622f278b683026ac3a9acff4 (patch)
treeeb4a2200e84746f6f7faa6e8e68d650230d94490 /src/c
parentf5e6c210a95a98a4381e6142ad599e1ec3f8eff6 (diff)
added file checking for multifasta_to_otu
Diffstat (limited to 'src/c')
-rw-r--r--src/c/multifasta_to_otu.c16
1 files 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);