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) (side-by-side diff)
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 @@
#include "load/load_influenza_aa_dat.h"
#include "load/load_influenza_faa.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#define BLASTFILE "run20090807.del"
#define H5FILE "influenza.h5"
-#define INFLUENZA_AA_DAT "/u/ac/dpellegr/Documents/exp004/genomes/INFLUENZA/influenza_aa.dat"
-#define INFLUENZA_FAA "/u/ac/dpellegr/Documents/exp004/genomes/INFLUENZA/influenza.faa"
+#define INFLUENZA_AA_DAT "/genomes/INFLUENZA/influenza_aa.dat"
+#define INFLUENZA_FAA "/genomes/INFLUENZA/influenza.faa"
int
main ()
{
+ char* exp004 = getenv ("EXP004");
+ if (exp004 == NULL)
+ {
+ printf ("EXP004 environment variable not set. This should be set to the "
+ "directory containing the genomes/INFLUENZA data.");
+ exit (0);
+ }
+
/*
* Create a new HDF5 file if it does not already exist. If an
* existing file is found then open it.
@@ -40,15 +50,26 @@ main ()
/*
* Load the supplementary protein data file.
*/
+ char* loc1 = malloc (strlen (exp004) + strlen (INFLUENZA_AA_DAT) + 1);
+ loc1[0] = '\0';
+ strcat (loc1, exp004);
+ strcat (loc1, INFLUENZA_AA_DAT);
printf ("Loading \"influenza_aa.dat\" with contents of %s.\n",
- INFLUENZA_AA_DAT);
- load_influenza_aa_dat (file_id, INFLUENZA_AA_DAT);
+ loc1);
+ load_influenza_aa_dat (file_id, loc1);
+ free (loc1);
/*
* 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);
+ char* loc2 = malloc (strlen (exp004) + strlen (INFLUENZA_FAA) + 1);
+ loc2[0] = '\0';
+ strcat (loc2, exp004);
+ strcat (loc2, INFLUENZA_FAA);
+ printf ("Loading \"influenza.faa\" with contents of %s.\n",
+ loc2);
+ load_influenza_faa (file_id, loc2);
+ free (loc2);
/*
* 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)
* Write the contents of the matrix to a HDF5 file.
*/
PetscViewer viewer;
- PetscErrorCode err = PetscViewerHDF5Open (PETSC_COMM_WORLD, "sparse.h5", FILE_MODE_WRITE, &viewer);
+
+ // PetscErrorCode err =
+ // PetscViewerHDF5Open (PETSC_COMM_WORLD, "sparse.h5", FILE_MODE_WRITE, &viewer);
+
+ PetscErrorCode err =
+ PetscViewerBinaryOpen (PETSC_COMM_WORLD,
+ "sparse.petsc",
+ FILE_MODE_WRITE,
+ &viewer);
+
MatView (M, viewer);
PetscViewerDestroy (viewer);
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 @@
/*
* BLAST database containing all of the influenza protein sequences.
*/
-#define SEQDB "/u/ac/dpellegr/Documents/exp004/influenzadb/influenzadb"
+#define SEQDB "/influenzadb/influenzadb"
/*
* BLAST reference database of prototypical protein types.
*/
-#define REFDB "/u/ac/dpellegr/Documents/exp004/influenzadb/proteinnames"
+#define REFDB "/influenzadb/proteinnames"
#define BUFFER_LEN 50
void
assign_protein_type (hid_t file_id)
{
+ char* exp004 = getenv ("EXP004");
+ if (exp004 == NULL)
+ {
+ printf ("EXP004 environment variable not set. This should be set to the "
+ "directory containing the genomes/INFLUENZA data.");
+ exit (0);
+ }
+
/*
* Iterate through the records for which no protein type has been
* assigned. Create a BioSeq Pointer to the data and then use this
@@ -47,7 +55,12 @@ assign_protein_type (hid_t file_id)
/*
* Open the BLAST sequence database.
*/
- ReadDBFILEPtr seqdb = readdb_new (SEQDB, true);
+ char* loc1 = malloc (strlen (exp004) + strlen (SEQDB) + 1);
+ loc1[0] = '\0';
+ strcat (loc1, exp004);
+ strcat (loc1, SEQDB);
+ ReadDBFILEPtr seqdb = readdb_new (loc1, true);
+ free (loc1);
/*
* Get default BLAST options.
@@ -215,14 +228,19 @@ assign_protein_type (hid_t file_id)
"record set. See the BLAST formatdb.log file "
"for details.\n", faa_buf[i].gi);
}
-
+
+ char* loc2 = malloc (strlen (exp004) + strlen (REFDB) + 1);
+ loc2[0] = '\0';
+ strcat (loc2, exp004);
+ strcat (loc2, REFDB);
SeqAlignPtr seqalign = BioseqBlastEngine (bsp,
"blastp",
- REFDB,
+ loc2,
options,
NULL,
&error_returns,
NULL);
+ free (loc2);
/*
* 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)
/*
* Assign protein type values to the sequence records.
*/
- /*
assign_protein_type (file_id);
- */
/*
* Assign pairwise BLAST scores.

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.