Changeset 8282
- Timestamp:
- 08/12/11 11:31:56 (6 months ago)
- Location:
- branches/ptpan_back/ptpan
- Files:
-
- 4 modified
-
ptpan.h (modified) (1 diff)
-
ptpan_legacy.cxx (modified) (3 diffs)
-
ptpan_tree.cxx (modified) (8 diffs)
-
ptpan_tree.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/ptpan_back/ptpan/ptpan.h
r8281 r8282 463 463 std::string sq_Query; /* query string */ 464 464 465 bool sq_Reversed; /* query is reversed*/465 bool sq_Reversed; /* check reversed complement as well */ 466 466 bool sq_AllowReplace; /* allow replace operations */ 467 467 bool sq_AllowInsert; /* allow inserting operations */ -
branches/ptpan_back/ptpan/ptpan_legacy.cxx
r8060 r8282 381 381 #endif 382 382 gettimeofday(&tsNow, NULL); 383 printf("... done in %li seconds.\n", 384 (tsNow.tv_sec - tsStart.tv_sec)); 383 printf("... done in %li seconds.\n", (tsNow.tv_sec - tsStart.tv_sec)); 385 384 #ifndef DEBUG 386 385 } … … 1181 1180 sq.sq_Query = std::string(locs->pm_sequence); 1182 1181 sq.sq_MaxErrors = (float) locs->pm_max; 1183 sq.sq_Reversed = false; 1182 if (locs->pm_reversed) { 1183 // include reversed-complement search as well 1184 sq.sq_Reversed = true; 1185 } else { 1186 sq.sq_Reversed = false; 1187 } 1184 1188 if (sq.sq_MaxErrors > 0) { 1185 1189 sq.sq_AllowReplace = true; // N-mismatches are listed anyways! … … 1201 1205 ULONG done = create_match_list(sq, results, locs->pm_max_hits); 1202 1206 1203 if (locs->pm_reversed) { 1204 SearchQuery compsq = sq; 1205 compsq.sq_Reversed = true; 1206 results = pl->pl_pt->searchTree(compsq, true, true); 1207 done = create_match_list(compsq, results, locs->pm_max_hits - done); 1208 } 1207 #ifdef DEBUG 1208 if (done) { 1209 printf("done with search!\n"); 1210 } 1211 #endif 1209 1212 1210 1213 // Just to be secure, we clear the PDC structure -
branches/ptpan_back/ptpan/ptpan_tree.cxx
r8281 r8282 687 687 if (!sq.sq_Query.empty()) { 688 688 SearchQuery internal_sq = sq; 689 bool reversed_too = internal_sq.sq_Reversed; 689 690 if (internal_sq.sq_MaxErrors == 0.0) { 690 691 internal_sq.sq_AllowInsert = false; … … 692 693 internal_sq.sq_AllowReplace = false; 693 694 } 695 internal_sq.sq_Reversed = false; 694 696 SearchQueryHandle sqh = SearchQueryHandle(internal_sq); 695 697 … … 735 737 } 736 738 } 739 740 if (reversed_too) { 741 STRPTR query_str = const_cast<char *>(internal_sq.sq_Query.c_str()); 742 m_as->complementSequence(query_str); 743 m_as->reverseSequence(query_str); 744 internal_sq.sq_Reversed = true; 745 746 SearchQueryHandle sqh_rev = SearchQueryHandle(internal_sq); 747 #ifdef DEBUG 748 printf("check reverse complement as well (%s)\n", 749 internal_sq.sq_Query.c_str()); 750 #endif 751 // TODO FIXME double code is bad, but there is no time left :-( 752 std::vector<PTPanPartition *>::const_iterator pit; 753 for (pit = m_partitions.begin(); pit != m_partitions.end(); pit++) { 754 search_partition(*pit, internal_sq, sqh_rev); 755 } 756 post_filter_query_hits(sq, sqh_rev); 757 758 #ifdef DEBUG 759 printf("after all partitions rev-compl count %lu\n", 760 sqh_rev.sqh_hits.size()); 761 #endif 762 if (m_prune_length < sqh_rev.sqh_MaxLength) { 763 #ifdef DEBUG 764 printf("may contain UNSAFE! %lu\n", sqh_rev.sqh_MaxLength); 765 #endif 766 validate_unsafe_hits(internal_sq, sqh_rev); 767 } 768 if (build_diff) { 769 if (!sqh_rev.sqh_hits.empty()) { 770 #ifdef DEBUG 771 printf(">> CreateDiffAlignment for %lu hits\n", 772 sqh_rev.sqh_hits.size()); 773 #endif 774 if (sqh_rev.sqh_hits.size() < m_num_threads 775 || m_num_threads <= 1) { 776 create_diff_alignment(internal_sq, sqh_rev); 777 } else { 778 std::size_t i = 0; 779 ULONG participators = m_num_threads; 780 for (; i < participators - 1; i++) { 781 boost::threadpool::schedule( 782 *m_threadpool, 783 boost::bind( 784 &PtpanTree::create_diff_alignment, 785 this, boost::ref(internal_sq), 786 boost::ref(sqh_rev), i, 787 participators)); 788 } 789 create_diff_alignment(internal_sq, sqh_rev, i, 790 participators); // main thread can do some work as well! 791 m_threadpool->wait(); 792 } 793 } 794 } 795 // we want to transfer control over results to sqh 796 // before we sort and return results 797 sqh.sqh_hits.transfer(sqh.sqh_hits.end(), sqh_rev.sqh_hits); 798 } 799 737 800 if (sort) { 738 801 sort_hits_list(internal_sq, sqh); … … 901 964 UWORD seqcode = 0; 902 965 ULONG length_corr = 903 (length < best_pp->pp_TreePruneLength) ? length :904 best_pp->pp_TreePruneLength;966 (length < best_pp->pp_TreePruneLength) ? 967 length : best_pp->pp_TreePruneLength; 905 968 906 969 ULONG buffer_size; … … 2908 2971 SearchQueryHandle& sqh) const { 2909 2972 LONG query_len = 2910 sq.sq_Query.size() > m_prune_length ? m_prune_length :2911 (LONG) sq.sq_Query.size();2973 sq.sq_Query.size() > m_prune_length ? 2974 m_prune_length : (LONG) sq.sq_Query.size(); 2912 2975 LONG source_len = 2913 sqh.sqh_MaxLength > m_prune_length ? m_prune_length :2914 (LONG) sqh.sqh_MaxLength;2976 sqh.sqh_MaxLength > m_prune_length ? 2977 m_prune_length : (LONG) sqh.sqh_MaxLength; 2915 2978 2916 2979 LONG max_check = 2917 sq.sq_Query.size() < m_prune_length ? m_prune_length 2918 - sq.sq_Query.size() : 2919 0; 2980 sq.sq_Query.size() < m_prune_length ? 2981 m_prune_length - sq.sq_Query.size() : 0; 2920 2982 if (max_check > sq.sq_MaxErrors) { 2921 2983 max_check = (LONG) sq.sq_MaxErrors; … … 3748 3810 qh->qh_sortKey = 3749 3811 (LLONG) ( 3750 (qh->qh_Flags & QHF_REVERSED) ? (1LL << 62) : 3751 0LL) 3752 + ((qh->qh_InsertCount | qh->qh_DeleteCount) ? (1LL 3753 << 61) : 3754 0LL) 3812 (qh->qh_Flags & QHF_REVERSED) ? 3813 (1LL << 62) : 0LL) 3814 + ((qh->qh_InsertCount | qh->qh_DeleteCount) ? 3815 (1LL << 61) : 0LL) 3755 3816 + (((LLONG) (qh->qh_ReplaceCount 3756 3817 + qh->qh_InsertCount … … 3780 3841 qh->qh_sortKey = 3781 3842 (LLONG) ( 3782 (LLONG) (qh->qh_Flags & QHF_REVERSED) ? (1LL 3783 << 62) : 3784 0LL) 3843 (LLONG) (qh->qh_Flags & QHF_REVERSED) ? 3844 (1LL << 62) : 0LL) 3785 3845 + ((LLONG) (qh->qh_InsertCount 3786 | qh->qh_DeleteCount) ? (1LL << 61) :3787 0LL)3846 | qh->qh_DeleteCount) ? 3847 (1LL << 61) : 0LL) 3788 3848 + (((LLONG) round(qh->qh_ErrorCount * 10.0)) 3789 3849 << 56) … … 4034 4094 UWORD seqcode = m_as->wildcard_code + 1; 4035 4095 ULONG length = 4036 (dq.dq_ProbeLength < pp->pp_TreePruneLength) ? dq.dq_ProbeLength :4037 pp->pp_TreePruneLength;4096 (dq.dq_ProbeLength < pp->pp_TreePruneLength) ? 4097 dq.dq_ProbeLength : pp->pp_TreePruneLength; 4038 4098 double currtemp = 0.0; 4039 4099 UWORD currgc = 0; -
branches/ptpan_back/ptpan/ptpan_tree.h
r8281 r8282 136 136 } 137 137 sqh_hits.clear(); 138 } 139 140 void clearHitsHash() { 141 if (sqh_HitsHash) { 142 sqh_HitsHash->clear(); 143 } 138 144 } 139 145
