void *t_PairAlign(void *) { PairAlign a; int n1, n2; bit32_t cur_at; a.ImportFileFormat(read_a._file_format, read_b._file_format); while(1) { pthread_mutex_lock(&mutex_fin); n1=read_a.LoadBatchReads(fin_a); n2=read_b.LoadBatchReads(fin_b); cur_at=read_a._index; a.ImportBatchReads(n1, read_a.mreads, read_b.mreads); pthread_mutex_unlock(&mutex_fin); if(!n1||(n1!=n2)) break; a.Do_Batch(ref); pthread_mutex_lock(&mutex_fout); fout<<a._str_align; fout_unpair<<a._str_align_unpair; cout<<cur_at<<" reads finished. "<<Cal_AllTime()<<" secs passed"<<endl; pthread_mutex_unlock(&mutex_fout); } pthread_mutex_lock(&mutex_fout); n_aligned_pairs+=a.n_aligned_pairs; n_aligned_a+=a.n_aligned_a; n_aligned_b+=a.n_aligned_b; pthread_mutex_unlock(&mutex_fout); };
void *t_SingleAlign(void *) { SingleAlign a; int n; bit32_t cur_at; a.ImportFileFormat(read_a._file_format); a.SetFlag('a'); while(1) { pthread_mutex_lock(&mutex_fin); n=read_a.LoadBatchReads(fin_a); cur_at=read_a._index; a.ImportBatchReads(read_a.num, read_a.mreads); pthread_mutex_unlock(&mutex_fin); if(!n) break; a.Do_Batch(ref); pthread_mutex_lock(&mutex_fout); fout<<a._str_align; cout<<cur_at<<" reads finished. "<<Cal_AllTime()<<" secs passed"<<endl; pthread_mutex_unlock(&mutex_fout); } pthread_mutex_lock(&mutex_fout); n_aligned+=a.n_aligned; pthread_mutex_unlock(&mutex_fout); };
void Do_PairAlign() { if(param.max_snp_num>0) param.max_snp_num=2; read_a.CheckFile(fin_a); read_b.CheckFile(fin_b); PairAlign a; int n1, n2; while(1) { n1=read_a.LoadBatchReads(fin_a); n2=read_b.LoadBatchReads(fin_b); if(!n1||(n1!=n2)) break; a.ImportBatchReads(n1, read_a.mreads, read_b.mreads); a.Do_Batch(ref); fout<<a._str_align; fout_unpair<<a._str_align_unpair; cout<<read_a._index<<" reads finished. "<<Cal_AllTime()<<" secs passed"<<endl; } n_aligned_pairs=a.n_aligned_pairs; n_aligned_a=a.n_aligned_a; n_aligned_b=a.n_aligned_b; };
void Do_SingleAlign() { read_a.CheckFile(fin_a); SingleAlign a; a.ImportFileFormat(read_a._file_format); a.SetFlag('a'); while(read_a.LoadBatchReads(fin_a)) { a.ImportBatchReads(read_a.num, read_a.mreads); a.Do_Batch(ref); fout<<a._str_align; cout<<read_a._index<<" reads finished. "<<Cal_AllTime()<<" secs passed"<<endl; } n_aligned=a.n_aligned; };