Пример #1
0
void 
CImportStrategy::FetchData()
{
    if (m_Data->valid) {
        return;
    }
    const CBlast4_queue_search_request& req(m_Request->GetBody().GetQueue_search());
    m_OptionsBuilder.reset(new CBlastOptionsBuilder(req.GetProgram(),
                                                    req.GetService(),
                                                    CBlastOptions::eBoth,
                                                    m_IgnoreUnsupportedOptions));

    // Create the BLAST options
    const CBlast4_parameters* algo_opts(0);
    const CBlast4_parameters* prog_opts(0);
    const CBlast4_parameters* format_opts(0);

    if (req.CanGetAlgorithm_options()) {
            algo_opts = &req.GetAlgorithm_options();
    }
    if (req.CanGetProgram_options()) {
            prog_opts = &req.GetProgram_options();
    }
    if (req.CanGetFormat_options()) {
        format_opts = &req.GetFormat_options();
        	const CBlast4_queue_search_request::TFormat_options	& format_options = req.GetFormat_options();
        	CRef<CBlast4_parameter> p = format_options.GetParamByName(CBlast4Field::GetName(eBlastOpt_Web_StepNumber));
        if(p.NotEmpty() && p->CanGetValue()) {
            try {
        			m_Data->m_PsiNumOfIterations = p->GetValue().GetInteger();
            } catch (const CInvalidChoiceSelection&) {
                // this is needed because the web PSI-BLAST encodes
                // this value as a string
                m_Data->m_PsiNumOfIterations =
                    NStr::StringToInt(p->GetValue().GetString(),
                                      NStr::fConvErr_NoThrow);
        	}
        }
    }

    m_Data->m_OptionsHandle =
        m_OptionsBuilder->GetSearchOptions(algo_opts, prog_opts, format_opts,
                                           &m_Data->m_Task);
    m_Data->m_QueryRange = m_OptionsBuilder->GetRestrictedQueryRange();
    if(m_OptionsBuilder->HasDbFilteringAlgorithmId())
    	m_Data->m_FilteringID = m_OptionsBuilder->GetDbFilteringAlgorithmId();
    if(m_OptionsBuilder->HasDbFilteringAlgorithmKey())
    	m_Data->m_FilteringKey = m_OptionsBuilder->GetDbFilteringAlgorithmKey();
    if(m_OptionsBuilder->GetSubjectMaskingType())
    	m_Data->m_SubjectMaskingType = m_OptionsBuilder->GetSubjectMaskingType();
    m_Data->valid = true;
}