summaryrefslogtreecommitdiffstats
path: root/src/aggregator.c (plain)
blob: c9a03b5e382c40526851925fd44e512047fe577f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Aggregate the collected influenza data into a single HDF5
 * container.
 */

#include "error/check_h5_error.h"
#include "load/load_influenza_aa_dat.h"
#include "load/load_influenza_faa.h"
#include <stdio.h>

#define H5FILE "influenza.h5"
#define INFLUENZA_AA_DAT "/home/don/exp004/genomes/INFLUENZA/influenza_aa.dat"
#define INFLUENZA_FAA "/home/don/exp004/genomes/INFLUENZA/influenza.faa"

int
main ()
{
  /*
   * Create a new HDF5 file if it does not already exist.  If an
   * existing file is found then open it.
   */
  hid_t file_id = 0;
  FILE *f = fopen (H5FILE, "r+");
  if (f == NULL)
    {
      file_id = H5Fcreate (H5FILE, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
      if (file_id < 0)
	check_h5_error (file_id, __FILE__, __LINE__);
    }
  else
    {
      fclose (f);
      file_id = H5Fopen (H5FILE, H5F_ACC_RDWR, H5P_DEFAULT);
      if (file_id < 0)
	check_h5_error (file_id, __FILE__, __LINE__);
    }

  /*
   * Load the supplementary protein data file.
   */
  printf ("Loading \"influenza_aa.dat\" with contents of %s.\n",
	  INFLUENZA_AA_DAT);
  load_influenza_aa_dat (file_id, INFLUENZA_AA_DAT);

  /*
   * Load the FASTA protein sequence data file.
   */
  printf ("Loading \"influenza.faa\" with contents of %s.\n",
	  INFLUENZA_FAA);
  load_influenza_faa (file_id, INFLUENZA_FAA);

  /*
   * 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.