Exemple #1
0
bool CSeq_id_Handle::operator==(const CSeq_id& id) const
{
    if ( IsGi() ) {
        return id.IsGi() && id.GetGi() == m_Packed;
    }
    return *this == GetMapper().GetHandle(id);
}
Exemple #2
0
int CTitleTester::Run(void)
{
    const CArgs&   args = GetArgs();
    CRef<CObjectManager> objmgr = CObjectManager::GetInstance();
    CScope         scope(*objmgr);
    CSeq_id        id;
    
    CGBDataLoader::RegisterInObjectManager(*objmgr);
    scope.AddDefaults();

    CDeflineGenerator gen;
    CDeflineGenerator::TUserFlags flags = 0;
    if (args["reconstruct"]) {
        flags |= CDeflineGenerator::fIgnoreExisting;
    }
    if (args["allproteins"]) {
        flags |= CDeflineGenerator::fAllProteinNames;
    }
    if (args["localannots"]) {
        flags |= CDeflineGenerator::fLocalAnnotsOnly;
    }

    if (args["gi"]) {
        id.SetGi(args["gi"].AsInteger());
        CBioseq_Handle handle = scope.GetBioseqHandle(id);
        NcbiCout << gen.GenerateDefline(handle, flags) << NcbiEndl;
    } else {
        CNcbiIstream& in(args["in"].AsInputFile());
        while (in >> id.SetGi()) {
            string s;
            try {
                CBioseq_Handle handle = scope.GetBioseqHandle(id);
                s = gen.GenerateDefline(handle, flags);
            } catch (exception& e) {
                s = e.what();
            }
            NcbiCout << id.GetGi() << ": " << s << NcbiEndl;
        }
    }
    return 0;
}
static string s_IdLabel(const CSeq_id& cxx_id, EIDLabelType type)
{
    string               label;
    CSeq_id::ELabelType  gl_type = CSeq_id::eContent;
    CSeq_id::TLabelFlags flags = (CSeq_id::fLabel_Version |
                                  CSeq_id::fLabel_GeneralDbIsContent);

    switch (type) {
    case eFastaShort:   gl_type  =  CSeq_id::eFasta;                     break;
    case eTextAccOnly:  flags   &= ~CSeq_id::fLabel_Version;             break;
    case eReport:       flags   &= ~CSeq_id::fLabel_GeneralDbIsContent;  break;
    default:            break;
    }
    cxx_id.GetLabel(&label, gl_type, flags);
    return label;
}
bool CFastaDeflineReader::x_IsValidLocalID(const CSeq_id& id, TFastaFlags fasta_flags) 
{
    string id_label;
    id.GetLabel(&id_label, 0, CSeq_id::eContent);
    return x_IsValidLocalID(id_label, fasta_flags);
}
Exemple #5
0
CBioseq_Handle CSimpleOM::GetBioseqHandle(TGi gi)
{
    CSeq_id id;
    id.SetGi(gi);
    return GetBioseqHandle(id);
}