コード例 #1
0
ファイル: main.cpp プロジェクト: rhinempi/sparkhit
void RunProcess(void) {

    if (!query_a_file.empty())
    {
        fin_a.open(query_a_file.c_str());
        if (!fin_a)
        {
            cerr << "failed to open file: "<< query_a_file << endl;
            exit(1);
        }
    }else if (!query_q_file.empty()){
	fin_a.open(query_q_file.c_str());
	param.fin_q = true;
	if (!fin_a)
	{
	    cerr << "failed to open file: "<< query_q_file << endl;
	    exit(1);
	}
    }
    else
    {
        cerr <<"missing query file(s)\n";
        exit(1);
    }
    cerr << "Read recruitment:\n";
    cerr << "Query: " << query_a_file << "  Reference: " << ref_file << endl;
    fout.open(out_align_file.c_str());
    if (!fout)
    {
        cerr << "failed to open file: " << out_align_file << endl;
        exit(1);
    }

    unsigned int n_aligned(0); // Number of reads recruited
    read_a.InitialIndex();
    n_aligned=Do_ReadAlign();
    fin_a.close();
    fout.close();
    cerr << "Total number of reads recruited: " << n_aligned << " (" << setprecision(2) << 100.0*n_aligned/read_a._index << "%)\n";
    cerr << "Done.\n";
    cerr << "Finished at " << Curr_Time();
    cerr << "Total time consumed:  " << Cal_AllTime() << " secs\n";
}
コード例 #2
0
ファイル: main.cpp プロジェクト: gigascience/bgi-soap1
void RunProcess(void)
{
	//pair-end alignment
	if((!query_a_file.empty()) && (!query_b_file.empty()))
	{
		cout<<"Pair-end alignment:\n";
		cout<<"Query: "<<query_a_file<<"  "<<query_b_file<<"  Reference: "<<ref_file<<"  Output: "<<out_align_file<<"  "<<out_align_file_unpair<<endl;
		fin_a.open(query_a_file.c_str());
		if(!fin_a) {
			cerr<<"failed to open file: "<<query_a_file<<endl;
			exit(1);
		}
		fin_b.open(query_b_file.c_str());
		if(!fin_b) {
			cerr<<"failed to open file: "<<query_b_file<<endl;
			exit(1);
		}		
		fout.open(out_align_file.c_str());
		if(!fout) {
			cerr<<"failed to open file: "<<out_align_file<<endl;
			exit(1);
		}
		fout_unpair.open(out_align_file_unpair.c_str());
		if(!fout_unpair) {
			cerr<<"failed to open file: "<<out_align_file_unpair<<endl;
			exit(1);
		}
		n_aligned_pairs=n_aligned_a=n_aligned_b=0;
		read_a.InitialIndex();
		read_b.InitialIndex();
		Do_PairAlign();
		fin_a.close();
		fin_b.close();
		fout.close();
		fout_unpair.close();
		cout<<"Total number of aligned reads: \n"
			<<"pairs:       "<<n_aligned_pairs<<" ("<<setprecision(2)<<100.0*n_aligned_pairs/read_a._index<<"%)\n"
			<<"single a:    "<<n_aligned_a<<" ("<<setprecision(2)<<100.0*n_aligned_a/read_a._index<<"%)\n"
			<<"single b:    "<<n_aligned_b<<" ("<<setprecision(2)<<100.0*n_aligned_b/read_b._index<<"%)\n";
	}	
	//single-read alignment
	else
	{
		if(!query_a_file.empty()) {
			fin_a.open(query_a_file.c_str());
			if(!fin_a) {
				cerr<<"b failed to open file: "<<query_a_file<<endl;
				exit(1);
			}
		}
		else
		{
			cerr<<"missing query file(s)\n";
			exit(1);
		}
		cout<<"Single read alignment:\n";
		cout<<"Query: "<<query_a_file<<"  Reference: "<<ref_file<<"  Output: "<<out_align_file<<endl;
		fout.open(out_align_file.c_str());
		if(!fout) {
			cerr<<"failed to open file: "<<out_align_file<<endl;
			exit(1);
		}
		n_aligned=0;
		read_a.InitialIndex();
		Do_SingleAlign();
		fin_a.close();
		fout.close();
		cout<<"Total number of aligned reads: "<<n_aligned<<" ("<<setprecision(2)
		<<100.0*n_aligned/read_a._index<<"%)\n";
	}

	cout<<"Done.\n";
	cout<<"Finished at "<<Curr_Time();
	cout<<"Total time consumed:  "<<Cal_AllTime()<<" secs\n";
};