summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2010-01-18 04:22:23 (GMT)
committer Don Pellegrino <don@drexel.edu>2010-01-18 04:22:23 (GMT)
commit6848b5e1aad3265278c728f8ae0849de31de4472 (patch) (side-by-side diff)
tree6e286d2ae4e16deb60fc5d85e92b9bea22679364
parentc9b5307e5d4acd555aaf8629915020e4a70bb652 (diff)
downloadexp007-6848b5e1aad3265278c728f8ae0849de31de4472.zip
exp007-6848b5e1aad3265278c728f8ae0849de31de4472.tar.gz
exp007-6848b5e1aad3265278c728f8ae0849de31de4472.tar.bz2
Moved updating the HDF5 file to a separate driver.
-rw-r--r--src/Makefile.am11
-rw-r--r--src/aggregator.c7
-rw-r--r--src/updator.c33
3 files changed, 43 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fcbcdd5..a7e6852 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,15 +1,18 @@
-bin_PROGRAMS = aggregator
+bin_PROGRAMS = aggregator updator
aggregator_SOURCES = \
aggregator.c \
- assign_protein_type.c \
check_error.c \
check_h5_error.c \
- check_ncbi_error.c \
load_influenza_aa_dat.c \
load_influenza_faa.c
-aggregator_LDADD = -lhdf5
+updator_SOURCES = \
+ updator.c \
+ check_error.c \
+ check_h5_error.c \
+ check_ncbi_error.c \
+ assign_protein_type.c
noinst_HEADERS = \
assign_protein_type.h \
diff --git a/src/aggregator.c b/src/aggregator.c
index 36ea18c..07aba39 100644
--- a/src/aggregator.c
+++ b/src/aggregator.c
@@ -3,7 +3,6 @@
* container.
*/
-#include "assign_protein_type.h"
#include "check_h5_error.h"
#include "load_influenza_aa_dat.h"
#include "load_influenza_faa.h"
@@ -17,6 +16,8 @@ main ()
* Create the HDF5 file.
*/
hid_t file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (file_id < 0)
+ check_h5_error (file_id, __FILE__, __LINE__);
/*
* Load the supplementary protein data file.
@@ -29,13 +30,11 @@ main ()
load_influenza_faa (file_id);
/*
- * Close the HD5 file.
+ * Close the HDF5 file.
*/
herr_t status = H5Fclose (file_id);
if (status < 0)
check_h5_error (status, __FILE__, __LINE__);
- // assign_protein_type (0);
-
return 0;
}
diff --git a/src/updator.c b/src/updator.c
new file mode 100644
index 0000000..8d556da
--- a/dev/null
+++ b/src/updator.c
@@ -0,0 +1,33 @@
+/*
+ * Update derived fields.
+ */
+
+#include "assign_protein_type.h"
+#include "check_h5_error.h"
+
+#define FILE "influenza.h5"
+
+int
+main ()
+{
+ /*
+ * Open the HDF5 file.
+ */
+ hid_t file_id = H5Fopen (FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ if (file_id < 0)
+ check_h5_error (file_id, __FILE__, __LINE__);
+
+ /*
+ * Assign protein type values to the sequence records.
+ */
+ assign_protein_type (file_id);
+
+ /*
+ * Close the HDF5 file.
+ */
+ herr_t status = H5Fclose (file_id);
+ if (status < 0)
+ check_h5_error (status, __FILE__, __LINE__);
+
+ return 0;
+}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.