From ebcdd299916c6e1315b9b62fd2344768a30ab75a Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Fri, 05 Mar 2010 20:36:28 +0000 Subject: Modified to take the location of the exp004 directory from an environment variable. --- 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 +#include +#include #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. -- cgit v0.8.3.1-22-g547a