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

📄 data_manager.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
{    if (mimeData.NotEmpty())        return WriteASNToFile(filename, mimeData.GetObject(), isBinary, err, fixNonPrint);    else        return WriteASNToFile(filename, cddData.GetObject(), isBinary, err, fixNonPrint);}ncbi::objects::CCdd * ASNDataManager::GetInternalCDDData(void){    if (cddData.NotEmpty()) return cddData.GetPointer();    else if (mimeData.NotEmpty() && mimeData->IsGeneral() &&             mimeData->GetGeneral().GetSeq_align_data().IsCdd())        return &(mimeData->SetGeneral().SetSeq_align_data().SetCdd());    else        return NULL;}const ncbi::objects::CCdd * ASNDataManager::GetInternalCDDData(void) const{    if (cddData.NotEmpty()) return cddData.GetPointer();    else if (mimeData.NotEmpty() && mimeData->IsGeneral() &&             mimeData->GetGeneral().GetSeq_align_data().IsCdd())        return &(mimeData->GetGeneral().GetSeq_align_data().GetCdd());    else        return NULL;}bool ASNDataManager::IsCDD(void) const{    return (GetInternalCDDData() != NULL);}bool ASNDataManager::IsCDDInMime(void) const{    return (GetInternalCDDData() != NULL && mimeData.NotEmpty());}const string& ASNDataManager::GetCDDName(void) const{    static const string empty = "";    const CCdd *cdd = GetInternalCDDData();    if (cdd)        return cdd->GetName();    else        return empty;}bool ASNDataManager::SetCDDName(const string& name){    CCdd *cdd = GetInternalCDDData();    if (!cdd || name.size() == 0) return false;    cdd->SetName(name);    SetDataChanged(StructureSet::eCDDData);    return true;}const string& ASNDataManager::GetCDDDescription(void) const{    static const string empty = "";    const CCdd *cdd = GetInternalCDDData();    if (!cdd) return empty;    // find first 'comment' in Cdd-descr-set, assume this is the "long description"    if (!cdd->IsSetDescription() || cdd->GetDescription().Get().size() == 0) return empty;    CCdd_descr_set::Tdata::const_iterator d, de = cdd->GetDescription().Get().end();    for (d=cdd->GetDescription().Get().begin(); d!=de; ++d)        if ((*d)->IsComment())            return (*d)->GetComment();    return empty;}bool ASNDataManager::SetCDDDescription(const string& descr){    CCdd *cdd = GetInternalCDDData();    if (!cdd || descr.size() == 0) return false;    if (cdd->IsSetDescription() && cdd->GetDescription().Get().size() >= 0) {        // find first 'comment' in Cdd-descr-set, assume this is the "long description"        CCdd_descr_set::Tdata::iterator d, de = cdd->SetDescription().Set().end();        for (d=cdd->SetDescription().Set().begin(); d!=de; ++d) {            if ((*d)->IsComment()) {                if ((*d)->GetComment() != descr) {                    (*d)->SetComment(descr);                    SetDataChanged(StructureSet::eCDDData);                }                return true;            }        }    }    // add new comment if not yet present    CRef < CCdd_descr > comment(new CCdd_descr);    comment->SetComment(descr);    cdd->SetDescription().Set().push_front(comment);    SetDataChanged(StructureSet::eCDDData);    return true;}bool ASNDataManager::GetCDDNotes(TextLines *lines) const{    const CCdd *cdd = GetInternalCDDData();    if (!lines || !cdd) return false;    lines->clear();    if (!cdd->IsSetDescription() || cdd->GetDescription().Get().size() == 0)        return true;    // find scrapbook item    CCdd_descr_set::Tdata::const_iterator d, de = cdd->GetDescription().Get().end();    for (d=cdd->GetDescription().Get().begin(); d!=de; ++d) {        if ((*d)->IsScrapbook()) {            // fill out lines from scrapbook string list            lines->resize((*d)->GetScrapbook().size());            CCdd_descr::TScrapbook::const_iterator l, le = (*d)->GetScrapbook().end();            int i = 0;            for (l=(*d)->GetScrapbook().begin(); l!=le; ++l)                (*lines)[i++] = *l;            return true;        }    }    return true;}bool ASNDataManager::SetCDDNotes(const TextLines& lines){    CCdd *cdd = GetInternalCDDData();    if (!cdd) return false;    CCdd_descr::TScrapbook *scrapbook = NULL;    // find an existing scrapbook item    if (cdd->IsSetDescription()) {        CCdd_descr_set::Tdata::iterator d, de = cdd->SetDescription().Set().end();        for (d=cdd->SetDescription().Set().begin(); d!=de; ++d) {            if ((*d)->IsScrapbook()) {                if (lines.size() == 0) {                    cdd->SetDescription().Set().erase(d);   // if empty, remove scrapbook item                    SetDataChanged(StructureSet::eCDDData);                    TRACEMSG("removed scrapbook");                } else                    scrapbook = &((*d)->SetScrapbook());                break;            }        }    }    if (lines.size() == 0) return true;    // create a scrapbook item if doesn't exist already    if (!scrapbook) {        CRef < CCdd_descr > descr(new CCdd_descr());        scrapbook = &(descr->SetScrapbook());        cdd->SetDescription().Set().push_back(descr);    }    // fill out scrapbook lines    scrapbook->clear();    for (int i=0; i<lines.size(); ++i)        scrapbook->push_back(lines[i]);    SetDataChanged(StructureSet::eCDDData);    return true;}ncbi::objects::CCdd_descr_set * ASNDataManager::GetCDDDescrSet(void){    CCdd *cdd = GetInternalCDDData();    if (cdd) {        // make a new descr set if not present        if (!cdd->IsSetDescription()) {            CRef < CCdd_descr_set > ref(new CCdd_descr_set());            cdd->SetDescription(*ref);        }        return &(cdd->SetDescription());    } else        return NULL;}ncbi::objects::CAlign_annot_set * ASNDataManager::GetCDDAnnotSet(void){    CCdd *cdd = GetInternalCDDData();    if (cdd) {        // make a new annot set if not present        if (!cdd->IsSetAlignannot()) {			CRef < CAlign_annot_set > ref(new CAlign_annot_set());            cdd->SetAlignannot(*ref);        }        return &(cdd->SetAlignannot());    } else        return NULL;}const ncbi::objects::CSeq_id * ASNDataManager::GetCDDMaster3d(void) const{    const CCdd *cdd = GetInternalCDDData();    if (cdd && cdd->IsSetMaster3d())        return cdd->GetMaster3d().front().GetPointer(); // just return the first one...    else        return NULL;}void ASNDataManager::AddReject(ncbi::objects::CReject_id *reject){    CCdd *cdd = GetInternalCDDData();    if (!cdd) return;    cdd->SetRejects().push_back(CRef < CReject_id > (reject));    dataChanged |= StructureSet::eCDDData;}const StructureSet::RejectList * ASNDataManager::GetRejects(void) const{    const CCdd *cdd = GetInternalCDDData();    if (!cdd || !cdd->IsSetRejects())        return NULL;    return &(cdd->GetRejects());}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: data_manager.cpp,v $* Revision 1000.2  2004/06/01 18:28:33  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.23** Revision 1.23  2004/05/21 21:41:39  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.22  2004/05/21 17:29:51  thiessen* allow conversion of mime to cdd data** Revision 1.21  2004/03/15 18:25:36  thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.20  2004/02/19 17:04:55  thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.19  2003/08/21 18:02:01  thiessen* change header order for Mac compilation** Revision 1.18  2003/02/03 19:20:03  thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.17  2003/01/27 15:52:22  thiessen* merge after highlighted row; show rejects; trim rejects from new reject list** Revision 1.16  2002/11/22 19:48:14  thiessen* one more fix for const changes in objects API** Revision 1.15  2002/11/19 21:19:44  thiessen* more const changes for objects; fix user vs default style bug** Revision 1.14  2002/11/18 19:48:40  grichenk* Removed "const" from datatool-generated setters** Revision 1.13  2002/11/06 00:18:10  thiessen* fixes for new CRef/const rules in objects** Revision 1.12  2002/10/27 22:23:51  thiessen* save structure alignments from vastalign.cgi imports** Revision 1.11  2002/07/03 13:39:39  thiessen* fix for redundant sequence removal** Revision 1.10  2002/06/05 17:50:08  thiessen* title tweaks** Revision 1.9  2002/03/19 18:47:58  thiessen* small bug fixes; remember PSSM weight** Revision 1.8  2002/02/27 16:29:41  thiessen* add model type flag to general mime type** Revision 1.7  2002/02/19 14:59:39  thiessen* add CDD reject and purge sequence** Revision 1.6  2002/02/12 17:19:21  thiessen* first working structure import** Revision 1.5  2002/01/19 02:34:40  thiessen* fixes for changes in asn serialization API** Revision 1.4  2001/12/15 03:15:59  thiessen* adjustments for slightly changed object loader Set...() API** Revision 1.3  2001/12/06 23:13:45  thiessen* finish import/align new sequences into single-structure data; many small tweaks** Revision 1.2  2001/11/30 14:02:05  thiessen* progress on sequence imports to single structures** Revision 1.1  2001/11/27 16:26:08  thiessen* major update to data management system**/

⌨️ 快捷键说明

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