#include #include #include #include #include "dna.h" #include "dnacol.h" #include "region.h" //#include "nested.h" using namespace cis; char *OutFile; char *OutDNAFile; char *QueryRegionsFile; char *DNAIndexFile; char *DataDirectory; const int64_t MAXLENGTH = 100000; const int MaxFillLength = 100000; using std::cout; using std::endl; static struct option long_options[] = { {"query-regions-file", required_argument, 0, 'i'}, {"out-region-file", required_argument, 0, 'o'}, {"out-dna-file", required_argument, 0, 's'}, {"dna-index-file", required_argument, 0, 'd'}, {"data-directory", required_argument, 0, 'p'}, {0,0,0,0} }; int main(int argc, char ** argv) { int c; while (1) { int option_index = 0; c = getopt_long(argc, argv, "i:o:s:d:p:", long_options, &option_index); if (c == -1) break; switch (c) { case 0: if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s\n", optarg); break; case 'i': QueryRegionsFile = new char[strlen(optarg) +1]; strcpy(QueryRegionsFile, optarg); break; case 'o': OutFile = new char[strlen(optarg) + 1]; strcpy(OutFile, optarg); break; case 's': OutDNAFile = new char[strlen(optarg) + 1]; strcpy(OutDNAFile, optarg); break; case 'd': DNAIndexFile = new char[strlen(optarg) + 1]; strcpy(DNAIndexFile, optarg); break; case 'p': DataDirectory = new char[strlen(optarg) + 1]; strcpy(DataDirectory, optarg); break; default: printf("usage: getdna_simple -i -o \n" "-s -d -p \n" "\n" ": rdb file with regions to retrieve with fields\n" "(region_id group_id species dna start end strand name)\n" ": output file with (region_id, species, dna, start, end, strand)\n" ": output file with (region_id, sequence)\n" ": file containing paths and offsets of chromosomes\n" ": full path to files mentioned in species-file" ); exit(1); break; } } printf("Determining DNA lengths."); std::ifstream species_stream(DNAIndexFile); if (! species_stream) { cerr<<"Couldn't open species list file "<