void CONFIG_Init(const CmdLineArgs& args) { TIMER(L"CONFIG_Init"); new CConfigDB; // Load the global, default config file g_ConfigDB.SetConfigFile(CFG_DEFAULT, L"config/default.cfg"); g_ConfigDB.Reload(CFG_DEFAULT); // 216ms // Try loading the local system config file (which doesn't exist by // default) - this is designed as a way of letting developers edit the // system config without accidentally committing their changes back to SVN. g_ConfigDB.SetConfigFile(CFG_SYSTEM, L"config/local.cfg"); g_ConfigDB.Reload(CFG_SYSTEM); g_ConfigDB.SetConfigFile(CFG_USER, L"config/user.cfg"); g_ConfigDB.Reload(CFG_USER); g_ConfigDB.SetConfigFile(CFG_MOD, L"config/mod.cfg"); // No point in reloading mod.cfg here - we haven't mounted mods yet ProcessCommandLineArgs(args); // Initialise console history file int max_history_lines = 200; CFG_GET_VAL("console.history.size", Int, max_history_lines); g_Console->UseHistoryFile(L"config/console.txt", max_history_lines); // Collect information from system.cfg, the profile file, // and any command-line overrides to fill in the globals. LoadGlobals(); // 64ms }
int CBlastDemoApplication::Run(void) { // Get arguments const CArgs& args = GetArgs(); EProgram program = ProgramNameToEnum(args["program"].AsString()); bool db_is_aa = (program == eBlastp || program == eBlastx || program == eRPSBlast || program == eRPSTblastn); CRef<CBlastOptionsHandle> opts(CBlastOptionsFactory::Create(program, CBlastOptions::eRemote)); ProcessCommandLineArgs(opts); opts->Validate(); // Can throw CBlastException::eInvalidOptions for invalid option. // This will dump the options to stderr. // opts->GetOptions().DebugDumpText(cerr, "opts", 1); CRef<CObjectManager> objmgr = CObjectManager::GetInstance(); if (!objmgr) { throw std::runtime_error("Could not initialize object manager"); } const bool is_protein = !!Blast_QueryIsProtein(opts->GetOptions().GetProgramType()); SDataLoaderConfig dlconfig(is_protein); CBlastInputSourceConfig iconfig(dlconfig, objects::eNa_strand_other, false, args["parse"].AsBoolean()); CBlastFastaInputSource fasta_input(args["in"].AsInputFile(), iconfig); CScope scope(*objmgr); CBlastInput blast_input(&fasta_input); TSeqLocVector query_loc = blast_input.GetAllSeqLocs(scope); CRef<IQueryFactory> query_factory(new CObjMgr_QueryFactory(query_loc)); const CSearchDatabase target_db(args["db"].AsString(), db_is_aa ? CSearchDatabase::eBlastDbIsProtein : CSearchDatabase::eBlastDbIsNucleotide); CRemoteBlast blaster(query_factory, opts, target_db); // This will dump a lot of stuff to stderr. // blaster.SetVerbose(); bool status = blaster.SubmitSync(); if (status == false) throw std::runtime_error("No results returned by SubmitSync"); cerr << "RID: " << blaster.GetRID() << '\n'; CSearchResultSet results = *blaster.GetResultSet(); CNcbiOstream& out = args["out"].AsOutputFile(); for (unsigned int i = 0; i < results.GetNumResults(); i++) { CConstRef<CSeq_align_set> sas = results[i].GetSeqAlign(); out << MSerial_AsnText << *sas; } return 0; }