Permalink
Browse files

added db creation

  • Loading branch information...
blackrim committed Mar 23, 2012
1 parent c225027 commit a5db322c52db9e6f94c8681d0741a40f01249476
Showing with 24 additions and 21 deletions.
  1. +11 −7 src/Makefile
  2. +13 −14 src/SQLiteDBController.cpp
View
@@ -1,6 +1,8 @@
CC = g++
CFLAGS = -msse3 -DSSE2 -O3 -g -w -Wall -fopenmp
CP := g++
CPFLAGS := -msse3 -DSSE2 -O3 -g -w -Wall -fopenmp
prefix = /usr/bin/
CPP_SRCS += \
sequence.cpp \
tree.cpp \
@@ -21,8 +23,9 @@ SWPS3_fasta.cpp \
SWPS3_matrix.cpp \
SWPS3_swps3.cpp \
SmithWatermanGotoh.cpp \
GenBankReader.cpp \
main.cpp \
utils.cpp
utils.cpp
OBJS += \
sequence.o \
@@ -44,6 +47,7 @@ SWPS3_fasta.o \
SWPS3_matrix.o \
SWPS3_swps3.o \
SmithWatermanGotoh.o \
GenBankReader.o \
main.o \
utils.o
@@ -67,13 +71,13 @@ SWPS3_fasta.d \
SWPS3_matrix.d \
SWPS3_swps3.d \
SmithWatermanGotoh.d \
GenBankReader.d \
main.d \
utils.d
# Each subdirectory must supply rules for building sources it contributes
%.o: ./%.cpp
$(CC) $(CFLAGS) -L../deps/linux/ -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
$(CP) $(CPFLAGS) -L../deps/linux/ -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
LIBS := -lm -lsqlitewrapped -lsqlite3 -fopenmp
@@ -85,9 +89,9 @@ RM := rm -rf
all: PHLAWD
# Tool invocations
PHLAWD: $(OBJS)
PHLAWD: $(OBJS) $(COBJS)
@echo 'Building target: $@'
$(CC) -msse3 -DSSE2 -L../deps/linux -o "PHLAWD" $(OBJS) $(LIBS)
$(CP) -msse3 -DSSE2 -L../deps/linux -o "PHLAWD" $(OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
View
@@ -28,7 +28,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdlib.h>
@@ -37,13 +36,16 @@
#include <time.h>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <regex.h>
#include <unistd.h>
using namespace std;
#include "libsqlitewrapped.h"
#include <sqlite3.h>
#include "GenBankReader.h"
#include "SQLiteDBController.h"
#include "utils.h"
@@ -209,27 +211,24 @@ void SQLiteDBController::load_seqs(string div,bool downl){
if (downl == true){
string cmd = "wget ftp://ftp.ncbi.nih.gov/genbank/gb"+division+"*.seq.gz";
cout << "downloading with wget" << endl;
FILE *fp = popen(cmd.c_str(), "r" );
char buff[1000];
while ( fgets( buff, sizeof buff, fp ) != NULL ) {//doesn't exit out
string line(buff);
}
pclose( fp );
system(cmd.c_str());
cmd = "gunzip -d gb"+division+"*.seq.gz";
cout << "uncompressing" << endl;
fp = popen(cmd.c_str(), "r" );
while ( fgets( buff, sizeof buff, fp ) != NULL ) {//doesn't exit out
string line(buff);
}
pclose( fp );
system(cmd.c_str());
}else{
cmd = "gunzip -d gb"+division+"*.seq.gz";
cout << "uncompressing" << endl;
system(cmd.c_str());
}
vector<string> file_names;
cout << "getting file names" << endl;
getdir(".",file_names);
for(int i=0;i<file_names.size();i++){
if(file_names[i].find("gb"+div) != string::npos && file_names[i].find(".seq") != string::npos){
if(file_names[i].find("gb"+div) != string::npos && file_names[i].substr(file_names[i].size()-4,4)==".seq"){
string filen = file_names[i];
cout << filen << endl;
GenBankReader gbr;
gbr.parse_file(filen,db_name);
}
}
/*handle = open(filen,"rU")

0 comments on commit a5db322

Please sign in to comment.