validerror_bioseqset.cpp

来自「ncbi源码」· C++ 代码 · 共 493 行 · 第 1/2 页

CPP
493
字号
        } // else if    } // iterate        CTypeConstIterator<CMolInfo> miit(ConstBegin(seqset));    const CMolInfo* mol_info = 0;        for (; miit; ++miit) {        if (mol_info == 0) {            mol_info = &(*miit);        } else if (mol_info->GetBiomol() != miit->GetBiomol() ) {            PostErr(eDiag_Error, eErr_SEQ_PKG_InconsistentMolInfoBiomols,                "Segmented set contains inconsistent MolInfo biomols",                seqset);            break;        }    } // for}void CValidError_bioseqset::ValidatePartsSet(const CBioseq_set& seqset){    CSeq_inst::EMol     mol = CSeq_inst::eMol_not_set;    CSeq_inst::EMol     seq_inst_mol;    ITERATE ( list< CRef<CSeq_entry> >, se_list_it, seqset.GetSeq_set() ) {        if ( (**se_list_it).IsSeq() ) {            const CSeq_inst& seq_inst = (**se_list_it).GetSeq().GetInst();            if ( mol == CSeq_inst::eMol_not_set  ||                 mol == CSeq_inst::eMol_other ) {                mol = seq_inst.GetMol();            } else  {                seq_inst_mol = seq_inst.GetMol();                if ( seq_inst_mol != CSeq_inst::eMol_other) {                    if ( seq_inst.IsNa() != CSeq_inst::IsNa(mol) ) {                        PostErr(eDiag_Critical, eErr_SEQ_PKG_PartsSetMixedBioseqs,                                 "Parts set contains mixture of nucleotides "                                 "and proteins", seqset);                        break;                    }                }            }        } else if ( (**se_list_it).IsSet() ) {            const CBioseq_set& set = (**se_list_it).GetSet();            const CEnumeratedTypeValues* tv =                 CBioseq_set::GetTypeInfo_enum_EClass();            const string& set_class_str =                 tv->FindName(set.GetClass(), true);            PostErr(eDiag_Error, eErr_SEQ_PKG_PartsSetHasSets,                    "Parts set contains unwanted Bioseq-set, "                    "its class is \"" + set_class_str + "\".", set);            break;        } // else if    } // for}void CValidError_bioseqset::ValidatePopSet(const CBioseq_set& seqset){    const CBioSource*   biosrc  = 0;    const string        *first_taxname = 0;    static const string influenza = "Influenza virus ";    static const string sp = " sp. ";        CTypeConstIterator<CBioseq> seqit(ConstBegin(seqset));    for (; seqit; ++seqit) {                biosrc = 0;                // Will get the first biosource either from the descriptor        // or feature.        CTypeConstIterator<CBioSource> biosrc_it(ConstBegin(*seqit));        if (biosrc_it) {            biosrc = &(*biosrc_it);        }                 if (biosrc == 0)            continue;                const string& taxname = biosrc->GetOrg().GetTaxname();        if (first_taxname == 0) {            first_taxname = &taxname;            continue;        }                // Make sure all the taxnames in the set are the same.        if ( NStr::CompareNocase(*first_taxname, taxname) == 0 ) {            continue;        }                // if the names differ issue an error with the exception of Influenza        // virus, where we allow different types of it in the set.        if ( NStr::StartsWith(taxname, influenza, NStr::eNocase)         &&            NStr::StartsWith(*first_taxname, influenza, NStr::eNocase)  &&            NStr::CompareNocase(*first_taxname, 0, influenza.length() + 1, taxname) == 0 ) {            continue;        }                // drops severity if first mismatch is same up to sp.        EDiagSev sev = eDiag_Error;        SIZE_TYPE pos = NStr::Find(taxname, sp);        if ( pos != NPOS ) {            SIZE_TYPE len = pos + sp.length();            if ( NStr::strncasecmp(first_taxname->c_str(),                                    taxname.c_str(),                                   len) == 0 ) {                sev = eDiag_Warning;            }        }        PostErr(eDiag_Error, eErr_SEQ_DESCR_InconsistentBioSources,            "Population set contains inconsistent organisms.",            *seqit);        break;    }}void CValidError_bioseqset::ValidateGenProdSet(const CBioseq_set& seqset){    bool                id_no_good = false;    CSeq_id::E_Choice   id_type = CSeq_id::e_not_set;        list< CRef<CSeq_entry> >::const_iterator se_list_it =        seqset.GetSeq_set().begin();        if ( !(**se_list_it).IsSeq() ) {        return;    }        const CBioseq& seq = (*se_list_it)->GetSeq();    CBioseq_Handle bsh = m_Scope->GetBioseqHandle(seq);    CFeat_CI fi(bsh, 0, 0, CSeqFeatData::e_Rna);    for (; fi; ++fi) {        if ( fi->GetData().GetSubtype() == CSeqFeatData::eSubtype_mRNA ) {            if ( fi->IsSetProduct() ) {                CBioseq_Handle cdna =                     m_Scope->GetBioseqHandle(fi->GetProduct());                if ( !cdna ) {                    try {                        const CSeq_id& id = GetId(fi->GetProduct(), m_Scope);                        id_type = id.Which();                    }                    catch (...) {                        id_no_good = true;                    }                                        // okay to have far RefSeq product                    if ( id_no_good  ||  (id_type != CSeq_id::e_Other) ) {                        string loc_label;                        fi->GetProduct().GetLabel(&loc_label);                                                if (loc_label.empty()) {                            loc_label = "?";                        }                                                PostErr(eDiag_Error,                            eErr_SEQ_PKG_GenomicProductPackagingProblem,                            "Product of mRNA feature (" + loc_label +                            ") not packaged in genomic product set", seq);                                            }                } // if (cdna == 0)            } else {                PostErr(eDiag_Error,                    eErr_SEQ_PKG_GenomicProductPackagingProblem,                    "Product of mRNA feature (?) not packaged in"                    "genomic product set", seq);            }        }    } // for }END_SCOPE(validator)END_SCOPE(objects)END_NCBI_SCOPE/** ===========================================================================** $Log: validerror_bioseqset.cpp,v $* Revision 1000.2  2004/06/01 19:47:54  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14** Revision 1.14  2004/05/21 21:42:56  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.13  2004/04/05 15:56:15  grichenk* Redesigned CAnnotTypes_CI: moved all data and data collecting* functions to CAnnotDataCollector. CAnnotTypes_CI is no more* inherited from SAnnotSelector.** Revision 1.12  2003/06/02 16:06:43  dicuccio* Rearranged src/objects/ subtree.  This includes the following shifts:*     - src/objects/asn2asn --> arc/app/asn2asn*     - src/objects/testmedline --> src/objects/ncbimime/test*     - src/objects/objmgr --> src/objmgr*     - src/objects/util --> src/objmgr/util*     - src/objects/alnmgr --> src/objtools/alnmgr*     - src/objects/flat --> src/objtools/flat*     - src/objects/validator --> src/objtools/validator*     - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.11  2003/04/29 14:45:47  shomrat* Bug fix in ValidateSegSet** Revision 1.10  2003/03/31 14:40:42  shomrat* $id: -> $id$** Revision 1.9  2003/03/18 21:48:37  grichenk* Removed obsolete class CAnnot_CI** Revision 1.8  2003/03/11 16:04:09  kuznets* iterate -> ITERATE** Revision 1.7  2003/02/14 15:11:57  shomrat* population study check for inconsistent organisms drops severity if first mismatch is same up to sp.** Revision 1.6  2003/02/07 21:18:38  shomrat* Initialize variable** Revision 1.5  2003/01/30 20:27:20  shomrat* Bug fix** Revision 1.4  2003/01/06 17:37:19  shomrat* Fixed mismatch types** Revision 1.3  2003/01/02 21:54:33  shomrat* Implemented IsMrnaProductInGPS** Revision 1.2  2002/12/24 16:53:24  shomrat* Changes to include directives** Revision 1.1  2002/12/23 20:16:16  shomrat* Initial submission after splitting former implementation*** ===========================================================================*/

⌨️ 快捷键说明

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