void AlignementGet::run() { try { if(Alignement_init) { if( (Alignement_identity->at(Alignement_hit_b->id())).first == -1) { FastaThread seqa(*Alignement_fasta_a, *Alignement_hit_a); FastaThread seqb(*Alignement_fasta_b, *Alignement_hit_b); Alignement_first_seq = seqa.find(); Alignement_second_seq = seqb.find(); pair<long int, long int> identity = compute_identity(false); if((Alignement_first_seq->length() - identity.second) > 0) { if( (identity.first/(Alignement_first_seq->length() - identity.second)) >= 0.5) { delete Alignement_first_seq; delete Alignement_second_seq; Alignement_first_seq = seqa.find(); Alignement_second_seq = seqb.find(); Alignement_identity->at(Alignement_hit_b->id()) = compute_identity(true); } if( (Alignement_identity->at(Alignement_hit_b->id())).first > identity.first || (Alignement_identity->at(Alignement_hit_b->id())).first == -1) { Alignement_identity->at(Alignement_hit_b->id()) = identity; } } delete Alignement_first_seq; delete Alignement_second_seq; } } } catch(exception const& e) { cerr << "ERROR : " << e.what() << " in : void AlignementGet::run()" << endl; exit(-1); } }
RcppExport SEXP rthxpos(SEXP m) { Rcpp::NumericMatrix tmpm = Rcpp::NumericMatrix(m); int nr = tmpm.nrow(); int nc = tmpm.ncol(); thrust::device_vector<double> dmat(tmpm.begin(),tmpm.end()); // make space for the transpose thrust::device_vector<double> dxp(nr*nc); // iterator to march through the matrix elements thrust::counting_iterator<int> seqb(0); thrust::counting_iterator<int> seqe = seqb + nr*nc; // for each i in seq, copy the matrix elt to its spot in the // transpose thrust::for_each(seqb,seqe, copyelt2xp(dmat.begin(),dxp.begin(),nr,nc)); // prepare the R output, and return it Rcpp::NumericVector routmat(nc*nr); thrust::copy(dxp.begin(),dxp.end(),routmat.begin()); return routmat; }