aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kmer_utils.c11
-rw-r--r--kmer_utils.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/kmer_utils.c b/kmer_utils.c
index a8589c5..587404d 100644
--- a/kmer_utils.c
+++ b/kmer_utils.c
@@ -229,3 +229,14 @@ unsigned long long * get_kmer_counts_from_file(FILE *fh, const unsigned int kmer
return counts;
}
+
+unsigned long long * get_kmer_counts_from_filename(const char *fn, const unsigned int kmer) {
+ FILE *fh = fopen(fn, "r");
+ if(fh == NULL) {
+ fprintf(stderr, "Could not open %s - %s\n", fn, strerror(errno));
+ return 0;
+ }
+
+ return get_kmer_counts_from_file(fh, kmer);
+}
+
diff --git a/kmer_utils.h b/kmer_utils.h
index d71a607..ceb28eb 100644
--- a/kmer_utils.h
+++ b/kmer_utils.h
@@ -12,4 +12,5 @@ const unsigned char alpha[256];
// file loading functions
unsigned long long load_specific_mers_from_file(const char *fn, unsigned int kmer, size_t width, size_t *arr);
+unsigned long long * get_kmer_counts_from_filename(const char *fn, const unsigned int kmer);
unsigned long long * get_kmer_counts_from_file(FILE *fh, const int kmer);