Пример #1
0
int main(int argc, char *argv[])
{
    if (argc == 1) usage(); // Print usage

    for (int i=0; i<argc; i++) 
    {
        cerr << argv[i] << ' ';
        cerr << endl;
    }

    Initial_Time();
    cerr<<"Start at:  "<<Curr_Time()<<endl;
    int noptions = mGetOptions(argc, argv);
    // Mutltithreads part
#if defined (_OPENMP)
    if (param.ncpu) omp_set_num_threads(param.ncpu);
#endif
    fin_db.open(ref_file.c_str());

    if (!fin_db)
    {
        cerr << "fatal error: failed to open ref file\n";
        exit(1);
    }

    ref.Run_ConvertBinseq(fin_db);
    cerr << "Load in " << ref.total_num << " reference seqs, total size " << ref.sum_length << " bp. " << Cal_AllTime() << " secs passed" << endl;
    ref.CreateIndex(); // Qgram_Index();

    cerr << "Create refseq k-mer index table. " << Cal_AllTime() << " secs passed" << endl;

    RunProcess();
    
    return 0;
}
Пример #2
0
int main(int argc, char *argv[])
{
	//print usage
	if (argc == 1)
	{
		usage();
	}
	Initial_Time();
	cout<<"Start at:  "<<Curr_Time()<<endl;
	int noptions;
	noptions=mGetOptions(argc, argv);
	fin_db.open(ref_file.c_str());
	if(!fin_db) {
		cerr<<"fatal error: failed to open ref file\n";
		exit(1);
	}
	ref.Run_ConvertBinseq(fin_db);
	cout<<"Load in "<<ref.total_num<<" db seqs, total size "<<ref.sum_length<<" bp. "<<Cal_AllTime()<<" secs passed"<<endl;			
	//single command:
	if(noptions==argc) {
		Do_Formatdb();
		RunProcess();
	}
  else {
  	int old_seed_size=0;
  	char * margv[1000];
  	for(int i=0; i<1000; i++) {
  		margv[i] = new char[1000];
  	}
  	char ch[10000];
  	ifstream fin_batch(argv[noptions]);
  	while(!fin_batch.eof()) {
  		fin_batch.getline(ch, 10000);
  		if(fin_batch.eof())
  			break;
  		cout<<"Line of options:  "<<ch<<endl;
  		bool is_word=0;
  		int margc=0;
  		char *q=margv[margc];
  		for(int i=0; ch[i]!='\0'; i++) {
  			if((ch[i]>=33)&&(ch[i]<=126)) {
  				if(!is_word) {
  					*q='\0';
  					margc++;
  					q=margv[margc];
  				}
  				is_word=1;
  				*q++=ch[i];
  			}
  			else {
  				is_word=0;
  			}
  		}
  		*q='\0';
  		margc++;
  		mGetOptions(margc, margv);
  		if(param.seed_size!=old_seed_size) {
  			if(ref.total_kmers>0)
  				ref.ReleaseIndex();
  			Do_Formatdb();
  			old_seed_size=param.seed_size;
  		}
  		RunProcess();
  	}
  	fin_batch.close();
  }
	return 0;
}