⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blast_options_cxx.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: blast_options_cxx.cpp,v $ * PRODUCTION Revision 1000.2  2004/06/01 18:05:43  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.44 * PRODUCTION * =========================================================================== *//*  $Id: blast_options_cxx.cpp,v 1000.2 2004/06/01 18:05:43 gouriano Exp $* ===========================================================================**                            PUBLIC DOMAIN NOTICE*               National Center for Biotechnology Information**  This software/database is a "United States Government Work" under the*  terms of the United States Copyright Act.  It was written as part of*  the author's official duties as a United States Government employee and*  thus cannot be copyrighted.  This software/database is freely available*  to the public for use. The National Library of Medicine and the U.S.*  Government have not placed any restriction on its use or reproduction.**  Although all reasonable efforts have been taken to ensure the accuracy*  and reliability of the software and data, the NLM and the U.S.*  Government do not and cannot warrant the performance or results that*  may be obtained by using this software or data. The NLM and the U.S.*  Government disclaim all warranties, express or implied, including*  warranties of performance, merchantability or fitness for any particular*  purpose.**  Please cite the author in any work or product based on this material.** ===========================================================================** Author:  Christiam Camacho** File Description:*   Class to encapsulate all NewBlast options** ===========================================================================*//// @file blast_options_cxx.cpp/// Implements the CBlastOptions class, which encapsulates options structures/// from algo/blast/core#include <ncbi_pch.hpp>#include <algo/blast/api/blast_options.hpp>#include "blast_setup.hpp"#include <algo/blast/core/blast_extend.h>#include <objects/seqloc/Seq_loc.hpp>#include <objects/blast/Blast4_cutoff.hpp>/** @addtogroup AlgoBlast * * @{ */BEGIN_NCBI_SCOPEUSING_SCOPE(objects);BEGIN_SCOPE(blast)CBlastOptions::CBlastOptions(EAPILocality locality)    : m_Local (0),      m_Remote(0){    if (locality != eRemote) {        m_Local = new CBlastOptionsLocal();    }    if (locality != eLocal) {        m_Remote = new CBlastOptionsRemote();    }}CBlastOptions::~CBlastOptions(){    if (m_Local) {        delete m_Local;    }    if (m_Remote) {        delete m_Remote;    }}// Note: only some of the options are supported for the remote case;// for now, I will throw a string exception if the option is not// available.int xyz_throwing = 0;void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const EProgram & v){    switch(opt) {    case eBlastOpt_Program:        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%d), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const int & v){    switch(opt) {    case eBlastOpt_WordSize:        x_SetParam("WordSize", v);        return;            case eBlastOpt_StrandOption:        {            typedef objects::EBlast4_strand_type TSType;            TSType strand;            bool set_strand = true;                        switch(v) {            case 1:                strand = eBlast4_strand_type_forward_strand;                break;                            case 2:                strand = eBlast4_strand_type_reverse_strand;                break;                            case 3:                strand = eBlast4_strand_type_both_strands;                break;                            default:                set_strand = false;            }                        if (set_strand) {                x_SetParam("StrandOption", strand);                return;            }        }            case eBlastOpt_WindowSize:        x_SetParam("WindowSize", v);        return;            case eBlastOpt_GapOpeningCost:        x_SetParam("GapOpeningCost", v);        return;            case eBlastOpt_GapExtensionCost:        x_SetParam("GapExtensionCost", v);        return;            case eBlastOpt_HitlistSize:        x_SetParam("HitlistSize", v);        return;            case eBlastOpt_PrelimHitlistSize:        x_SetParam("PrelimHitlistSize", v);        return;            case eBlastOpt_CutoffScore:        if (0) {            typedef objects::CBlast4_cutoff TCutoff;            CRef<TCutoff> cutoff(new TCutoff);            cutoff->SetRaw_score(v);                        x_SetParam("CutoffScore", cutoff);        }        return;            case eBlastOpt_MatchReward:        x_SetParam("MatchReward", v);        return;            case eBlastOpt_MismatchPenalty:        x_SetParam("MismatchPenalty", v);        return;    case eBlastOpt_WordThreshold:        x_SetParam("WordThreshold", v);        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%d), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const double & v){    switch(opt) {    case eBlastOpt_EvalueThreshold:        {            typedef objects::CBlast4_cutoff TCutoff;            CRef<TCutoff> cutoff(new TCutoff);            cutoff->SetE_value(v);                        x_SetParam("EvalueThreshold", cutoff);        }        return;            case eBlastOpt_PercentIdentity:        x_SetParam("PercentIdentity", v);        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%f), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const char * v){    switch(opt) {    case eBlastOpt_FilterString:        x_SetParam("FilterString", v);        return;            case eBlastOpt_MatrixName:        x_SetParam("MatrixName", v);        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%.20s), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const TSeqLocVector & v){    char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and TSeqLocVector (size %d), line (%d).",            int(opt), v.size(), __LINE__);        x_Throwx(string("err:") + errbuf);}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const SeedContainerType & v){    char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%d), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const SeedExtensionMethod & v){    char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%d), line (%d).",            int(opt), v, __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const bool & v){    switch(opt) {    case eBlastOpt_GappedMode:        {            bool ungapped = ! v;            x_SetParam("UngappedMode", ungapped); // inverted            return;        }            case eBlastOpt_OutOfFrameMode:        x_SetParam("OutOfFrameMode", v);        return;            case eBlastOpt_UseRealDbSize:        x_SetParam("UseRealDbSize", v);        return;            case eBlastOpt_SkipTraceback:        x_SetParam("SkipTraceback", v);        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%s), line (%d).",            int(opt), (v ? "true" : "false"), __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}void CBlastOptionsRemote::SetValue(EBlastOptIdx opt, const Int8 & v){    switch(opt) {    case eBlastOpt_EffectiveSearchSpace:        x_SetParam("EffectiveSearchSpace", v);        return;            default:        break;    }        char errbuf[1024];        sprintf(errbuf, "tried to set option (%d) and value (%f), line (%d).",            int(opt), double(v), __LINE__);        if (xyz_throwing)        x_Throwx(string("err:") + errbuf);    else        cout << "** WOULDA THROWN: " << errbuf << endl;}CBlastOptionsLocal::CBlastOptionsLocal(){    m_QueryOpts.Reset((QuerySetUpOptions*)calloc(1, sizeof(QuerySetUpOptions)));    m_InitWordOpts.Reset((BlastInitialWordOptions*)calloc(1, sizeof(BlastInitialWordOptions)));    m_LutOpts.Reset((LookupTableOptions*)calloc(1, sizeof(LookupTableOptions)));    m_ExtnOpts.Reset((BlastExtensionOptions*)calloc(1, sizeof(BlastExtensionOptions)));    m_HitSaveOpts.Reset((BlastHitSavingOptions*)calloc(1, sizeof(BlastHitSavingOptions)));    m_ScoringOpts.Reset((BlastScoringOptions*)calloc(1, sizeof(BlastScoringOptions)));    m_EffLenOpts.reset((BlastEffectiveLengthsOptions*)calloc(1, sizeof(BlastEffectiveLengthsOptions)));    m_DbOpts.Reset((BlastDatabaseOptions*)calloc(1, sizeof(BlastDatabaseOptions)));    m_PSIBlastOpts.Reset((PSIBlastOptions*)calloc(1, sizeof(PSIBlastOptions)));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -