void test_query_batch() {
    string error_msg;
    vector<JOB_STATE> jobs;
    int batch_id = 207;
    const char* batch_name = "";
    int retval = query_batch(
        project_url, authenticator, batch_id, batch_name, jobs, error_msg
    );
    if (retval) {
        printf("Error: %d (%s)\n", retval, error_msg.c_str());
        return;
    }
    for (unsigned int i=0; i<jobs.size(); i++) {
        JOB_STATE& js = jobs[i];
        js.print();
    }
}
Exemple #2
0
int CVecScreenApp::Run(void)
{
    int status = BLAST_EXIT_SUCCESS;

    try {

        // Allow the fasta reader to complain on invalid sequence input
        SetDiagPostLevel(eDiag_Warning);

        const bool kIsProtein(false);
        /*** Process the command line arguments ***/
        const CArgs& args = GetArgs();
        const string kDbName(args[kArgDb].AsString());
        CRef<CBlastOptionsHandle> opts_hndl(CBlastOptionsFactory::Create(eVecScreen));

        /*** Initialize the scope ***/
        SDataLoaderConfig dlconfig(kDbName, kIsProtein);
        dlconfig.OptimizeForWholeLargeSequenceRetrieval();
        CBlastInputSourceConfig iconfig(dlconfig);
        iconfig.SetQueryLocalIdMode();
        CRef<CScope> scope = CBlastScopeSource(dlconfig).NewScope();

        /*** Initialize the input stream ***/
        CBlastFastaInputSource fasta(args[kArgQuery].AsInputFile(), iconfig);
        CBlastInput input(&fasta, 1);

        /*** Get the formatting options ***/
        const CVecscreenRun::CFormatter::TOutputFormat kFmt = 
            args[kArgOutputFormat].AsInteger();
        const bool kHtmlOutput = !args["text_output"].AsBoolean();
        
        /*** Process the input ***/
        while ( !input.End() ) {

            CRef<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
            _ASSERT(query_batch->Size() == 1);
            CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*query_batch));
            CVecscreenRun vs(CRef<CSeq_loc>(const_cast<CSeq_loc*>(&*query_batch->GetQuerySeqLoc(0))),
                             query_batch->GetScope(0), kDbName);
            CVecscreenRun::CFormatter vs_format(vs, *scope, kFmt, kHtmlOutput);
            vs_format.FormatResults(args[kArgOutput].AsOutputFile(), opts_hndl);
        }

    } CATCH_ALL(status)
    return status;
}