⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seq_id.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
    int WorstRankScore(void) const        { return AdjustScore(BaseWorstRankScore()); }    // Wrappers for use with FindBestChoice from <corelib/ncbiutil.hpp>    static int Score(const CRef<CSeq_id>& id)        { return id ? id->TextScore() : kMax_Int; }    static int BestRank(const CRef<CSeq_id>& id)        { return id ? id->BestRankScore() : kMax_Int; }    static int WorstRank(const CRef<CSeq_id>& id)        { return id ? id->WorstRankScore() : kMax_Int; }    virtual void Assign(const CSerialObject& source,                        ESerialRecursionMode how = eRecursive);    virtual bool Equals(const CSerialObject& object,                        ESerialRecursionMode how = eRecursive) const;private:    void x_Init    (CSeq_id_Base::E_Choice the_type,     // Just first string, as in text seqid, for unusual     // cases (patents, pdb) not really an acc     const string&          acc_in,     const string&          name_in    = kEmptyStr,     int                    version    = 0,     const string&          release_in = kEmptyStr);    // Prohibit copy constructor & assignment operator    CSeq_id(const CSeq_id&);    CSeq_id& operator= (const CSeq_id&);    //CRef<CAbstractObjectManager> m_ObjectManager;};// Search the container of CRef<CSeq_id> for the id of given type.// Return the id of requested type, or null CRef.template<class container>CRef<CSeq_id> GetSeq_idByType(const container& ids,                                    CSeq_id::E_Choice choice){    ITERATE (typename container, iter, ids) {        if ((*iter)->Which() == choice){            return *iter;        }    }    return CRef<CSeq_id>(0);}//return gi from id list if exists, return 0 otherwisetemplate<class container>int FindGi(const container& ids){    CRef<CSeq_id> id = GetSeq_idByType(ids, CSeq_id::e_Gi);    return id ? id->GetGi() : 0;}//return text seq-id from id list if exists, return 0 otherwisetemplate<class container>CRef<CSeq_id> FindTextseq_id(const container& ids){    ITERATE (typename container, iter, ids) {        if ( (*iter)->GetTextseq_Id() ) {            return *iter;        }    }    return CRef<CSeq_id>(0);}/////////////////// CSeq_id inline methods// Match - just uses Compareinlinebool CSeq_id::Match (const CSeq_id& sid2) const{    return Compare(sid2) == e_YES;}inlineint CSeq_id::AdjustScore(int base_score) const{    int score = base_score * 10;    const CTextseq_id* text_id = GetTextseq_Id();    if (text_id) {        if ( !text_id->IsSetVersion() ) {            score += 4;        }        if ( !text_id->IsSetAccession() ) {            score += 3;        }        if ( !text_id->IsSetName() ) {            score += 2;        }    }    return score;}inlineint CSeq_id::BaseTextScore(void) const{    switch (Which()) {    case e_not_set:                                return kMax_Int;    case e_Giim:    case e_Gi:                     return 20;    case e_General: case e_Gibbsq: case e_Gibbmt:  return 15;    case e_Local:   case e_Patent:                 return 10;    case e_Other:                                  return 8;    default:                                       return 5;    }}inlineint CSeq_id::BaseBestRankScore(void) const{    switch (Which()) {    case e_not_set:                               return 83;    case e_General: case e_Local:                 return 80;    case e_Gibbsq: case e_Gibbmt: case e_Giim:    return 70;    case e_Patent:                                return 67;    case e_Other:                                 return 65;    case e_Ddbj: case e_Prf: case e_Pdb:    case e_Tpe:  case e_Tpd: case e_Embl:    case e_Pir:  case e_Swissprot:    case e_Tpg:  case e_Genbank:                  return 60;    case e_Gi:                                    return 51;    default:                                      return 5;    }}inlineint CSeq_id::BaseWorstRankScore(void) const{    switch (Which()) {    case e_not_set:                               return 83;    case e_Gi: case e_Giim:                       return 20;    case e_General: case e_Gibbsq: case e_Gibbmt: return 15;    case e_Local: case e_Patent:                  return 10;    case e_Other:                                 return 8;    case e_Ddbj: case e_Prf: case e_Pdb:    case e_Tpe:  case e_Tpd: case e_Embl:    case e_Pir:  case e_Swissprot:    case e_Tpg:  case e_Genbank:                  return 5;    default:                                      return 3;    }}/////////////////// end of CSeq_id inline methodsEND_objects_SCOPE // namespace ncbi::objects::END_NCBI_SCOPE/* * =========================================================================== * * $Log: Seq_id.hpp,v $ * Revision 1000.2  2004/06/01 19:30:49  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.47 * * Revision 1.47  2004/05/11 14:34:12  ucko * Factored out and refined Textseq-id bonus calculation. * * Revision 1.46  2004/04/28 14:13:17  grichenk * Added FindTextseq_id() * * Revision 1.45  2004/04/19 18:20:16  grichenk * Added GetSeq_idByType() and FindGi() * * Revision 1.44  2004/04/01 16:36:34  ucko * Make the scoring functions wrappers around const methods (with slightly * different names to avoid ambiguity when passing CSeq_id::Score et al. to * FindBestChoice) and add a more verbose comment.  Also, WorstRank, * despite being "Worst," should still favor versioned accessions. * * Revision 1.43  2004/03/30 20:46:08  ucko * BestRank: demote gibb* and patent to 70 and 67 respectively per the C Toolkit. * * Revision 1.42  2004/03/25 15:58:41  gouriano * Added possibility to copy and compare serial object non-recursively * * Revision 1.41  2004/03/01 18:26:04  dicuccio * Modified CSeq_id::Score(), CSeq_id::BestRank(), and CSeq_id::WorstRank to * consider an accession's version if present. * * Revision 1.40  2004/01/22 21:03:58  dicuccio * Separated functionality of enums in GetLabel() into discrete mode and flags * * Revision 1.39  2004/01/22 18:45:45  dicuccio * Added new API: CSeq_id::GetLabel().  Rewired GetSeqIdString() to feed into * GetLabel().  Rewired GetStringDescr() to feed into GetLabel() directly instead * of feeding through GetSeqIdString(). * * Revision 1.38  2004/01/21 18:04:20  dicuccio * Added ctor to create a seq-id from a given dbtag, performing conversion to * specific seq-id types where possible * * Revision 1.37  2004/01/16 22:11:15  ucko * Update for new CSerializable interface. * * Revision 1.36  2004/01/09 19:54:13  ucko * Give EXAMPLE prefixes to ease migration from hardcoded checks. * * Revision 1.35  2003/10/24 14:55:10  ucko * Merged eAcc_con and eAcc_segset (had been mistakenly separated); * renamed eAcc_gb_segset to eAcc_gb_con, but left the old name as a synoynm. * * Revision 1.34  2003/02/06 22:23:29  vasilche * Added CSeq_id::Assign(), CSeq_loc::Assign(). * Added int CSeq_id::Compare() (not safe). * Added caching of CSeq_loc::GetTotalRange(). * * Revision 1.33  2003/02/04 15:15:11  grichenk * Overrided Assign() for CSeq_loc and CSeq_id * * Revision 1.32  2003/01/18 08:40:04  kimelman * addes seqid constructor for numeric types * * Revision 1.31  2003/01/07 19:52:07  ucko * Add more refseq types (NR_, NS_, NW_) and list the prefixes as comments. * * Revision 1.30  2002/12/26 16:39:22  vasilche * Object manager class CSeqMap rewritten. * * Revision 1.29  2002/12/26 12:43:42  dicuccio * Added Win32 export specifiers * * Revision 1.28  2002/11/26 15:12:15  dicuccio * Added general processing function to retrieve sequence id descriptions in a * number of formats. * * Revision 1.27  2002/10/23 18:22:57  ucko * Add self-classification (using known type information) and expand * EAccessionInfo accordingly. * * Revision 1.26  2002/10/22 20:18:30  jianye * Added GetSeqIdString() * * Revision 1.25  2002/10/03 18:51:11  clausen * Removed extra whitespace * * Revision 1.24  2002/10/03 17:06:13  clausen * Added BestRank() and WorstRank() * * Revision 1.23  2002/08/22 21:25:26  ucko * Added a standard score function for FindBestChoice corresponding to * the table in SeqIdFindWorst. * * Revision 1.22  2002/08/16 19:25:14  ucko * +eAcc_refseq_wgs_* * * Revision 1.21  2002/08/14 15:52:05  ucko * Add eAcc_refseq_ncrna(_predicted) [non-coding RNA, XR_]. * * Revision 1.20  2002/08/01 20:32:52  ucko * s_IdentifyAccession -> IdentifyAccession; s_ is only for module-static names. * * Revision 1.19  2002/07/30 19:41:33  ucko * Add s_IdentifyAccession (along with EAccessionInfo and GetAccType). * Move CVS log to end. * * Revision 1.18  2002/06/07 11:16:57  clausen * Fixed comments * * Revision 1.17  2002/06/07 11:13:01  clausen * Added comment about util/sequence.hpp * * Revision 1.16  2002/06/06 20:32:01  clausen * Moved methods using object manager to objects/util * * Revision 1.15  2002/05/22 14:03:34  grichenk * CSerialUserOp -- added prefix UserOp_ to Assign() and Equals() * * Revision 1.14  2002/05/03 21:28:04  ucko * Introduce T(Signed)SeqPos. * * Revision 1.13  2002/01/10 18:43:34  clausen * Added GetLength * * Revision 1.12  2001/08/31 15:59:59  clausen * Added new constructors for FastA construction and added tpg, tpd, and tpe id types * * Revision 1.11  2001/07/25 19:11:09  grichenk * Equals() and Assign() re-declared as protected * * Revision 1.10  2001/07/16 16:22:44  grichenk * Added CSerialUserOp class to create Assign() and Equals() methods for * user-defind classes. * Added SerialAssign<>() and SerialEquals<>() functions. * * Revision 1.9  2001/06/25 18:52:01  grichenk * Prohibited copy constructor and assignment operator * * Revision 1.8  2001/04/17 04:13:03  vakatov * Utilize the redesigned "CSerializable" base class. * Completely get rid of the non-standard "AsFastaString()" method in * favor of more standard "DumpAsFasta()" one. * * Revision 1.7  2001/04/16 16:55:19  kholodov * Modified: Added implementation for the ISerializable interface. * * Revision 1.6  2001/01/03 16:38:53  vasilche * Added CAbstractObjectManager - stub for object manager. * CRange extracted to separate file. * * Revision 1.5  2000/12/26 17:28:34  vasilche * Simplified and formatted code. * * Revision 1.4  2000/12/08 22:18:41  ostell * changed MakeFastString to AsFastaString and to use ostream instead of string * * Revision 1.3  2000/12/08 20:45:56  ostell * added MakeFastaString() * * Revision 1.2  2000/11/27 20:36:39  vasilche * Enum should be defined in public area. * * Revision 1.1  2000/11/21 18:58:12  vasilche * Added Match() methods for CSeq_id, CObject_id and CDbtag. * * =========================================================================== */#endif // OBJECTS_SEQLOC_SEQ_ID_HPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -