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; }
CBioseq_Handle CSimpleOM::GetBioseqHandle(TGi gi) { CSeq_id id; id.SetGi(gi); return GetBioseqHandle(id); }