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

📄 seq_id.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    case CSeq_id::e_Gibbmt:        if ( (the_id =NStr::StringToNumeric (acc)) >= 0 ) {            SetGibbmt(the_id);        } else {             s_InitThrow("Unexpected non-numeric accession.",                         string(s_TextId[the_type]), acc_in, name_in,                         NStr::IntToString(version), release_in);        }        break;    case CSeq_id::e_Giim:        {            CGiimport_id &  giim = SetGiim();            if ( (the_id =NStr::StringToNumeric (acc)) >= 0 ) {                giim.SetId(the_id);            } else {                s_InitThrow("Unexpected non-numeric accession.",                            string(s_TextId[the_type]), acc_in, name_in,                            NStr::IntToString(version), release_in);            }            break;        }    case CSeq_id::e_Genbank:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release);            SetGenbank(*text );            break;        }    case CSeq_id::e_Embl:        {            CTextseq_id* text               = new CTextseq_id(acc, name, version, release);            SetEmbl(*text);            break;        }    case CSeq_id::e_Pir:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release, false);            SetPir(*text);            break;        }    case CSeq_id::e_Swissprot:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release, false);            SetSwissprot(*text);            break;        }    case CSeq_id::e_Tpg:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release);            SetTpg(*text);            break;        }    case CSeq_id::e_Tpe:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release);            SetTpe(*text);            break;        }    case CSeq_id::e_Tpd:        {            CTextseq_id* text                = new CTextseq_id(acc, name, version, release);            SetTpd(*text);            break;        }    case CSeq_id::e_Patent:        {            CPatent_seq_id&  pat    = SetPatent();            CId_pat&         id_pat = pat.SetCit();            CId_pat::C_Id&   id_pat_id = id_pat.SetId();            id_pat.SetCountry(acc);            const char      app_str[] = "App=";            const SIZE_TYPE app_str_len = sizeof(app_str) - 1;            if (name.substr(0, app_str_len) == app_str) {                id_pat_id.SetApp_number(name.substr(app_str_len));            } else {                id_pat_id.SetNumber(name);            }            pat.SetSeqid(version);            break;        }    case CSeq_id::e_Other: // RefSeq, allow dot version        {            CTextseq_id* text                = new CTextseq_id(acc,name,version,release);            SetOther(*text);            break;        }    case CSeq_id::e_General:        {            CDbtag& dbt = SetGeneral();            dbt.SetDb(acc);            CObject_id& oid = dbt.SetTag();            the_id = NStr::StringToNumeric(name);            if (the_id >= 0  &&  (name.size() == 1 || name[0] != '0')) {                oid.SetId(the_id);            }else{                oid.SetStr(name);            }            break;        }    case CSeq_id::e_Gi:        the_id = NStr::StringToNumeric(acc);        if (the_id >= 0 ) {            SetGi(the_id);        } else {             s_InitThrow("Unexpected non-numeric accession.",                         string(s_TextId[the_type]), acc_in, name_in,                         NStr::IntToString(version), release_in);        }        break;    case CSeq_id::e_Ddbj:        {            CTextseq_id* text                = new CTextseq_id(acc,name,version,release);            SetDdbj(*text);            break;        }    case CSeq_id::e_Prf:        {            CTextseq_id* text                = new CTextseq_id(acc,name,version,release,false);            SetPrf(*text);            break;        }    case CSeq_id::e_Pdb:        {            CPDB_seq_id& pdb     = SetPdb();            CPDB_mol_id& pdb_mol = pdb.SetMol();            pdb_mol.Set(acc);            if (name.empty()) {                pdb.SetChain(' ');            } else if (name.size() == 1) {                pdb.SetChain(static_cast<unsigned char> (name[0]));            } else if ( name.compare("VB") == 0) {                pdb.SetChain('|');            } else if (name.size() == 2  &&  name[0] ==  name[1]) {                pdb.SetChain( Locase(static_cast<unsigned char> (name[0])) );            } else {                s_InitThrow("Unexpected PDB chain id.",                            string(s_TextId[the_type]), acc_in, name_in,                            NStr::IntToString(version), release_in);            }            break;        }    default:        THROW1_TRACE(invalid_argument, "Specified Seq-id type not supported");    }}bool CSeq_id::Equals(const CSerialObject& object, ESerialRecursionMode how) const{    if ( typeid(object) != typeid(*this) ) {        ERR_POST(Fatal <<            "CSeq_id::Assign() -- Assignment of incompatible types: " <<            typeid(*this).name() << " = " << typeid(object).name());    }    return CSerialObject::Equals(object, how);}END_objects_SCOPE // namespace ncbi::objects::END_NCBI_SCOPE/* * =========================================================================== * * $Log: Seq_id.cpp,v $ * Revision 1000.4  2004/06/01 19:34:28  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R6.81 * * Revision 6.81  2004/06/01 15:26:07  johnson * Make CompareOrdered a true model of strict weak ordering * * Revision 6.80  2004/05/28 20:09:44  johnson * Added Compare for seq-id type General (CDbtag) * * Revision 6.79  2004/05/21 14:41:46  dicuccio * Moved database tag for general IDs to content part of label * * Revision 6.78  2004/05/19 17:26:25  gorelenk * Added include of PCH - ncbi_pch.hpp * * Revision 6.77  2004/05/16 16:57:44  dicuccio * Removed insertion of db type in general seq-id labels of type content - led to * duplicates of type * * Revision 6.76  2004/05/14 14:34:02  dicuccio * Include database name in label content if the db-tag is just an integer * * Revision 6.75  2004/03/25 15:59:06  gouriano * Added possibility to copy and compare serial object non-recursively * * Revision 6.74  2004/03/22 16:24:19  ucko * CN is now specifically assigned to GenBank ESTs. * * Revision 6.73  2004/01/22 21:03:58  dicuccio * Separated functionality of enums in GetLabel() into discrete mode and flags * * Revision 6.72  2004/01/22 18:45:46  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 6.71  2004/01/21 22:55:47  ucko * GetSeqIdString: drop the database name from general IDs for * compatibility with code that can't handle its presence. * * Revision 6.70  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 6.69  2004/01/20 16:59:38  ucko * CSeq_id::IdentifyAccession: identify IDs consisting solely of digits as GIs. * * Revision 6.68  2004/01/16 17:39:17  vasilche * Fixed parsing 'gnl|xxx|999' format - integer tag detection. * * Revision 6.67  2004/01/16 15:58:19  ucko * CM now specifically assigned to eAcc_gb_con. * * Revision 6.66  2003/12/18 18:55:59  ucko * CSeq_id::IdentifyAccession: CQ is EMBL patents, CR is EMBL genomes, * CS-CU are reserved for future EMBL nucleotide use. * * Revision 6.65  2003/12/16 16:00:16  ucko * CSeq_id::IdentifyAccession: CL is GenBank GSS, CM-CP are GenBank * nucleotides to be assigned to specific projects as needed. * * Revision 6.64  2003/11/10 15:05:42  ucko * +CK to eAcc_gb_est * * Revision 6.63  2003/10/31 20:16:07  ucko * CSeq_id::IdentifyAccession: CI and CJ are both DDBJ EST. * * Revision 6.62  2003/10/24 14:57:03  ucko * IdentifyAccession: CH -> eAcc_gb_con. * GetSeqIdString: include the database name for IDs of type general. * * Revision 6.61  2003/08/25 21:15:41  ucko * Tweak slightly for efficiency. * * Revision 6.60  2003/08/22 15:16:48  dondosha * Correction in CSeq_id constructor, to allow id strings starting with a gi id * * Revision 6.59  2003/08/11 14:37:20  ucko * IdentifyAccession: "CG" is GenBank GSS. * * Revision 6.58  2003/07/14 20:11:59  ucko * +CF (eAcc_gb_est) * * Revision 6.57  2003/07/02 13:46:14  ucko * +CE (eAcc_gb_gss) * * Revision 6.56  2003/06/24 16:33:48  ucko * CSeq_id::IdentifyAccession: always return unknown for accessions that * contain no digits, even if they happen to look like prefixes. * * Revision 6.55  2003/05/09 14:22:56  ucko * CSeq_id::x_Init: treat missing (chain) names as spaces (reported by * Michel Dumontier) and get rid of some unnecessary calls to c_str(). * * Revision 6.54  2003/04/30 14:41:01  ucko * CSeq_id::IdentifyAccession: CDnnnnnn -> eAcc_gb_est * * Revision 6.53  2003/03/25 15:37:18  ucko * CSeq_id::IdentifyAccession("CC...") -> eAcc_gb_gss * * Revision 6.52  2003/03/11 15:55:44  kuznets * iterate -> ITERATE * * Revision 6.51  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 6.50  2003/02/04 15:15:12  grichenk * Overrided Assign() for CSeq_loc and CSeq_id * * Revision 6.49  2003/01/18 08:40:03  kimelman * addes seqid constructor for numeric types * * Revision 6.48  2003/01/15 18:27:13  ucko * +AK (accidentally skipped earlier -- sigh) * * Revision 6.47  2003/01/10 15:57:30  ucko * Identify CB as gb_est. * * Revision 6.46  2003/01/08 16:48:03  ucko * +AL (accidentally skipped earlier) * * Revision 6.45  2003/01/07 19:52:15  ucko * Add more refseq types (NR_, NS_, NW_). * * Revision 6.44  2002/12/30 23:44:42  vakatov * CSeq_id::GetStringDescr() -- un-freeze "strstream" to avoid a mem.leak * * Revision 6.43  2002/12/26 16:39:25  vasilche * Object manager class CSeqMap rewritten. * * Revision 6.42  2002/12/03 15:55:12  dicuccio * Corrected processing of text id accessions with no accession set (in * GetSeqIdString()) - use name instead. * * Revision 6.41  2002/11/26 15:13:32  dicuccio * Added CSeq_id::GetStringDescr() - provides text representations of seq-ids in a * number of formats. * * Revision 6.40  2002/10/23 18:23:07  ucko * Add self-classification (using known type information). * * Revision 6.39  2002/10/22 20:19:14  jianye * Added GetSeqIdString() * * Revision 6.38  2002/10/18 16:03:08  ucko * +CA (eAcc_gb_est) * * Revision 6.37  2002/10/03 18:55:04  clausen * Removed extra whitespace * * Revision 6.36  2002/10/03 17:17:11  clausen * Added BestRank() and WorstRank() * * Revision 6.35  2002/10/03 16:03:00  ucko * +BZ (eAcc_gb_gss) * * Revision 6.34  2002/09/23 16:43:46  ucko * Change check for absence of '|' to use string::find. * * Revision 6.33  2002/09/20 19:55:29  ucko * +BY (eAcc_ddbj_est) * * Revision 6.32  2002/08/28 14:07:56  ucko * IdentifyAccession: handle BX (EMBL genome) * * Revision 6.31  2002/08/26 20:44:06  ucko * CSeq_id::IdentifyAccession: +BW (DDBJ EST) * * Revision 6.30  2002/08/19 16:54:30  ucko * IdentifyAccession: add BV (eAcc_gb_sts). * * Revision 6.29  2002/08/19 15:42:14  ucko * IdentifyAccession: add BU (eAcc_gb_est). * * Revision 6.28  2002/08/16 19:27:01  ucko * Recognize new WGS RefSeq accessions. * * Revision 6.27  2002/08/14 15:52:27  ucko * Add BT and XR_. * * Revision 6.26  2002/08/06 18:22:19  ucko * Properly handle versioned PDB accessions. * * Revision 6.25  2002/08/01 20:33:10  ucko * s_IdentifyAccession -> IdentifyAccession; s_ is only for module-static names. * * Revision 6.24  2002/07/30 19:42:44  ucko * Add s_IdentifyAccession, and use it in the string-based constructor if * the input isn't FASTA-format. * Move CVS log to end. * * Revision 6.23  2002/06/06 20:31:33  clausen * Moved methods using object manager to objects/util * * Revision 6.22  2002/05/22 14:03:40  grichenk * CSerialUserOp -- added prefix UserOp_ to Assign() and Equals() * * Revision 6.21  2002/05/06 03:39:12  vakatov * OM/OM1 renaming * * Revision 6.20  2002/05/03 21:28:17  ucko * Introduce T(Signed)SeqPos. * * Revision 6.19  2002/01/16 18:56:32  grichenk * Removed CRef<> argument from choice variant setter, updated sources to * use references instead of CRef<>s * * Revision 6.18  2002/01/10 19:00:04  clausen * Added GetLength * * Revision 6.17  2002/01/09 15:59:30  grichenk * Fixed includes * * Revision 6.16  2001/10/15 23:00:00  vakatov * CSeq_id::x_Init() -- get rid of unreachable "break;" * * Revision 6.15  2001/08/31 20:05:44  ucko * Fix ICC build. * * Revision 6.14  2001/08/31 16:02:10  clausen * Added new constructors for Fasta and added new id types, tpd, tpe, tpg * * Revision 6.13  2001/07/16 16:22:48  grichenk * Added CSerialUserOp class to create Assign() and Equals() methods for * user-defind classes. * Added SerialAssign<>() and SerialEquals<>() functions. * * Revision 6.12  2001/05/24 20:24:27  grichenk * Renamed seq/objmgrstub.hpp -> obgmgr/objmgr_base.hpp * Added Genbank, Embl and Ddbj support in CSeq_id::Compare() * Fixed General output by CSeq_id::WriteAsFasta() * * Revision 6.11  2001/04/17 04:14:49  vakatov * CSeq_id::AsFastaString() --> CSeq_id::WriteAsFasta() * * Revision 6.10  2001/01/03 16:39:05  vasilche * Added CAbstractObjectManager - stub for object manager. * CRange extracted to separate file. * * Revision 6.9  2000/12/26 17:28:55  vasilche * Simplified and formatted code. * * Revision 6.8  2000/12/15 19:30:31  ostell * Used Upcase() in AsFastaString() and changed to PNocase().Equals() style * * Revision 6.7  2000/12/08 22:19:45  ostell * changed MakeFastString to AsFastaString and to use ostream instead of string * * Revision 6.6  2000/12/08 20:45:14  ostell * added MakeFastaString() * * Revision 6.5  2000/12/04 15:09:41  vasilche * Added missing include. * * Revision 6.4  2000/11/30 22:08:18  ostell * finished Match() * * Revision 6.3  2000/11/30 16:13:12  ostell * added support for Textseq_id to Seq_id.Match() * * Revision 6.2  2000/11/28 12:47:41  ostell * fixed first switch statement to break properly * * Revision 6.1  2000/11/21 18:58:29  vasilche * Added Match() methods for CSeq_id, CObject_id and CDbtag. * * =========================================================================== */

⌨️ 快捷键说明

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