Changeset 8281
- Timestamp:
- 07/12/11 18:46:05 (6 months ago)
- Location:
- branches/ptpan_back/ptpan
- Files:
-
- 6 modified
-
changelog.txt (modified) (2 diffs)
-
ptpan.cxx (modified) (1 diff)
-
ptpan.h (modified) (1 diff)
-
ptpan_tree.cxx (modified) (12 diffs)
-
ptpan_tree.h (modified) (2 diffs)
-
ptpan_tree_builder.cxx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/ptpan_back/ptpan/changelog.txt
r8179 r8281 1 1 PTPan ARB integration 2 2 3 v0.6. 6(?? ?? 2011)3 v0.6.7 (?? ?? 2011) 4 4 5 5 - TODO … … 23 23 - added method probeNongroupIncreaseArrayWidth() 24 24 - added custom information field in index header 25 - added convenience methods here and there 25 26 26 27 - major refactoring to make interface easier to use -
branches/ptpan_back/ptpan/ptpan.cxx
r8060 r8281 541 541 542 542 /*! 543 * \brief Return pointer list of all Features 544 * 545 * \return const std::vector<PTPanFeature*> 546 */ 547 const std::vector<PTPanFeature*> PTPanFeatureContainer::getAllFeatures() const { 548 if (m_normal_mode) { 549 return *m_features; 550 } 551 return std::vector<PTPanFeature*>(); 552 } 553 554 /*! 555 * \brief Return list of all Feature ids 556 * 557 * \return const std::vector<std::string> 558 */ 559 const std::vector<std::string> PTPanFeatureContainer::getAllFeatureIds() const { 560 if (m_normal_mode) { 561 std::vector<std::string> ret_values; 562 std::vector<PTPanFeature*>::const_iterator it; 563 for (it = m_features->begin(); it != m_features->end(); it++) { 564 ret_values.push_back((*it)->pf_name); 565 } 566 return ret_values; 567 } 568 return std::vector<std::string>(); 569 } 570 571 /*! 543 572 * \brief Returns the maximum byte size of this container for storing 544 573 * -
branches/ptpan_back/ptpan/ptpan.h
r8060 r8281 246 246 247 247 const PTPanFeature * getFeatureByNumber(ULONG number) const; 248 const std::vector<PTPanFeature*> getAllFeatures() const; 249 const std::vector<std::string> getAllFeatureIds() const; 248 250 249 251 ULONG byteSize() const; -
branches/ptpan_back/ptpan/ptpan_tree.cxx
r8179 r8281 500 500 * \brief Return PTPanReferenceEntry 501 501 * 502 * \warning Do not free! PtpanTree is still owner! This is nocopy!502 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 503 503 * 504 504 * May return NULL if not available! … … 525 525 * \brief Return pointer to first PTPanEntry in list 526 526 * 527 * \warning Do not free! PtpanTree is still owner! This is nocopy!527 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 528 528 * 529 529 * \return struct PTPanEntry* … … 539 539 * \brief Return PTPanEntry 540 540 * 541 * \warning Do not free! PtpanTree is still owner! This is nocopy!541 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 542 542 * 543 543 * May return NULL if not available! … … 551 551 552 552 /*! 553 * \brief Return PTPanEntry for given id 554 * 555 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 556 * 557 * May return NULL if not available! 558 */ 559 const PTPanEntry* PtpanTree::getEntry(const std::string& id) const { 560 561 if (m_contains_features) { 562 // split id at '/' and try to find the parts! 563 // TODO FIXME better take '#' as delimiter, split and take first and second value of vector! 564 std::size_t pos = id.find('/'); 565 if (pos != std::string::npos) { 566 std::string entry = id.substr(0, pos); 567 // NUMBER OF ENTRY: it->second - 1 568 PtpanEntryMap::const_iterator it = m_entry_map.find(entry.data()); 569 if (it != m_entry_map.end()) { 570 PTPanEntry* ptpan_entry = m_EntriesMap[(it->second) - 1]; 571 if (ptpan_entry) { 572 return ptpan_entry; 573 } 574 } 575 } else { 576 // no feature(s), but maybe whole genomes!! 577 PtpanEntryMap::const_iterator it = m_entry_map.find(id.data()); 578 if (it != m_entry_map.end()) { 579 PTPanEntry* ptpan_entry = m_EntriesMap[(it->second) - 1]; 580 if (ptpan_entry) { 581 return ptpan_entry; 582 } 583 } 584 } 585 } else { 586 PtpanEntryMap::const_iterator it = m_entry_map.find(id.data()); 587 if (it != m_entry_map.end()) { 588 PTPanEntry* ptpan_entry = m_EntriesMap[(it->second) - 1]; 589 if (ptpan_entry) { 590 return ptpan_entry; 591 } 592 } 593 } 594 return NULL; 595 } 596 597 /*! 553 598 * \brief Return full name of entry 554 599 * 555 * \warning Do not free! PtpanTree is still owner! This is nocopy!600 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 556 601 * 557 602 * May return NULL if not available! … … 567 612 * \brief Return (string) id of entry 568 613 * 569 * \warning Do not free! PtpanTree is still owner! This is nocopy!614 * \warning Do not free! PtpanTree is still owner! Does not return a copy! 570 615 * 571 616 * May return NULL if not available! … … 588 633 while (ps->pe_Node.ln_Succ) { 589 634 ret_values.push_back(ps->pe_Name); 635 ps = (struct PTPanEntry *) ps->pe_Node.ln_Succ; 636 } 637 return ret_values; 638 } 639 640 /*! 641 * \brief Returns all entries 642 * 643 * \return const std::vector<PTPanEntry*> 644 */ 645 const std::vector<PTPanEntry*> PtpanTree::getAllEntries() const { 646 std::vector<PTPanEntry*> ret_values; 647 struct PTPanEntry* ps = (struct PTPanEntry *) m_entries->lh_Head; 648 while (ps->pe_Node.ln_Succ) { 649 ret_values.push_back(ps); 590 650 ps = (struct PTPanEntry *) ps->pe_Node.ln_Succ; 591 651 } … … 841 901 UWORD seqcode = 0; 842 902 ULONG length_corr = 843 (length < best_pp->pp_TreePruneLength) ? 844 length :best_pp->pp_TreePruneLength;903 (length < best_pp->pp_TreePruneLength) ? length : 904 best_pp->pp_TreePruneLength; 845 905 846 906 ULONG buffer_size; … … 2848 2908 SearchQueryHandle& sqh) const { 2849 2909 LONG query_len = 2850 sq.sq_Query.size() > m_prune_length ? 2851 m_prune_length :(LONG) sq.sq_Query.size();2910 sq.sq_Query.size() > m_prune_length ? m_prune_length : 2911 (LONG) sq.sq_Query.size(); 2852 2912 LONG source_len = 2853 sqh.sqh_MaxLength > m_prune_length ? 2854 m_prune_length :(LONG) sqh.sqh_MaxLength;2913 sqh.sqh_MaxLength > m_prune_length ? m_prune_length : 2914 (LONG) sqh.sqh_MaxLength; 2855 2915 2856 2916 LONG max_check = 2857 sq.sq_Query.size() < m_prune_length ? 2858 m_prune_length - sq.sq_Query.size() : 0; 2917 sq.sq_Query.size() < m_prune_length ? m_prune_length 2918 - sq.sq_Query.size() : 2919 0; 2859 2920 if (max_check > sq.sq_MaxErrors) { 2860 2921 max_check = (LONG) sq.sq_MaxErrors; … … 3188 3249 // find the match with the lowest error count in range 3189 3250 // range = query length +- number of allowed indels 3190 for (ULONG l = 1; l <= levenshtein.m_max_check; l++) { 3191 if (levenshtein.m_distance_matrix[levenshtein.m_query_len 3192 + l][levenshtein.m_query_len] 3193 < sqh.sqh_State.sqs_ErrorCount && levenshtein.m_direction_matrix[levenshtein.m_query_len 3194 + l][levenshtein.m_query_len] 3195 == LEV_EQ) { // TODO FIXME why LEV_EQ?? 3196 sqh .sqh_State.sqs_ErrorCount = 3197 levenshtein.m_distance_matrix[levenshtein.m_query_len 3198 + l][levenshtein.m_query_len]; 3199 length = levenshtein.m_query_len + l; 3251 if (sq.sq_AllowInsert) { 3252 for (ULONG l = 1; l <= levenshtein.m_max_check; 3253 l++) { 3254 if (levenshtein.m_distance_matrix[levenshtein.m_query_len 3255 + l][levenshtein.m_query_len] 3256 < sqh.sqh_State.sqs_ErrorCount && levenshtein.m_direction_matrix[levenshtein.m_query_len 3257 + l][levenshtein.m_query_len] 3258 == LEV_EQ) { // TODO FIXME why LEV_EQ?? 3259 sqh .sqh_State.sqs_ErrorCount = 3260 levenshtein.m_distance_matrix[levenshtein.m_query_len 3261 + l][levenshtein.m_query_len]; 3262 length = levenshtein.m_query_len + l; 3263 } 3200 3264 } 3201 3265 } 3266 3202 3267 for (int l = 1; l <= (int) sq.sq_MaxErrors; l++) { 3203 3268 if (levenshtein.m_distance_matrix[levenshtein.m_query_len … … 3683 3748 qh->qh_sortKey = 3684 3749 (LLONG) ( 3685 (qh->qh_Flags & QHF_REVERSED) ? 3686 (1LL << 62) : 0LL) 3687 + ((qh->qh_InsertCount | qh->qh_DeleteCount) ? 3688 (1LL << 61) : 0LL) 3750 (qh->qh_Flags & QHF_REVERSED) ? (1LL << 62) : 3751 0LL) 3752 + ((qh->qh_InsertCount | qh->qh_DeleteCount) ? (1LL 3753 << 61) : 3754 0LL) 3689 3755 + (((LLONG) (qh->qh_ReplaceCount 3690 3756 + qh->qh_InsertCount … … 3714 3780 qh->qh_sortKey = 3715 3781 (LLONG) ( 3716 (LLONG) (qh->qh_Flags & QHF_REVERSED) ? 3717 (1LL << 62) : 0LL) 3782 (LLONG) (qh->qh_Flags & QHF_REVERSED) ? (1LL 3783 << 62) : 3784 0LL) 3718 3785 + ((LLONG) (qh->qh_InsertCount 3719 | qh->qh_DeleteCount) ? 3720 (1LL << 61) :0LL)3786 | qh->qh_DeleteCount) ? (1LL << 61) : 3787 0LL) 3721 3788 + (((LLONG) round(qh->qh_ErrorCount * 10.0)) 3722 3789 << 56) … … 3967 4034 UWORD seqcode = m_as->wildcard_code + 1; 3968 4035 ULONG length = 3969 (dq.dq_ProbeLength < pp->pp_TreePruneLength) ? 3970 dq.dq_ProbeLength :pp->pp_TreePruneLength;4036 (dq.dq_ProbeLength < pp->pp_TreePruneLength) ? dq.dq_ProbeLength : 4037 pp->pp_TreePruneLength; 3971 4038 double currtemp = 0.0; 3972 4039 UWORD currgc = 0; -
branches/ptpan_back/ptpan/ptpan_tree.h
r8186 r8281 318 318 */ 319 319 static const std::string version() { 320 return "0.6. 6_beta";320 return "0.6.7_beta"; 321 321 } 322 322 … … 333 333 const PTPanEntry* getFirstEntry() const; 334 334 const PTPanEntry* getEntry(ULONG id) const; 335 const PTPanEntry* getEntry(const std::string& id) const; 335 336 CONST_STRPTR getEntryFullName(ULONG id) const; 336 337 CONST_STRPTR getEntryId(ULONG id) const; 337 338 338 339 const std::vector<std::string> getAllEntryIds() const; 340 const std::vector<PTPanEntry*> getAllEntries() const; 339 341 340 342 ULONG getPruneLength() const; -
branches/ptpan_back/ptpan/ptpan_tree_builder.cxx
r8214 r8281 1000 1000 mergeEntry(); 1001 1001 m_threadpool->wait(); 1002 m_threadpool->clear();1003 1002 } 1004 1003
