summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2010-03-05 20:36:28 (GMT)
committer Don Pellegrino <don@drexel.edu>2010-03-05 20:36:28 (GMT)
commitebcdd299916c6e1315b9b62fd2344768a30ab75a (patch) (unidiff)
tree37d25c79e4a3d3425edce263d8061608dca0cd48
parent93b59ce51852ba69131a3e258ffd48f9de7d8bc5 (diff)
downloadexp007-ebcdd299916c6e1315b9b62fd2344768a30ab75a.zip
exp007-ebcdd299916c6e1315b9b62fd2344768a30ab75a.tar.gz
exp007-ebcdd299916c6e1315b9b62fd2344768a30ab75a.tar.bz2
Modified to take the location of the exp004 directory from an
environment variable.
-rw-r--r--src/aggregator.c33
-rw-r--r--src/assign/assign_blast_scores.c11
-rw-r--r--src/assign/assign_protein_type.c28
-rw-r--r--src/updator.c2
4 files changed, 60 insertions, 14 deletions
diff --git a/src/aggregator.c b/src/aggregator.c
index c789502..8057bb3 100644
--- a/src/aggregator.c
+++ b/src/aggregator.c
@@ -8,15 +8,25 @@
8#include "load/load_influenza_aa_dat.h"8#include "load/load_influenza_aa_dat.h"
9#include "load/load_influenza_faa.h"9#include "load/load_influenza_faa.h"
10#include <stdio.h>10#include <stdio.h>
11#include <stdlib.h>
12#include <string.h>
1113
12#define BLASTFILE "run20090807.del"14#define BLASTFILE "run20090807.del"
13#define H5FILE "influenza.h5"15#define H5FILE "influenza.h5"
14#define INFLUENZA_AA_DAT "/u/ac/dpellegr/Documents/exp004/genomes/INFLUENZA/influenza_aa.dat"16#define INFLUENZA_AA_DAT "/genomes/INFLUENZA/influenza_aa.dat"
15#define INFLUENZA_FAA "/u/ac/dpellegr/Documents/exp004/genomes/INFLUENZA/influenza.faa"17#define INFLUENZA_FAA "/genomes/INFLUENZA/influenza.faa"
1618
17int19int
18main ()20main ()
19{21{
22 char* exp004 = getenv ("EXP004");
23 if (exp004 == NULL)
24 {
25 printf ("EXP004 environment variable not set. This should be set to the "
26 "directory containing the genomes/INFLUENZA data.");
27 exit (0);
28 }
29
20 /*30 /*
21 * Create a new HDF5 file if it does not already exist. If an31 * Create a new HDF5 file if it does not already exist. If an
22 * existing file is found then open it.32 * existing file is found then open it.
@@ -40,15 +50,26 @@ main ()
40 /*50 /*
41 * Load the supplementary protein data file.51 * Load the supplementary protein data file.
42 */52 */
53 char* loc1 = malloc (strlen (exp004) + strlen (INFLUENZA_AA_DAT) + 1);
54 loc1[0] = '\0';
55 strcat (loc1, exp004);
56 strcat (loc1, INFLUENZA_AA_DAT);
43 printf ("Loading \"influenza_aa.dat\" with contents of %s.\n",57 printf ("Loading \"influenza_aa.dat\" with contents of %s.\n",
44 INFLUENZA_AA_DAT);58 loc1);
45 load_influenza_aa_dat (file_id, INFLUENZA_AA_DAT);59 load_influenza_aa_dat (file_id, loc1);
60 free (loc1);
4661
47 /*62 /*
48 * Load the FASTA protein sequence data file.63 * Load the FASTA protein sequence data file.
49 */64 */
50 printf ("Loading \"influenza.faa\" with contents of %s.\n", INFLUENZA_FAA);65 char* loc2 = malloc (strlen (exp004) + strlen (INFLUENZA_FAA) + 1);
51 load_influenza_faa (file_id, INFLUENZA_FAA);66 loc2[0] = '\0';
67 strcat (loc2, exp004);
68 strcat (loc2, INFLUENZA_FAA);
69 printf ("Loading \"influenza.faa\" with contents of %s.\n",
70 loc2);
71 load_influenza_faa (file_id, loc2);
72 free (loc2);
5273
53 /*74 /*
54 * Load the BLAST scores.75 * Load the BLAST scores.
diff --git a/src/assign/assign_blast_scores.c b/src/assign/assign_blast_scores.c
index 7c0493b..3bdcccc 100644
--- a/src/assign/assign_blast_scores.c
+++ b/src/assign/assign_blast_scores.c
@@ -30,7 +30,16 @@ assign_blast_scores (hid_t file_id)
30 * Write the contents of the matrix to a HDF5 file.30 * Write the contents of the matrix to a HDF5 file.
31 */31 */
32 PetscViewer viewer;32 PetscViewer viewer;
33 PetscErrorCode err = PetscViewerHDF5Open (PETSC_COMM_WORLD, "sparse.h5", FILE_MODE_WRITE, &viewer);33
34 // PetscErrorCode err =
35 // PetscViewerHDF5Open (PETSC_COMM_WORLD, "sparse.h5", FILE_MODE_WRITE, &viewer);
36
37 PetscErrorCode err =
38 PetscViewerBinaryOpen (PETSC_COMM_WORLD,
39 "sparse.petsc",
40 FILE_MODE_WRITE,
41 &viewer);
42
34 MatView (M, viewer);43 MatView (M, viewer);
35 PetscViewerDestroy (viewer);44 PetscViewerDestroy (viewer);
3645
diff --git a/src/assign/assign_protein_type.c b/src/assign/assign_protein_type.c
index 065880f..52a0b70 100644
--- a/src/assign/assign_protein_type.c
+++ b/src/assign/assign_protein_type.c
@@ -19,18 +19,26 @@
19/*19/*
20 * BLAST database containing all of the influenza protein sequences.20 * BLAST database containing all of the influenza protein sequences.
21 */21 */
22#define SEQDB "/u/ac/dpellegr/Documents/exp004/influenzadb/influenzadb"22#define SEQDB "/influenzadb/influenzadb"
2323
24/*24/*
25 * BLAST reference database of prototypical protein types.25 * BLAST reference database of prototypical protein types.
26 */26 */
27#define REFDB "/u/ac/dpellegr/Documents/exp004/influenzadb/proteinnames"27#define REFDB "/influenzadb/proteinnames"
2828
29#define BUFFER_LEN 5029#define BUFFER_LEN 50
3030
31void31void
32assign_protein_type (hid_t file_id)32assign_protein_type (hid_t file_id)
33{33{
34 char* exp004 = getenv ("EXP004");
35 if (exp004 == NULL)
36 {
37 printf ("EXP004 environment variable not set. This should be set to the "
38 "directory containing the genomes/INFLUENZA data.");
39 exit (0);
40 }
41
34 /*42 /*
35 * Iterate through the records for which no protein type has been43 * Iterate through the records for which no protein type has been
36 * assigned. Create a BioSeq Pointer to the data and then use this44 * assigned. Create a BioSeq Pointer to the data and then use this
@@ -47,7 +55,12 @@ assign_protein_type (hid_t file_id)
47 /*55 /*
48 * Open the BLAST sequence database.56 * Open the BLAST sequence database.
49 */57 */
50 ReadDBFILEPtr seqdb = readdb_new (SEQDB, true);58 char* loc1 = malloc (strlen (exp004) + strlen (SEQDB) + 1);
59 loc1[0] = '\0';
60 strcat (loc1, exp004);
61 strcat (loc1, SEQDB);
62 ReadDBFILEPtr seqdb = readdb_new (loc1, true);
63 free (loc1);
5164
52 /*65 /*
53 * Get default BLAST options.66 * Get default BLAST options.
@@ -215,14 +228,19 @@ assign_protein_type (hid_t file_id)
215 "record set. See the BLAST formatdb.log file "228 "record set. See the BLAST formatdb.log file "
216 "for details.\n", faa_buf[i].gi);229 "for details.\n", faa_buf[i].gi);
217 }230 }
218231
232 char* loc2 = malloc (strlen (exp004) + strlen (REFDB) + 1);
233 loc2[0] = '\0';
234 strcat (loc2, exp004);
235 strcat (loc2, REFDB);
219 SeqAlignPtr seqalign = BioseqBlastEngine (bsp,236 SeqAlignPtr seqalign = BioseqBlastEngine (bsp,
220 "blastp",237 "blastp",
221 REFDB,238 loc2,
222 options,239 options,
223 NULL,240 NULL,
224 &error_returns,241 &error_returns,
225 NULL);242 NULL);
243 free (loc2);
226244
227 /*245 /*
228 * BLAST reported an error. Write it out and continue processing.246 * BLAST reported an error. Write it out and continue processing.
diff --git a/src/updator.c b/src/updator.c
index 0bade65..b443183 100644
--- a/src/updator.c
+++ b/src/updator.c
@@ -31,9 +31,7 @@ main (int argc, char **argv)
31 /*31 /*
32 * Assign protein type values to the sequence records.32 * Assign protein type values to the sequence records.
33 */33 */
34 /*
35 assign_protein_type (file_id);34 assign_protein_type (file_id);
36 */
3735
38 /*36 /*
39 * Assign pairwise BLAST scores.37 * Assign pairwise BLAST scores.

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.